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

Orientation #13

Closed
Noitidart opened this issue Aug 26, 2021 · 4 comments
Closed

Orientation #13

Noitidart opened this issue Aug 26, 2021 · 4 comments

Comments

@Noitidart
Copy link

In iOS I'm having issue that if I don't take the photo in landscape it won't read the text.

And on Android I'm having issue of it only working in portrait mode.

Is this an expected thing? Is there a way to hint orientation so I don't have to rotate photo?

@agoldis
Copy link
Owner

agoldis commented Aug 27, 2021

You'd rotate the image before processing with MLKit. Reference: https://developers.google.com/ml-kit/vision/text-recognition/android

@agoldis agoldis closed this as completed Aug 27, 2021
@Noitidart
Copy link
Author

Thanks, I'm not sure how to determine the rotation though. So what I'm doing right now is rotating it 4 times and running OCR 4 times. Then I present to the user to pick which one is closest. :(

@mlcal
Copy link

mlcal commented Sep 2, 2022

@Noitidart Can you tell me how you rotate image before OCR ?

@Noitidart
Copy link
Author

@mlcal I use Expo so I used their ImageManipulator class - https://docs.expo.dev/versions/latest/sdk/imagemanipulator/#imagemanipulatormanipulateasyncuri-actions-saveoptions

  Promise.all([
      ImageManipulator.manipulateAsync(photoResponse.uri, [{ rotate: 90 }]),
      ImageManipulator.manipulateAsync(photoResponse.uri, [{ rotate: -90 }]),
      ImageManipulator.manipulateAsync(photoResponse.uri, [{ rotate: 180 }])
  ])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants