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

🐛 Camera orientation not working to barcode #3321

Open
3 of 5 tasks
Ferreiraguihh opened this issue Dec 5, 2024 · 4 comments
Open
3 of 5 tasks

🐛 Camera orientation not working to barcode #3321

Ferreiraguihh opened this issue Dec 5, 2024 · 4 comments
Labels
🐛 bug Something isn't working

Comments

@Ferreiraguihh
Copy link

What's happening?

Basically, I'm using a device like a tablet, and I can't change the orientation of the component, I'm trying to use barcode, I know that in the 'react-native-camera' library, if I implement a rotate -90deg it works.
image

Reproduceable Code

const { onCodeScanned } = props;
  const device = useCameraDevice('back');
  const cameraRef = useRef<Camera>(null);

  const codeScanner = useCodeScanner({
    codeTypes: ['ean-13', 'upc-a'],
    onCodeScanned,
  });

  if (!device) {
    return null;
  }

<View>
<Camera
          ref={cameraRef}
          device={device}
          style={StyleSheet.absoluteFill}
          isActive={true}
          codeScanner={codeScanner}
          resizeMode="cover"
        />
</View>

Relevant log output

.

Camera Device

Device: 'Back'

Device

Tablet Pixel Android 12.0

VisionCamera Version

4.6.3

Can you reproduce this issue in the VisionCamera Example app?

I didn't try (⚠️ your issue might get ignored & closed if you don't try this)

Additional information

@Ferreiraguihh Ferreiraguihh added the 🐛 bug Something isn't working label Dec 5, 2024
Copy link

Guten Tag, Hans here! 🍻

It sounds like you are having trouble with camera orientation for barcode scanning. However, I noticed you did not include any relevant log output, which is important for diagnosing the issue.

Please provide logs from adb logcat when you run your app. This will help mrousavy to better understand what’s going wrong. Also, make sure to double-check that you tested this in the VisionCamera Example app, as mentioned.

If you continue to have troubles, feel free to update this issue with the necessary details! Thank you for your understanding, and don’t forget to support the project by sponsoring if you find it helpful!

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

@gyanbhartip
Copy link

@Ferreiraguihh my apologies for going off-topic but could you please give me a brief idea about how do you implement the scanning within the square reticle's bounds. It used to work in RNVC 2 for me but in 4.6.3, I get different frame sizes and unable to implement the same.

@jrizmal
Copy link

jrizmal commented Jan 16, 2025

Hi @gyanbhartip did you manage to figure this out?
In my case, I'm using the frame parameter in onCodeScanned to figure out the scanning area, but it always returns landscape dimensions even though I'm previewing in portrait mode. I'd expect frame would always be the same as the preview size.

@gyanbhartip
Copy link

gyanbhartip commented Jan 16, 2025

@jrizmal I've not been able to figure the "scanning within the reticle bounds" issue.
But the frame orientation is not the same as your preview orientation.
refer: the official docs on the Frame orientaion

Also for me the frame dimensions is restricted to 640x480 while the sensor format reports a rotation of landscape-left.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants