我需要使用OpenCV库从mjpeg读取流。 更多细节,我需要阅读http://194.126.108.66:8887/ 。 但是当我尝试用它时
VideoCapture ipCam; ipCam.open("http://194.126.108.66:8887/")我收到错误icvOpenAvi_XINE(): Unable to initialize video driver 。
我已经使用另一个链接mjpeg测试了这段代码 - http://c-cam.uchicago.edu/mjpg/video.mjpg它运行正常。 这两个链接有什么区别? 以及如何阅读http://194.126.108.66:8887/ ?
I need to read stream from mjpeg with OpenCV library. In more details, I need to read http://194.126.108.66:8887/. But when I try to do it with
VideoCapture ipCam; ipCam.open("http://194.126.108.66:8887/")I get the error icvOpenAvi_XINE(): Unable to initialize video driver.
I have tested this code with another link to mjpeg - http://c-cam.uchicago.edu/mjpg/video.mjpg It works fine. What is the difference between these 2 links? And how to read http://194.126.108.66:8887/?
最满意答案
OpenCV期望其VideoCapture参数的文件扩展名,即使并非总是需要(如你的情况)。
您可以通过传入以mjpg扩展名结尾的伪参数来“欺骗”它:
ipCam.open("http://194.126.108.66:8887/?dummy=param.mjpg")这适用于我类似的OpenCV Python案例,祝你好运!
OpenCV expects a filename extension for its VideoCapture argument, even though one isn't always necessary (like in your case).
You can "trick" it by passing in a dummy parameter which ends in the mjpg extension:
ipCam.open("http://194.126.108.66:8887/?dummy=param.mjpg")This worked in my similar OpenCV Python case, so good luck!
更多推荐
发布评论