Hi thanks all for your replays.. 

        Yesterday I have checked some application from google play like 
pudding camera etc. and it's working perfectly. Even if I access the 
default camera from my application I am getting normal preview but while 
saving it is rotated. The reason why I need to use in portrait mode is that 
after capture I have to do some image processing algorithms on the image 
using opencv, and  on the JNI part it seems that  height of the image 
became width and width became height and all these because of the rotation. 
To avoid that confusion, -I know that not a big issue I just need to rotate 
the image 90 degree  backward-  I thought it is better to modify the camera 
orientation . Can any one give me a working source code for changing the 
camera orientation, may be it's my coding problem........

Thanks....
Haris

On Wednesday, 24 October 2012 10:20:31 UTC+5:30, Adam Ratana wrote:
>
> Haris, take a look a this:
>
>
> http://developer.android.com/reference/android/hardware/Camera.html#setDisplayOrientation(int)
>
> This is for API 8 (2.2+) devices.  I've found that there's no reliable way 
> to guarantee this to work on 2.1 devices by setting the camera parameters 
> the way you are now, some just won't do it.
>
> I've just spent quite a bit of my spare time working on implementing a 
> portrait mode activity option for the camera preview - to answer Spooky's 
> question, the main reason one might do this is because it goes well with 
> the UI/UX of the application (specifically the other activities which share 
> a common UI), and the application for the camera activity is augmented 
> reality, and for most devices that I've had experience with, the sensors 
> seem to be most accurate when the phone is held in portrait - though this 
> can clearly vary.  It also was desired to have a working portrait mode 
> version of the camera activity, instead of forcing the user to then change 
> the way they were holding the device.  Instagram is one massively popular 
> application which does this as well (or at least, appears to do so), and I 
> think it works well with their UI.
>
> You can of course, take advantage of the above method to simply rotate the 
> preview depending on the current orientation of the device - either 
> portrait or landscape, and indeed have different UIs for either scenario if 
> you wish.  Of course then choosing the optimal preview size for your 
> orientation, taking into account status bars or full screen, etc, can then 
> be tricky and yield different results for each.  The default camera app 
> seems to rotate it's UI elements which is a pretty neat solution.  Rotating 
> any preview frames or shots is the least of the worries here, that's 
> relatively simple to do.
>
> I plan on cleaning up and open sourcing a proof of concept project I built 
> which does a bunch of things, including dealing with having a camera 
> orientation the same as the device orientation, and rotating it when the 
> device rotates, etc, since this seems a really painful thing.  I'll post 
> back here when it's up, probably within a month.
>
>
> On Tuesday, October 23, 2012 12:28:46 PM UTC-4, Spooky wrote:
>>
>> I'm assuming that you have some specific reason for wanting to use 
>> portrait, where "normal" camera orientation is landscape?  In every 
>> camera I've seen, used, or read about, the normal orientation is 
>> landscape.  If you want portrait, you have to rotate the camera. 
>> I recall reading somewhere in the developer's guide docs on the 
>> camera that (as with 35mm and DSLR cameras) the Android camera's 
>> normal orientation is landscape.  You CAN change that in java, 
>> if you want to, though (but why would you?  if the user wants 
>> to rotate the camera for a portrait-oriented shot, they'll 
>> just rotate the device) 
>>
>> Later, 
>>    --jim 
>>
>> -- 
>> THE SCORE:  ME:  2  CANCER:  0 
>> 73 DE N5IAL (/4) //  North American Hunting Club Member #70781171 
>> ICBM/Hurr.: 30.44406N 86.59909W // Running Mac OS X Lion > 
>>
>>    "Now what *you* need is a proper pint of porter poured in a proper 
>>    pewter porter pot.."     --Peter Dalgaard in alt.sysadmin.recovery 
>>
>>
>>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to