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

Focus in center/scanning box #119

Open
3 of 7 tasks
Melynt3 opened this issue Jan 11, 2024 · 8 comments
Open
3 of 7 tasks

Focus in center/scanning box #119

Melynt3 opened this issue Jan 11, 2024 · 8 comments

Comments

@Melynt3
Copy link

Melynt3 commented Jan 11, 2024

Plugin(s)

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

Current problem

Im having a problem with losing focus with im zooming or moving my phone, camera is somehow focusing on other elements viewed in camera which sometimes is problematic

Preferred solution

Adding an option to set focus in scanning box or make it possible to focus only on center.

Alternative options

No response

Additional context

No response

Before submitting

@KoblerS
Copy link

KoblerS commented Jan 15, 2024

I have the same problem with iPhone 15 pro max using the barcode functionality. Is there any way to enable autofocus?

@robingenz
Copy link
Member

Not yet, but PRs are welcome.

@randy-johnson
Copy link

I tried giving this a whirl using the example code here: https://developers.google.com/ml-kit/vision/barcode-scanning/android#java

To enable auto-zooming and customize the experience, you can utilize the setZoomSuggestionOptions() method along with your own ZoomCallback handler and desired maximum zoom ratio, as demonstrated in the code below.

Here is the code in the file: https://github.com/randy-johnson/capacitor-mlkit/pull/1/files#diff-fc2cef0bd325278367eb925e138d31a998df13843c0885139505058aa5dd68deR414-R428

But I get this error when trying to install in my app:

[vite] Internal server error: Failed to resolve entry for package "@capacitor-mlkit/barcode-scanning". The package may have incorrect main/module/exports specified in its package.json.

Here is the line I added to my package.json

"@capacitor-mlkit/barcode-scanning": "github:randy-johnson/capacitor-mlkit/#autofocus",

I'll look into this more tomorrow as it is getting rather late here.

@randy-johnson
Copy link

@robingenz, how much would it would it take to sponsor autofocus? I am some issues getting a quality scan and I think it is because of the speed of the scans and the focus? Grabbing scanner app of the app store I can scan a bar code accurate every time but I am not having the same results with this plugin. From what I read focusing before it started taking the scan would prevent the bad scans.

@robingenz
Copy link
Member

@randy-johnson Please take a look at After creating an issue.

@jacksonpietro
Copy link

Any updates on autofocus? I have a problem reading invoices from Brazil, and the reading difficulty seems to be related to the focus.

@randy-johnson
Copy link

We did not end up sponsoring this because it was only available on the Android side and we were having an issue on IOS as well. FWIW, we were able to use the Depracated version: https://github.com/capacitor-community/barcode-scanner and it suited our needs just fine. I am hoping in time the MLKit works better for us.

@jacksonpietro
Copy link

@randy-johnson Hey friend, thanks for the tip, I wouldn't have imagined that the deprecated version was working, and for me it also solves the problem. Thanks again for the tip. I also hope the current version provides this capability.

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

5 participants