mrousavy / react-native-vision-camera

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

💭 V3 is not reading Data-Matrix codes with black background on Android. #3174

Closed KarimovAbdullo closed 1 month ago

KarimovAbdullo commented 1 month ago

Question

I have a project related to scanning codes. The issue is that when I scan Data-Matrix codes on a black background, the scanner cannot detect them, but everything works fine on iOS. not detecting these codes (android)

0-0-0-

0000000000000

detecting these codes 33333333

What I tried

const ScannerCamera = forwardRef<ScannerAnimationRefI, ScannerCameraProps>( (props, animationRef) => { const device = useCameraDevice('back', { physicalDevices: ['wide-angle-camera'], });

const {hasPermission, requestPermission} = useCameraPermission();

useEffect(() => {
  if (!hasPermission) {
    requestPermission();
  }
}, [hasPermission, requestPermission]);

const [torch, setTorch] = useState<'on' | 'off'>('off');

return (
  <View style={styles.scannerContainer}>
    <View style={styles.scanner}>
      {device && hasPermission ? (
        <Camera
          {...props}
          torch={torch}
          device={device}
          style={StyleSheet.absoluteFillObject}
        />
      ) : null}
      <ScanerAnimation ref={animationRef} />
    </View>
    {hasPermission ? null : <CText RED>Нет разрешения на камеру</CText>}
    <CButton
      onPress={() => setTorch(prev => (prev === 'on' ? 'off' : 'on'))}
      outline>
      {torch === 'on' ? 'Выключить фонарик' : 'Включить фонарик'}
    </CButton>

  </View>
);

}, ); export default ScannerCamera;

///////////// const codeScanner = useCodeScanner({ codeTypes: ['qr', 'ean-13', 'ean-8', 'data-matrix'], onCodeScanned, });

<ScannerCamera ref={animationRef} codeScanner={codeScanner} isActive={true} />

VisionCamera Version

react-native-vision-camera:3.4.6 react-native : 0.71.1

Additional information

maintenance-hans[bot] commented 1 month ago

Guten Tag, Hans here! 🍻 Thank you for your report. It seems like you are experiencing issues scanning Data-Matrix codes on a black background only on Android.

To assist you better, mrousavy will need some additional information. Please provide logs related to this issue. You can gather them by using adb logcat in your command line while reproducing the issue with your app open. That will help us understand what’s going wrong.

Also, if you have a moment, consider sponsoring the project to help us keep up with support and improvements: Become a Sponsor.

Looking forward to your response!

Note: If you think I made a mistake, please ping @mrousavy to take a look.

KarimovAbdullo commented 1 month ago

@mrousavy

mrousavy commented 1 month ago

Listen - the purpose of the bot is not to just ping me when you need quick help.

It told you to update logs, add more info to this, and technically you even created the wrong template - this is a bug not a question.

xulihang commented 1 month ago

You can use Dynamsoft Barcode Reader to read the inverted DPM code.

Online demo: https://demo.dynamsoft.com/barcode-reader/

Vision Camera Plugin: https://github.com/tony-xlh/vision-camera-dynamsoft-barcode-reader/