Android 设置DisplayOrientation(90)时如何旋转结果图像(或视频)?
我创建了一个摄像头应用程序:Android 设置DisplayOrientation(90)时如何旋转结果图像(或视频)?,android,Android,我创建了一个摄像头应用程序: mCamera =Camera.open() mCamera.setDisplayOrientation(90); 我可以拍摄图像和视频。但结果不是旋转90度。 摄像机的旋转结果如何与摄像机的视角一致? 或者将结果输出设置为相同的setDisplayOrientation?以在拍摄后旋转图像,请使用android中的EXIF界面 ExifInterface exif; try { exif = new ExifInterface(f
mCamera =Camera.open()
mCamera.setDisplayOrientation(90);
我可以拍摄图像和视频。但结果不是旋转90度。
摄像机的旋转结果如何与摄像机的视角一致?
或者将结果输出设置为相同的setDisplayOrientation?以在拍摄后旋转图像,请使用android中的EXIF界面
ExifInterface exif;
try {
exif = new ExifInterface(filePath);
int orientation = exif.getAttributeInt(
ExifInterface.TAG_ORIENTATION, 0);
Log.d("EXIF", "Exif: " + orientation);
Matrix matrix = new Matrix();
if (orientation == 6) {
matrix.postRotate(90);
Log.d("EXIF", "Exif: " + orientation);
} else if (orientation == 3) {
matrix.postRotate(180);
Log.d("EXIF", "Exif: " + orientation);
} else if (orientation == 8) {
matrix.postRotate(270);
Log.d("EXIF", "Exif: " + orientation);
}
bmp = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(),
bmp.getHeight(), matrix, true);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
是否在imageview中显示结果?你想在哪里旋转;相机本身还是在拍摄图像后?说得更具体点。。!通过mCamera,摄像机旋转正常。设置显示方向(90);但相机的结果不是旋转。它可以随视频旋转吗?我想将相机的结果设置为与相机的视图(图像和视频)相同。你知道吗?