VideoCapture properties not being set in Opencv c++

asked 2020-07-30 20:50:43 -0500

Rishi Shah gravatar image

updated 2020-07-30 21:35:00 -0500

Hello All,

I have been trying to set my camera resolution to lower than the default resolution of the camera. For that, I have written following code after the video capture object initialization,

videoStream.set(cv::CAP_PROP_FRAME_WIDTH, frameWidth); videoStream.set(cv::CAP_PROP_FRAME_HEIGHT, frameHeight);

Initially, I was getting error compiling this piece of code but after some online surfing I could figure out the solution. However, even after successful compilation when I am printing the pixel resolution of the frame that is being read from the web camera it is showing the default resolution of the camera only. The camera resolution is 3840X2160 and I am trying to reduce it to 640X480.

When the same logic is implemented with OpenCV python it worked well.

Your thoughts and inputs will be appreciated.

edit retag flag offensive close merge delete