Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: configurable image resolution for barcode scanning #220

Open
3 of 7 tasks
jkorrek opened this issue Jan 7, 2025 · 1 comment
Open
3 of 7 tasks

feat: configurable image resolution for barcode scanning #220

jkorrek opened this issue Jan 7, 2025 · 1 comment

Comments

@jkorrek
Copy link

jkorrek commented Jan 7, 2025

Plugin(s)

  • Barcode Scanning
  • Face Detection
  • Face Mesh Detection
  • Selfie Segmentation
  • Translation

Current problem

I am having trouble scanning certain barcodes or datamatrix, especially on android. This seems to happen when trying to scan smaller barcodes.

After investigating a bit, I found out, that no targetResolution is specified for the android implementation. The ImageAnalysis class will use 640x480 as a default.
The iOS implementation uses AVCaptureSession.Preset.hd1280x720.

The mlkit guidelines recommend 1280x780 or 1920x1080.

After increasing the resolution for the android implementation, scanning the "problematic" codes was going much better.

Preferred solution

The image resolution used for detection should be either configurable. Maybe not on an "pixel perfect" level, but rather an enum with values corresponding to 1280x780, 1920x1080, ...

Alternative options

If this should not be configurable, maybe setting a higher default resolution for android (also to 1280x780 maybe?) would be a good idea.

Additional context

I would be happy to provide a PR, if one of my suggestions would be acceptable.

Before submitting

@robingenz
Copy link
Member

Great idea. Feel free to create a PR. I suggest the following types:

export interface StartScanOptions {
  formats?: BarcodeFormat[];
  lensFacing?: LensFacing;
  resolution?: Resolution;
}

export enum Resolution {
  '640x480' = 0,
  '1280x720' = 1,
  '1920x1080' = 2
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants