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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
No comments:
Post a Comment