Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the method setMaxFrameSize of the class CameraBridgeViewBase exactly do in OpenCV Java?

I am currently using the method setMaxFrameSize of the class CameraBridgeViewBase in a android app for down-regulating the captured frame of my main camera. In my use case, I need a very low resolution, because a good performance is needed. I wondered if this method only regulates the output frame, but not the internal captured frame which is altered by different filters.

So my question is: Does this method immediately take the frame after capture and alter it so that the whole processing process is using the altered frame, or does it only alter the frame right before it is shown on the display?

Can you show me where I can find an answer to this matter, or where you found it?

Here is a minimal:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    javaCameraView =(JavaCameraView) findViewById(R.id.java_camera_view);
    javaCameraView.setMaxFrameSize(240, 180);
    javaCameraView.setVisibility(SurfaceView.VISIBLE);
    javaCameraView.enableFpsMeter();
    javaCameraView.setCvCameraViewListener(this);
}
like image 787
Pm740 Avatar asked Feb 28 '26 06:02

Pm740


1 Answers

setMaxFrameSize() is used to find the best preview frame resolution from the device-specific list (returned by Camera.getSupportedPreviewSizes()).

As an example - we set setMaxFrameSize(200,200) and we have 176x152 and 320x240 sizes. The preview frame will be selected with 176x152 size.

If your size is too small, JavaCameraView will try to setPreviewSize(0, 0) and on most devices it will fail.

like image 75
Alex Cohn Avatar answered Mar 02 '26 21:03

Alex Cohn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!