Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

After working around this problem, it seems that the opencv camera cannot be viewed in portrait mode. The problem is solved by adding: android:screenOrientation="landscape" inside AndroidManifest.xml inside activity section. In addition, here is the onCreate(): super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    setContentView(R.layout.activity_main);
    mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.opencv_camera);
    mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE);
    mOpenCvCameraView.setCvCameraViewListener(this);

Notice where the setContentView is added. Finally, Note that my main activity extended the Activity class and the in the menifest file I added: android:theme="@android:style/Theme.NoTitleBar.Fullscreen" under the application section.