fixed a bug
This commit is contained in:
@@ -8,10 +8,10 @@ import androidx.camera.core.ImageProxy
|
||||
|
||||
@ExperimentalGetImage
|
||||
object ImageUtils {
|
||||
fun imageProxyToBitmap(imageProxy: ImageProxy): Bitmap {
|
||||
fun imageProxyToBitmap(imageProxy: ImageProxy, applyRotation: Boolean = true): Bitmap {
|
||||
val image = imageProxy.image ?: error("ImageProxy does not contain an image.")
|
||||
val bitmap = yuv420ToBitmap(image)
|
||||
if (imageProxy.imageInfo.rotationDegrees == 0) {
|
||||
if (!applyRotation || imageProxy.imageInfo.rotationDegrees == 0) {
|
||||
return bitmap
|
||||
}
|
||||
val matrix = Matrix().apply {
|
||||
|
||||
Reference in New Issue
Block a user