The OpenCV Library forces me to define android:screenOrientation="landscape"
in my AndroidManifest
in order to display the camera in full screen.
I want to detect certain objects in my android app (object recognition of basic forms). The Problem is that in order to detect objects the Frame from the camera is analyzed - no matter in what orientation the Phone is - in landscape.
So when you have you phone in portrait mode in your hand the image recognition algorithm won't detect any objects, because it only analyzes the frame in landscape mode.
I would like to display a Toast when the user has the phone in portrait mode so that he knows that the image recognition only works in landscape. But the classic ways to get the screen orientation (e.g. with getResources().getConfiguration().orientation
) won't work because the orientation is fixed to landscape in the Manifest (so the result is always ORIENTATION_LANDSCAPE
)
Are there any other ways to get the physical orientation of the Phone (even if the Activity's orientation is fixed) ?