Search code examples
opencvcameraresolution

Opencv Camera megapixels Android


i am new with Opencv.I use JavaCameraView, which uses 1280x 720 camera resolution. How can I increase the resolution to 5 megapixels? Please help me :)


Solution

  • You need to pick a resolution that is allowed by your camera. Call the following code in your onCameraViewStarted function and set listNum so that it corresponds to the resolution you desire:

    Parameters params = mCamera.getParameters();
    List<Size> resList = mCamera.getParameters().getSupportedPictureSizes();
    int listNum = 1;// 0 is the maximum resolution
    int width = resList.get(listNum).width;
    int height = resList.get(listNum).height;
    params.setPictureSize(width, height);
    mCamera.setParameters(params);
    

    mCamera is your org.opencv.android.JavaCameraView object.

    Brian