Android CameraSource.takephoto旋转
使用Google VisionAndroid CameraSource.takephoto旋转,android,google-vision,Android,Google Vision,使用Google VisionCameraSource.takephoto我想拍照来检测人脸,但照片是旋转的。我曾尝试使用我的遗留代码来旋转它 val ei = ExifInterface(imageUri.getPath()) val orientation = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED) Log.d("BitmapProcessor", "ori
CameraSource.takephoto
我想拍照来检测人脸,但照片是旋转的。我曾尝试使用我的遗留代码来旋转它
val ei = ExifInterface(imageUri.getPath())
val orientation = ei.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED)
Log.d("BitmapProcessor", "orientation $orientation")
when (orientation) {
ExifInterface.ORIENTATION_ROTATE_90 -> rotateImage(img, 90f)
ExifInterface.ORIENTATION_ROTATE_180 -> rotateImage(img, 180f)
ExifInterface.ORIENTATION_ROTATE_270 -> rotateImage(img, 270f)
else -> return
}
但是ExifInterface.getAttribut
总是返回0,所以图像保持错误的旋转