OpenCV 2.4.3 on Android. Work with CameraBridgeViewBase

asked 2012-11-07 07:18:03 -0500

FreeVMS gravatar image

updated 2012-11-07 07:18:35 -0500

Hello! Can you tell me please how can I make the camera turning in portrait orientation running example face detection. In the 2.4.3 RC appeared the following: New Java samples framework. Samples are significantly refactored, we recommend you to look into the new architecture, because it resolves some issues of the old framework. New framework provides unified base for CV application including any of Java or Native cameras, custom view layout, easy Manager-based OpenCV initialization, proper application event handling: pause, resume, rotation, etc.

There is no description how to make camera turning in the specification of the CameraBridgeViewBase on the web site. I tried this:

public Mat onCameraFrame(Mat inputFrame) {

Imgproc.cvtColor(mRgba, mGray, Imgproc.COLOR_RGBA2GRAY);
if ((getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)
&& (mGray != null) && (mRgba != null)) {

Core.transpose(mGray, tmp_grey);
Core.flip(tmp_grey, mGray, 0);


The results are – mgray turns (I can see it in the rendering). The same operation using mRgba gives black screen and there is no error. I used Asus Nexus 7

I tried VideoCapture in OpenCV 2.4.2, no results.

edit retag flag offensive close merge delete