saki4510t / UVCCamera

library and sample to access to UVC web camera on non-rooted Android device
2.99k stars 1.2k forks source link

Rotation on cameraview #213

Open mumtazcem opened 7 years ago

mumtazcem commented 7 years ago

Any idea about how can I rotate the view 180 degrees in usbcameratest7? I dont know exactly what should I do. I could rotate the matrix that I get from using getTransformMatrix(mtx) but I cant really load the matrix back to the SurfaceTexture.

Thanks in advance.

sappho192 commented 7 years ago

How about this code? in AndroidManifest.xml


<activity
            android:name=".LiveFeatureActivity"
            android:label="@string/title_activity_live_feature"
            android:screenOrientation="landscape">
``` ...
mumtazcem commented 7 years ago

I have a button that will rotate the view whenever I want, so I cant use this code in manifest

sappho192 commented 7 years ago

Then I think you need to transform each frame data. In general, the screen is rotated when the device rotates but if you want to rotate it manually then you need to do it in code level.

aviontechnology commented 7 years ago

@mumtazcem I can possible to rotate camera preview with usbcameratest8 sample I use below code <com.serenegiant.widget.UVCCameraTextureView android:id="@+id/camera_view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:background="@color/GRAY" android:scaleType="fitXY" android:layout_gravity="center" android:rotation="270" android:scaleY="-1" /> @sappho192 Now i am trying to rotate camera preview in sample usbcameratest0. Please provide some guide line what all i need to use.

miggymamba commented 6 years ago

@aviontechnology have you done this? anyone knows how to do this?

aviontechnology commented 6 years ago

@miggymamba you can try with android:rotation=" ? "property eg.android:rotation="270" try 90 ,180,270 or -90,-180,-270

and also try scaleY and scaleX combination it rotate in every angel now