Closed nobodyzzz01 closed 10 months ago
I use react-native-svg to draw the overlay and pass a scan region argument to the frame processor to crop the image before processing. You can find an example here: https://github.com/tony-xlh/react-native-mrz-scanner/blob/main/src/screens/Scanner.tsx
I tried using regionOfInterest with coordinates taken from frame but it seems regionOfInterest doesn't work
@xulihang @mrousavy After investigating the Android codebase, I couldn't find any part where you handle the regionOfInterest
for the CodeScanner
I documented this wrong - regionOfInterest
in the built-in CodeScanner only works on iOS. On Android, this is not available. https://github.com/mrousavy/react-native-vision-camera/commit/9ecc09cfe46033aca410891e51058e82ee081b1f
If you want this behaviour on Android, use Frame Processors instead with a custom Frame Processor Plugin for QR code scanning, then crop the Frame before using some Frame Processor Plugin to resize/crop it.
Btw., if you use Frame Processors and need to resize the Frame, I just now released vision-camera-resize-plugin - a plugin to resize Frames to any size and convert them to any RGB layout (RGB, BGR, ARGB, BGRA, ...)! 🥳
Btw., if you use Frame Processors and need to resize the Frame, I just now released vision-camera-resize-plugin - a plugin to resize Frames to any size and convert them to any RGB layout (RGB, BGR, ARGB, BGRA, ...)! 🥳
Which is type of resized? is it frame?
Question
React native Version: 0.72.7
What I tried
I tried using frame processor but it didn't work And I tried to calculate the coordinates of the frame to receive the correct QR code but failed!!!
const codeScanner = useCodeScanner({ codeTypes: ['qr', 'ean-13'], onCodeScanned: (codes: Code[]) => { const pxDiff = Math.max(PixelRatio.get() - 1, 1);
});
<ReanimatedCamera style={[StyleSheet.absoluteFill]} device={device} onError={onError} isActive={isActive} format={format} fps={fps} zoom={0} codeScanner={codeScanner} exposure={0} />
VisionCamera Version
3.6.8
Additional information