List of utility methods to do Camera Orientation Check
int | getCameraOrientation(int cameraId) get Camera Orientation Camera.CameraInfo info = new Camera.CameraInfo(); Camera.getCameraInfo(cameraId, info); return info.orientation; |
int | getDisplayOrientation(int degrees, int cameraId) get Display Orientation Camera.CameraInfo info = new Camera.CameraInfo(); Camera.getCameraInfo(cameraId, info); int result; if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) { result = (info.orientation + degrees) % 360; result = (360 - result) % 360; } else { result = (info.orientation - degrees + 360) % 360; ... |
int | getCameraDisplayOrientation(Context context, int cameraId, android.hardware.Camera camera) get Camera Display Orientation android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); android.hardware.Camera.getCameraInfo(cameraId, info); int rotation = ((WindowManager) context .getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay().getRotation(); int degrees = 0; switch (rotation) { case Surface.ROTATION_0: ... |
int | getCameraPhotoOrientation(Context context, Uri imageUri, String imagePath) Gets the camera photo orientation. int rotate = 0; context.getContentResolver().notifyChange(imageUri, null); File imageFile = new File(imagePath); ExifInterface exif = new android.media.ExifInterface( imageFile.getAbsolutePath()); int orientation = exif.getAttributeInt( ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); ... |