native-opencv-android-template
native-opencv-android-template copied to clipboard
Incorrect orientation
On my pixel 4 the image is 90 degrees off when the phone is used in portrait mode. It works just fine in landscape mode.
On my pixel 4 the image is 90 degrees off when the phone is used in portrait mode. It works just fine in landscape mode.
It is 90 off on samsung note8 as well.
As far as I have researched, this is an ongoing "feature" of OpenCV Android SDK; specifically of JavaCameraView
control. There are a bunch of workarounds (using the app in landscape or rotating the image), none being perfect (landscape use only, degraded performance, etc.). That's little bit disappointing actually :/
Edit: For further notes, see stackoverflow question 14816166 and the following links:
answers.opencv.org/question/95248/changing-opencv-camera-view-orientation-on-androi/ answers.opencv.org/question/7313/rotating-android-camera-to-portrait/ answers.opencv.org/question/7143/mirror-image-on-android-front-camera/
Thanks for sharing this. The template wad indeed intended to be used in landscape mode: I didn't try to make it work in portrait mode. If you find a easy/elegant solution to solve this, do not hesitate to open a pull request on this repository, new contributors are always welcome !
Thanks for those links. I am still somewhat surprised that there is not a good way to make it work regardless of orientation.
I tried for a while to make all orientations work but then I decided my time is better spend build some cool stuff instead of figuring out all those android orientations and making them work smoothly. I wanted mine to be mainly used in portrait mode, so I ended up using this the portrait mode presented here, and then fixing the orientation to portrait mode, not allowing landscape mode. https://github.com/d3alek/sensible-opencv/tree/master/app/src/main/java/eu/otselo/sensibleopencv
At least for me this was the best of both worlds. I like this project better and I get a better framerate then when just using the sensibleopencv code, so I just copied the camera code.