Setting VideoCapture resolution fails
Hi,
I'm trying to set VideoCapture resolution as follows, but it doesn't seem to do anything. The camera does support the requested format. I also tried different resolutions. No matter what I do, my VideoCapture is created with VGA resolution. Also, some other settings I'm trying to query do not seem to be supported.
VideoCapture *capture = new VideoCapture(0);
if( !capture->set( CAP_PROP_FRAME_WIDTH, 1920 ) || !capture->set( CAP_PROP_FRAME_HEIGHT, 1080 ) )
{
//not print - both set calls return 'true'
cerr << "setting resolution to full HD failed!" << std::endl;
}
double fps = capture->get( CAP_PROP_POS_FRAMES );
int width = capture->get( CAP_PROP_FRAME_WIDTH ); // returns 640
int height = capture->get( CAP_PROP_FRAME_HEIGHT ); // returns 480
int format = capture->get( CAP_PROP_FORMAT );
I remember those things never worked for me in the past, I'm wondering if this is implemented at all or if I'm making a mistake. OS: Windows 8.1, camera: MS LifeCam Studio, OpenCV: 3.1
Thanks, iko
it's very likely, that your camera-driver just does not support this resolution (or only for still-images)
It does support Full HD, I tried with AMCap, VLC, and also with my DirectShow code - no problems whatsoever. So you're saying, this works for you? I'm asking because I can't remember a single time I succeeded in doing this, also with other cameras, so I thought this is not properly supported in OpenCV, just as enumerating cameras. But I was still using the old C interface until recently, so I thought that's the reason.
I have had this problem also, as a workaround read the frames, then resize them.
Am I understanding you correctly that you suggest to capture 640x480 and then resize to Full HD?