Fastest way to get frames from webcam

不打扰是莪最后的温柔 提交于 2019-12-04 12:32:56
  1. DirectShow is only used, if you open your capture using the CV_CAP_DSHOW flag, like:

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

    (without it, it defaults to vfw )

  2. the capture already runs in a separate thread, so wrapping it with more threads won't give you any gain.

  3. another obstacle with multiple cams is the usb bandwidth, so if you got ports on the back & the front of your machine, dont plug all your cams into the same port/controller else you just saturate it

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.

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