I am using CameraX
Here is my image capture :
mImageCapture = ImageCapture.Builder()
.setCaptureMode(ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY)
.setTargetAspectRatio(screenAspectRatio)
.build()
ImageCaptureListener :
mImageCapture.takePicture(
executor!!,
object : ImageCapture.OnImageCapturedCallback() {
override fun onCaptureSuccess(image: ImageProxy) {
Log.d("AAAA", "Success")
val rotatedBitmap = bitmapHelper.rotateImage(
bitmapHelper.imageToBitmap(image = image.image!!),
image.imageInfo.rotationDegrees.toFloat()
)
runOnUiThread {
mImageView.setImageBitmap(rotatedBitmap)
}
}
override fun onError(
imageCaptureError: Int,
message: String,
cause: Throwable?
) {
2
super.onError(imageCaptureError, message, cause)
}
})
When i call takePicture
app freezes, and only after 3-4 seconds onCaptureSuccess called
How can I make this process faster?
image.close()
. Try it, beforerunOnUiThread
– Arthralgia