mrousavy / react-native-vision-camera

📸 A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
7.44k stars 1.09k forks source link

❓ Is there anyway to limit the camera recognition area #820

Closed fe-noob closed 2 years ago

fe-noob commented 2 years ago

Question

Hi,

I use react-native-vision-camera and vision-camera-code-scanner to scan qrcode.

But i can't find any options to limit the scan area, i don't want the whole area can recognize the code.

There are some solutions for react-native-camera, most of them are to modify iOS/Android code.

Look forward to your reply.

What I tried

No response

VisionCamera Version

2.12.0

Additional information

mrousavy commented 2 years ago

Hi!

You can shoot a PR to vision-camera-code-scanner to implement this feature.

xulihang commented 2 years ago

I use react-native-svg to draw the scan region and pass the region info to vision-camera-dynamsoft-barcode-reader. Since the plugin supports limiting the area, I just pass the left, right, top, bottom info to it. (Check out the blog for details)

If the barcode reader doesn't support this, we may need to crop the image by ourselves.