Google Vision を使用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.getAttribureInt
常に0を返すため、画像は間違った回転を維持します