Android Camera opens in landscape mode orientation for front camera in openCV\javaCV [closed]
I made an app for opening a front camera in my android phone. The problem is it always opens the camera but the image shown is in landscape mode only.
So irrespective of I am holding the phone right direction , I am getting 90 degree of orientation difference.
How to sort out this problem. Layout-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:opencv="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".AppLockMainActivity" >
<!-- <ImageView
android:id="@+id/myImageView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/bol" />-->
<org.opencv.android.NativeCameraView
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:visibility="visible"
android:id="@+id/nativeCamera"
opencv:show_fps="false"
opencv:camera_id="front" />
Application.xml
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<activity
android:name="com.example.applock.AppLockMainActivity"
android:screenOrientation="portrait"
android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
hi Bunta, did you solve your problem? would you please let me know? thank you. ciao
@AFK You need to change the orientation to 270 or 90 once the surface is created, then it will start working
thank you @bunta