1

With the Microsoft LifeCam Cinema (on Ubuntu) in guvcview I get 30fps on 1280x720. In my OpenCV program, I only get 10fps (only queryframe and showimage, no image processing is done). I found out that it is a problem in gstreamer. A solution is to set a capsfilter in gstreamer, in terminal I can do it like this:

gst-launch v4l2src device=/dev/video0 !
'video/x-raw-yuv,width=1280,height=720,framerate=30/1' ! xvimagesink

This works! The question is:

  1. How do I implement this in my c++/OpenCV program?
  2. Or is it possible to set gstreamer to always use this capsfilter?

I already found this question Option 3, but I can't get it working with a webcam.

Community
  • 1
  • 1
NeViXa
  • 73
  • 7

2 Answers2

1

Unfortunately, there is no way to set the format (YUV) of the frames retrieved from the camera, but for the rest of the settings you could try using cvSetCaptureProperty():

cvSetCaptureProperty(capture, CV_CAP_PROP_FPS, 30);
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, 1280);
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, 720);

If setting the frame size doesn't work, I strongly suggest you read this post: Increasing camera capture resolution in OpenCV

Community
  • 1
  • 1
karlphillip
  • 92,053
  • 36
  • 243
  • 426
  • Thank you, but CV_CAP_PROP_FPS is a non working function in OpenCV. Also it isn't an OpenCV problem, it is a gstreamer problem (see bug report) – NeViXa May 18 '12 at 13:37
  • 1
    If the above doesn't work you are out of luck. You won't be able to set the pipeline configs through OpenCV. – karlphillip May 18 '12 at 13:46
1

My bad, I was setting my webcam to 1280x800, which forces it to use YUVY with max 10 fps. Setting it back to 1280x720 in my program gave me 30 fps

NeViXa
  • 73
  • 7