OpenCV for Android is an awesome library that allows you to do a lot of cool stuff with your images.
|OpenCV for Android|
A common problem that many users of OpenCV4Android face is that JavaCameraView or the CameraBridgeViewBase doesn’t show full screen camera preview. It is a frustating issue for many newbie developers that are truing to use OpenCV with Android. This post describes how uou can fix camera orientation and show OpenCV JavaCameraView or CameraBridgeVIewBase preview in full screen.
How to display full screen image preview when using OpenCV for Android –
|Default Camera orientation|
I fooled around with all types of code to get a landscape full screen image preview, and it turns out doing it pretty simple, infact it doesn’t even require any OpenCV code.
Here’s how you get a fullscreen Image preview when using OpenCV for Android –
1. Change the orientation of the activity which contains JavaCameraView or CameraBridgeViewBase to Landscape.
<activity android:name=".MainActivity" android:screenOrientation="landscape">
2. Go to your activity that displays either JavaCameraView or CameraBridgeViewBase and set the fullscreen mode on. You can do that using –
And Viola, that’s it! We have successfully turned the Orientation of the camera preview from OpenCV4Android. If you still have problems, fill free to contact me on my email or just comment below. Happy Coding.
You can learn more about setting camera resolution using openCV here, or About setting flash on/off here or focus modes using openCV for Android here.