increase resolution for camera in opencv

116 Views Asked by At

I have a device which is of 13MP camera, my default camera resolution is 1280x720, as a 13MP camera can give more higher resolutions than 1280x720 I want to increase it than my default value?

I have tried to check if my device supports larger resolutions with chameraCharacteristics, SCALER_STREAM_CONFIGURATION_MAP and i got output as: 4224x3136,4096x3072, 1920x1088, 4096x3072, 1920x1088, 1920x1080,1280x720, 720x480,640x480,352x288,320x240,176x144 and the view size of my device is 1280x800, most of the articles, and posts say that opencv restricts the camera resolution upto the viewSize? can someone please help on how i can override this and increase the resolution of my camera?

Thanks.

1

There are 1 best solutions below

8
Greenylie On

After opening the camera, you should be able to edit the properties at your liking with the set method of VideoCapture:

VideoCapture camera = new VideoCapture(0); //0 is there to avoid camera.open(0)

boolean setWidth = camera.set(3, 4096); //CAP_PROP_FRAME_WIDTH = 3
boolean setHeigth = camera.set(4, 3072); //CAP_PROP_FRAME_HEIGHT = 4

As stated in the linked page the set method returns

true if the property is supported by backend used by the VideoCapture instance. Note: Even if it returns true this doesn't ensure that the property value has been accepted by the capture device.

You can find the flags/ids for all the properties in org.opencv.videoio.Videoio