Ask Your Question
0

How to take picture with CameraBridgeViewBase or change it resolution

asked 2014-06-15 19:39:50 -0600

Fisher gravatar image

Hello

I am using OpenCV4Android 2.4.9. My app is using camera via CameraBridgeViewBase object. For now I am taking picture by converting single camera frame Mat object to Bitmap and saving it on SD card. Output image is very small - 800x480. I have Nexus 4 which is capable of 1280x720 resolution. If I take picture with phone camera, resolution is even higher.

1) How can I set parameters to CameraBridgeViewBase object, so the preview size is higher resolution? 2) Is there any other right way of taking photos, maybe my method is wrong?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-07-08 05:21:31 -0600

itay gravatar image

1) Try to show the camera on full screen, I think that OpenCV use the best resolution to the surface size.

First use this code to see if 1280x720 is really suppoted:

List<Size> sizes = mOpenCvCameraView.getSupportedPreviewSizes();

Some of the devices support different resolution on recording mode and display mode(Like Galaxy s3 that support 720p in display mode and 1080p in recording video mode).

Second you can try using this code to set the minimum and maximum resolution:

 mOpenCvCameraView.setMinimumHeight(720);
 mOpenCvCameraView.setMinimumWidth(1280);
 mOpenCvCameraView.setMaxFrameSize(1280, 720);

2)I believe that if your device support 720p he will save the image as 720p.

Another option is to change matrix size before saving but then you get a bad image.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-06-15 19:39:50 -0600

Seen: 4,382 times

Last updated: Jul 08 '14