3

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);
}
5
  • 1
    Welcome! Please include a minimal, complete, and verifiable example with your question. Cheers! Commented Dec 17, 2017 at 20:11
  • If you need good performance in your app - opencv camera is not what you should be using.
    – Dmitrii Z.
    Commented Dec 17, 2017 at 22:43
  • @DmitriiZ. What would you use instead?
    – Pm740
    Commented Dec 18, 2017 at 21:34
  • @RichChurcher Thank you! :) Like this?
    – Pm740
    Commented Dec 18, 2017 at 21:35
  • @Pm740 native android camera + GLES to render frame.
    – Dmitrii Z.
    Commented Dec 18, 2017 at 21:36

1 Answer 1

1

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.

3
  • So the preview resolution is the resolition which is shown on display, but not the one which i am working on bevor display the processed image?
    – Pm740
    Commented Dec 18, 2017 at 21:38
  • 1
    No, it's exactly the resolution you get from the camera. You don't get a pixel more (or less). For display, the picture may be scaled up or down to fit the 'window'. But your onCameraFrame() callback gets inputFrame whose width and height are not allowed to exceed the MaxFrameSize you have chosen (width - 240, height - 180).
    – Alex Cohn
    Commented Dec 18, 2017 at 23:38
  • Then a 180p preview frame should have a better perfromance than a 720p one, right?
    – Pm740
    Commented Feb 10, 2018 at 16:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.