Closed
Description
I'm trying to use simplest qr scanning image analyzer.
And I am trying to scan not the entire area of the screen, but only the center bounded by the frame.
In this example, I set the crop rect for MediaImage, which will be converted to the InputImage and then passed to the scanner.
but scanner still scan entire area
override fun analyze(imageProxy: ImageProxy) {
val mediaImage = imageProxy.image
if (mediaImage != null) {
val cropSize = (min(mediaImage.width, mediaImage.height) * 0.6f).toInt()
val cropRect = Rect(mediaImage.width / 2 - cropSize / 2, mediaImage.height / 2 - cropSize / 2,
mediaImage.width / 2 + cropSize / 2, mediaImage.height / 2 + cropSize / 2)
//here i set crop rect
mediaImage.cropRect = cropRect
val image = InputImage.fromMediaImage(mediaImage, imageProxy.imageInfo.rotationDegrees)
//but here scanner wil process whole image instead of small area
pendingTask = scanner.process(image)
.addOnSuccessListener { barcodes ->
//do something
}
.addOnCompleteListener {
imageProxy.close()
}
}
}
Metadata
Metadata
Assignees
Labels
No labels