Android Camera opens in landscape mode orientation for front camera in openCV\javaCV [closed]

asked 2013-10-05 00:28:28 -0600

bunta gravatar image

updated 2013-10-05 02:48:12 -0600

berak gravatar image

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.

image description

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>
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-11-05 14:19:09.249762

Comments

hi Bunta, did you solve your problem? would you please let me know? thank you. ciao

AFK gravatar imageAFK ( 2013-11-09 10:09:10 -0600 )edit

@AFK You need to change the orientation to 270 or 90 once the surface is created, then it will start working

bunta gravatar imagebunta ( 2013-11-12 08:10:45 -0600 )edit

thank you @bunta

AFK gravatar imageAFK ( 2013-11-13 15:58:24 -0600 )edit