Ask Your Question

How to Change the videocapture property in opencv c++?

asked 2020-07-24 09:33:37 -0500

Rishi Shah gravatar image

I have been trying to set the camera reading pixel size to different than what by default camera resolution is. However, I am not able to set the pixel size using

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

Can someone help me out with the reasons for this?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2020-07-24 10:08:18 -0500

berak gravatar image

sadly, none of the VideoCapture::set() or get() settings are guaranteed to work, it depends on your hardware, drivers, os, opencv video backend even.

most webcams only support certain sizes, e.g. multiples of vga or pal resolution, not arbitrary numbers.

in any case, please check the return value from videoStream.set() for failure.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2020-07-24 09:33:37 -0500

Seen: 246 times

Last updated: Jul 24 '20