Setting frame size of QuickCam Pro 3000 with OpenCV?

六月ゝ 毕业季﹏ 提交于 2019-12-31 02:13:11

问题


I'm using OpenCV 2.4.6 to grab images with my old Logitech QuickCam Pro 3000 webcam. Using VideoCapture::set( CV_CAP_PROP_FRAME_WIDTH, ... ) I'm not able to set the value of the width (idem for the height). set(...) always returns false.

Is it normal?

P.S. I'm on Linux (kubuntu) and it seems to use V4L.


回答1:


It seems that your camera was not initialized properly. The following code works for me.

using namespace cv;

[...]

VideoCapture capture(0);
capture.set(CV_CAP_PROP_FRAME_WIDTH, width);
capture.set(CV_CAP_PROP_FRAME_HEIGHT, height);

I experimented with it a bit and found the following issues:

  1. capture.set returns 0 if capture was not initialized.
  2. capture.set returns 0 if camera is busy (another process using it).

It is not guaranteed that calling VideoCapture::set will change camera resolution to your desired resolution. For example, with my Logitech HD Pro Webcam C290, setting resolution to 640x480 and 1920x1080 works. But when I try 1024x768, VideoCapture::set returns true, but actual resolution is set to 960x720. So, check the actual resolution after reading a frame.



来源:https://stackoverflow.com/questions/20086967/setting-frame-size-of-quickcam-pro-3000-with-opencv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!