I don't know why it's not worked with me. If I set orientation as portrait in manifest file I am getting 90 degree rotated image in my preview. But in the case of landscape orientation I am getting normal image in my preview while my phone orientation is portrait I know it is 90 degree rotated from landscape , and while saving or drawing to a canvas I am getting 90 degree rotated image. For this issue I just rotated my image 90 degree backward. I thought it is better to set the orientation correctly rather than rotating the image after capture.........
On Monday, 22 October 2012 20:58:26 UTC+5:30, spartygw wrote: > > Camera.setDisplayOrientation works for me, I could never seem to get any > rotation stuff to work that I tried to set using the Camera.Parameters. > > -gw > > On Monday, October 22, 2012 2:23:46 AM UTC-4, Haris wrote: >> >> Hi all For my application I am using android native camera and previewing >> the image using surface view. But everything is working except the camera >> orientation. When I open the camera by setting >> screenOrientation="landscape on manifest file I am getting the preview >> without any problem in landscape mode. But I need to take image in portrait >> mode, for this I changed my manifest like >> android:screenOrientation="portrait" and change my code like >> mCamera.setDisplayOrientation(90), params.set("orientation", >> "landscape"),params.set("rotation", 90), but still I am getting 90 degree >> rotated image. I searched a lot but nothing solved my problem... >> >> And my code is >> >> public void setupCamera(int width, int height) { >> Log.i(TAG, "setupCamera"); >> synchronized (this) { >> if (mCamera != null) { >> Camera.Parameters params = mCamera.getParameters(); >> List<Camera.Size> sizes = >> params.getSupportedPreviewSizes(); >> List<Camera.Size> >> imgsize=params.getSupportedPictureSizes(); >> mFrameWidth = width; >> mFrameHeight = height; >> >> // mCamera.setDisplayOrientation(90); >> params.set("orientation", "landscape"); >> params.set("rotation", 90); >> // selecting optimal camera preview size >> { >> int minDiff = Integer.MAX_VALUE; >> for (Camera.Size size : sizes) { >> if (Math.abs(size.height - height) < minDiff) { >> mFrameWidth = size.width; >> mFrameHeight = size.height; >> minDiff = Math.abs(size.height - height); >> } >> } >> } >> >> params.setPreviewSize(getFrameWidth(), getFrameHeight()); >> >> >> >> >> List<String> FocusModes = params.getSupportedFocusModes(); >> if >> (FocusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) >> { >> >> params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); >> } >> >> mCamera.setParameters(params); >> >> >> >> mCamera.startPreview(); >> } >> } >> } >> >> >> I am using micromax A52 mmodel with android 2.3.... >> >> > -- 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