views:

58

answers:

1

I have been searching around and can't find an example of how to get and set the camera capturing settings. For example the capturing resolution, fps, color balance, etc. I have only seen examples of how to change the settings when saving the captured video but I want to be able to find all the camera's capturing modes and choose which one I want. For example, I am using the PS3eye webcam and in the test program it allows you to change the settings (320x240 at 15,30,60,120 fps, 640x480 at 15,30,60,75 fps). So is there a function in OpenCV for getting all the camera's capture modes and choosing one? I remember in OpenFrameworks there was a function to change these settings but I would like to know how to do it in OpenCV.

Here is the code for OpenFrameworks with OpenCV that does sort of what I want:

vidGrabber.setDeviceID( 4 );
vidGrabber.setDesiredFrameRate( 30 ); //I want this
vidGrabber.videoSettings();
vidGrabber.setVerbose(true);
vidGrabber.initGrabber(320,240); //And this
A: 
cvSetCaptureProperty()

with these flags:

CV_CAP_PROP_FRAME_WIDTH  - width of frames in the video stream (only for cameras)
CV_CAP_PROP_FRAME_HEIGHT - height of frames in the video stream (only for cameras)
CV_CAP_PROP_FPS          - frame rate (only for cameras)
Adi
Changing the resolution works but I can't find any evidence of the fps changing. This is correct? CvCapture *capture; capture = cvCreateCameraCapture(5); cvSetCaptureProperty(capture,CV_CAP_PROP_FPS,15);
jhaip
Yes that should be fine. Does your camera supports 15FPS? If so, how do you make sure FPS isn't changed? There is also cvGetCaptureProperty() function which you could use to see if FPS is changed.
Adi
I was seeing if there was a change by measuring the calculation time needed to query the frame, but it did not change. Am I correct that by increasing the fps the delay time for cvQueryFrame() should decrease? Also visually there is no difference when I set it to different speeds, and I am sure the camera can run at these because the test app that comes with it has those settings. I also tried cvGetCapturePropety() in different places and I always get 0, even right after I set it to 30. Is this correct to print the fps?printf("%d\n",(int)cvGetCaptureProperty(capture,CV_CAP_PROP_FPS));
jhaip