从网络摄像头获取帧的最快方法 [英] Fastest way to get frames from webcam
问题描述
我在用C ++(Visual Studio)开发我的程序时遇到了一个小问题-目前,我在连接多个网络摄像头(通过usb电缆连接)时遇到了麻烦,为每个网络摄像头创建了单独的线程来捕获帧,和用于处理图像的单独框架.
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.
我使用OpenCV处理帧,但问题是我没有达到网络摄像头的最高峰(它支持25 fps,我只有18)有一些库可以用来获取帧,而不是使用它们处理帧. OpenCV可以使帧捕获更快?
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?
我正在研究一下,最流行的方法是使用DirectShow获取帧,并使用OpenCV对其进行处理.
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 :)
推荐答案
-
DirectShow仅在使用以下方式打开捕获时使用 CV_CAP_DSHOW标志,例如:
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
(没有它,默认为vfw)
(without it, it defaults to vfw )
捕获已经在单独的线程中运行,因此用更多线程包装它不会给您带来任何好处.
the capture already runs in a separate thread, so wrapping it with more threads won't give you any gain.
具有多个凸轮的另一个障碍是usb带宽,因此如果背面有端口&在机器的前部,不要将所有凸轮都插入相同的端口/控制器,否则您只会使其饱和
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
这篇关于从网络摄像头获取帧的最快方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!