Android + OpenCV: How to set camera resolution when using CameraBridgeViewBase

android, opencv, resolution

Solution

try `mOpenCvCameraView.setMaxFrameSize(width, height);`

in the `OnCreate()` after `mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.tutorial2_activity_surface_view);`

I try and success in 2.4.6 tutorial 2.

BTW, check your phone camera supporting resolutions first.

Problem

Hello I am using OpenCV4Android face detection sample. I would like to know how can I get my resolution of camera and set it to other value. In this example CameraBridgeViewBase. I see that on object ``` private CameraBridgeViewBase mOpenCvCameraView; ``` I can use ``` mOpenCvCameraView.setLayoutParams(); ``` but every time I try to use it in some way I'm doing it wrong and my program crashes. Please help me with that problem.

Original source