0

I'm using OpenCV 2.4.6 with both C++ and Python on Kubuntu 12.04. With a Logitech Quick Cam Pro 3000 webcam, I succeed to set the frame size but VideoCapture::set() always returns false.

// C++
VideoCapture lCap( 0 );

cout << lCap.get( CV_CAP_PROP_FRAME_WIDTH ) << endl;
cout << lCap.get( CV_CAP_PROP_FRAME_HEIGHT ) << endl;
cout << boolalpha << lCap.set( CV_CAP_PROP_FRAME_WIDTH, 320 ) << endl;
cout << boolalpha << lCap.set( CV_CAP_PROP_FRAME_HEIGHT, 240 ) << endl;
cout << lCap.get( CV_CAP_PROP_FRAME_WIDTH ) << endl;
cout << lCap.get( CV_CAP_PROP_FRAME_HEIGHT ) << endl;

gives:

640
480
false
false
320
240

and

# Python 2.7
Cap = cv2.VideoCapture( 0 )
print( Cap.get( CV_CAP_PROP_FRAME_WIDTH ) )
print( Cap.get( CV_CAP_PROP_FRAME_HEIGHT ) )
print( Cap.set( CV_CAP_PROP_FRAME_WIDTH, 320 ) )
print( Cap.set( CV_CAP_PROP_FRAME_HEIGHT, 240 ) )
print( Cap.get( CV_CAP_PROP_FRAME_WIDTH ) )
print( Cap.get( CV_CAP_PROP_FRAME_HEIGHT ) )

also gives the same thing.

So I want to know if this behaviour is normal (either OpenCV or the libs V4L, V4L2??? or my webcam). If so, I can always check my attempt by doing a get() after a set(). But if something is wrong, I would like to know it.

See the doc: Doc for VideoCapture::set(), OpenCV 2.4.6

Thanks!

dom_beau
  • 2,437
  • 3
  • 30
  • 59

1 Answers1

1

I tried the same on my Logitech c270 webcam and it worked correctly and also returned true. I'm guessing the problem is the fault of the webcam driver.

Try installing the official Logitech drivers, if you haven't done that already (I noticed for my webcam that installing the official drivers also makes capturing in OpenCV about 10x faster).

littleimp
  • 1,159
  • 9
  • 13
  • Thanks for the suggestion, I'll do that as soon as possible. – dom_beau Nov 22 '13 at 16:24
  • Well, actually, it seems that with Linux kernel 3+ I have the good driver. I'll probably buy a new WebCam and keep my old QCPro3000 for testing. – dom_beau Nov 26 '13 at 02:33