Michael Bodnar
Michael Bodnar

Reputation: 71

Android camera setOrientation not affected

I write my own app of camera and have issue with output image. When i tring to make a picture i set orientation degree using next code:

mCamera.getParameters().set("rotation", mOrientation);

or

mCamera.getParameters().setRotation(mOrientation);

or

mCamera.getParameters().setRotation(0);

all of these snippets doesn't rotate output image

Upvotes: 1

Views: 86

Answers (2)

Myszsoda
Myszsoda

Reputation: 339

You are missing setParameters, that's why I like spliting Usually I use:

Camera.Parameters parameters=mcamera.getParameters(); parameters.setRotation(90); //use 90, 180, 270 mCamera.setParameters(parameters);

Though making shortcut of it, I am not sure if it works, so I suggest upper method

mCamera.setParameters(mCamera.getParameters.setRotation(90));

Upvotes: 0

pkgrover
pkgrover

Reputation: 305

try using like this

 if (camInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
                displayRotation = (cameraRotationOffset + degrees) % 360;
                displayRotation = (360 - displayRotation) % 360; // compensate
                // the
                // mirror
            } else { // back-facing
                displayRotation = (cameraRotationOffset - degrees + 360) % 360;
            }
 cam.setDisplayOrientation(displayRotation);

replace degree with your angle

Upvotes: 1

Related Questions