Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Frame Size on OpenCV JavaCameraView

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!

like image 269
Christina Tsangouri Avatar asked Oct 31 '22 20:10

Christina Tsangouri


1 Answers

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.

like image 106
David Peer Avatar answered Nov 03 '22 00:11

David Peer