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

[QUESTION]: text in wrong direction #13

Open
Valentin-Rault opened this issue Jun 26, 2024 · 7 comments
Open

[QUESTION]: text in wrong direction #13

Valentin-Rault opened this issue Jun 26, 2024 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@Valentin-Rault
Copy link

After upgrading to latest version of react native, react native vision camera and this library, the frame is now in a wrong orientation. The frame orientation is set to portrait but is actually in landscape-right. This results in needing to orientate the text to the right in order to be able to scan. A quick fix I tried is to set visionImage.orientation = .right instead of .up, now the text is scanned properly when held upright in front of the camera.

I realise that this issue is also coming from react native vision camera but shouldn't this library be able to handle different frame orientation?

Version:
react native: 0.74.2
react native vision camera: 4.3.2
vision camera ocr: 3.0.1

@ismaelsousa
Copy link
Owner

yeah, I saw that vision now supports the orientation. But I didn't have time to play around with it and see the changes in there.
if you have a time, could you implement a proposal and create a PR for it? @Valentin-Rault

@ismaelsousa ismaelsousa self-assigned this Jun 26, 2024
@ismaelsousa ismaelsousa added the bug Something isn't working label Jun 26, 2024
@Valentin-Rault
Copy link
Author

I will definitely take a look at it and play with it a bit

@Valentin-Rault
Copy link
Author

Little update here, as of react native vision camera v.4.4.0 the frame is back to the correct orientation of landscape-right. I am still having some issues with scanning though. Do you have the possibility to test @ismaelsousa? So I can see if it is an issue from the rest of my code.
In the meantime I am starting to look into a way to support the orientation to not have this issue again in the future

@ismaelsousa
Copy link
Owner

hmmm, maybe your error is around this, isn’t ?

image

Because if you are trying to draw it and it's appearing in a mess way the frame can give you the rotation but the output of ML kit is rotated to that format. Try to update the native side with this properties and let me know the result :)

link to docs: https://developer.android.com/reference/androidx/camera/core/ImageAnalysis.Builder#setOutputImageRotationEnabled(boolean)

@Valentin-Rault
Copy link
Author

@ismaelsousa I have made a PR with a proposal to rectify this behaviour for ios

@alamothe
Copy link

Hello, the author of react-native-vision-camera has described how to fix the issue here: mrousavy/react-native-vision-camera#3051

It seems to be one line of code.

Can you please fix this ASAP?

@alamothe
Copy link

#16

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