Skip to content

[Feature request] Add cropRect support for InputImage.fromMediaImage (or similar API to check barcode preview bounds) #491

Open
@G00fY2

Description

@G00fY2

What's your feature request? Please describe.
We are using the ML Kit barcode-scanning library in conjunction with CameraX ImageAnalysis.Analyzer. There is currently no sufficient way to limit the area in which ML Kit should search for the barcode (basically making sure the barcode result is inside the preview bounds). E.g. even if cropRect is set, ML Kit will scan the whole image for barcodes. This way the users can't point the camera at a specific barcode without scanning all barcodes which are visible to the camera.

Mobile environment
Android 12
androidx.camera:camera-camera2 1.0.2
com.google.mlkit:barcode-scanning 17.0.2

Additional context
#234 was closed without any updates for over 15 month.

There is no sample to achieve such a common usecase in the vision-quickstart sample project.

In the material-showcase sample project the logic about detecting if the result is inside the overlay starts here:

But this requires a custom GraphicOverlay class which on the other hand depends on a complex CameraSource class which are all build on top of the deprecated default Android Camera framework.

There are suggestions on SO which rely on complex and errorprone bitmap preprocessing.

So in the end there is no developer friendly and reliable way of checking the barcode bounds with the CameraX previous bounds.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions