Wrong camera orientation preview
hariangr opened this issue · comments
@hariangr Can you share the following information
- which version of OpenCV are you using?
- Does it work fine on another version of OpenCV?
- Did you try any other examples
As far as I know, this is the correct behaviour (as the 0,0 of OpenCV and the screen are at 90 degrees to each other)
I am using com.quickbirdstudios:opencv-contrib:4.5.3.0, I haven't really tried in any other version, the code for displaying in all example is the same (CvCameraViewListener2.onCameraFrame) I would assume they all behave the same
And yes, it does seems like that's the default behavior, I watch some youtube videos and the camera is also rotated 90 degree
I saw some solution that include changing the Java code of the opencv library (Not entirely sure)
It seems like a common thing to wanna have the camera orientation the same as the display orientation, that's why I feel weird not finding easy solution for this
Thanks for the response btw
If I remember correctly, we also sometimes used to rotate by 90 degrees but then we changed our algorithm to work with OpenCV's orientation as most of the other image processing operations were also performed in OpenCV.
Any chance you can provide some hint on how to do this properly since I can't edit the source when using this library
I'm new to native android development, thank you for understanding
You can use OpenCV's functions to rotate the image
You can use one of these
rotate
imutils.rotate
imutils.rotate_bound
Please note that when using the rotate
methods, parts of the image could be cut off. rotate_bound
basically rotates the whole plane of the image.