Android 捕获的图像保存为镜像

问题描述 投票:0回答:1
val outputOptions = ImageCapture
        .OutputFileOptions
        .Builder(photoFile)
        .setMetadata(ImageCapture.Metadata().also {
            it.isReversedHorizontal = CameraSelector.LENS_FACING_FRONT == lensFacing
        }).build()

imageCapture.takePicture(
                    outputOptions, cameraExecutor, object : ImageCapture.OnImageSavedCallback {
                        override fun onError(exc: ImageCaptureException) {
                            Log.e(TAG, "Photo capture failed: ${exc.message}", exc)
                        }

                        override fun onImageSaved(output: ImageCapture.OutputFileResults) {
                            val savedUri = output.savedUri ?: Uri.fromFile(photoFile)
                            Log.d(TAG, "Photo capture succeeded: $savedUri")
                        }
                    })

虽然查看图像工作正常,但在本地保存时工作不正常,而是在镜像中。请帮忙解决这个问题

android kotlin camera android-camera-intent android-camerax
1个回答
0
投票

它是镜像的,因为你要求它为前置摄像头镜像它。只需删除此:

.setMetadata(ImageCapture.Metadata().also {
            it.isReversedHorizontal = CameraSelector.LENS_FACING_FRONT == lensFacing
        }
© www.soinside.com 2019 - 2024. All rights reserved.