5

I'm creating an application on Android that is using OpenCV's JavaCameraView. I'm trying to change the returned frame size but changing the frame still returns frames at 320X240.

@Override
public void onCameraViewStarted(int width, int height) {
    mRgba = new Mat(480, 640, CvType.CV_8UC4);
    mGray = new Mat(480, 640, CvType.CV_8UC4);
}


@Override
public Mat onCameraFrame(Mat inputFrame) {
    inputFrame.copyTo(mRgba);

    Imgproc.cvtColor(mRgba, mGray, Imgproc.COLOR_RGBA2GRAY);

    // Processing

    return mRgba;
}

Any help on how to change the returned frame size would be greatly appreciated!

1 Answer 1

2

You could change the max frame size of your JavaCameraView with setMaxFrameSize.

When selecting size - the biggest size which less or equal the size set will be selected. As an example - we set setMaxFrameSize(200,200) and we have 176x152 and 320x240 sizes. The preview frame will be selected with 176x152 size.

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