Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 728
F1sher Avatar asked Jul 25 '13 21:07

F1sher


1 Answers

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.

like image 127
flankechen Avatar answered Sep 21 '22 01:09

flankechen