4

I have a little wee of a problem developing one of my programs in C++ (Visual studio) - Right now im struggling with connection of multiple webcams (connected via usb cables), creating for each of them separate thread to capture frames, and separate frame for processing image.

I use OpenCV to process frames, but the problem is that i dont get a peak of webcam possibilities (it supports 25 fps, i get only 18) is there some library that i could use to get frames, than process them with OpenCV that would made frames be captured faster?

I was researching a bit and the most popular way is to use directshow to get frames and OpenCV to process them.

Do You agree? Or do You have another solution? I wouldn't be offended by some links :)

4

2 回答 2

6
  1. 仅当您使用 CV_CAP_DSHOW 标志打开捕获时才使用 DirectShow,例如:

    VideoCapture capture( CV_CAP_DSHOW + 0 );  // 0,1,2, your cam id there
    

    (没有它,它默认为 vfw )

  2. 捕获已经在单独的线程中运行,因此用更多线程包装它不会给您任何收益。

  3. 多个摄像头的另一个障碍是 USB 带宽,因此,如果您的机器背面和前面有端口,请不要将所有摄像头插入同一个端口/控制器,否则您只会将其饱和

于 2013-02-10T15:16:20.763 回答
4

OpenCV uses DirectShow. Using DirectShow (primary video capture API in Windows) directly will obviously get you par or better performance (and even more likely so if OpenCV is set to use Video for Windows). USB cams typically hit USB bandwidth and hence frame rate limit, using DirectShow to capture in compressed formats or in formats with less bits/pixel is the way to reach higher frame rates within the same USB bandwidth limit.

Another typical problem causing low frame rates is slow synchronous processing delaying the capture. You typically identify this by putting trivial processing into the same capture loop and seeing higher FPS compared to processing-enabled operation.

于 2013-02-10T14:04:25.903 回答