cap.set property is not working in C++
While cap.get property is working, I used cap.set property in a simple code but it doesn't seem to be working:
cap.set(CV_CAP_PROP_FPS, 60);
cap.set(CV_CAP_PROP_FRAME_HEIGHT, 360.0);
for(;;)
{
cap >> frame;
if( frame.empty() ) break; // end of video stream
imshow("Display Window",frame);
if( waitKey(1) == 27 ) break; // stop capturing by pressing ESC
}
waitKey();
return 0;
Any ideas, am I missing something here?
Thanks.
What does it mean "doesn't seem to be working"? What is cap?
What OS are you using? A possible solution on Linux would be to install the libv4l-dev (video for linux development) package and rebuild OpenCV.
@LBerger it does not work, I mean it doesn't change, the "set" property doesn't change anything. "cap" is Videocapture class variable.
@kbarni, I am using ubuntu 14.04. libv4l-dev is already installed.
When you open cap is it a camera or a video file?
@LBerger it is camera.
@Cemow Maybe your camera doesn't support 60 fps, or that the frame height must be set before the fps. I know for sure that, in opencv code, frame width/height and fps are set in a special order. Maybe by swapping both lines it would work.
Also, did you check that your camera supports 60 fps ? You could verify it by installing v4l2-ctl and then doing v4l2-ctl -d /dev/video0 --list-formats-ext (change /dev/video0 by your camera of course). It lists all the available size and their framerate !
What does it mean 60fps? If your camera have got some automatic adjustement you can have time exposure 0.02s so it's impossible to have 60fps. many camera works like a digital lens reflex camera : speed priority aperture priority or automatic. If you have camera like this one manual adjustement is possible...