MJPEG流无法在OpenCV 2.4中打开 [英] MJPEG stream fails to open in OpenCV 2.4
问题描述
我有一个问题让OpenCV 2.4捕获来自Raspberry Pi的MJPEG流,我已经在浏览器中检查流URL,它似乎工作正常,但是当我尝试在OpenCV中打开它似乎
I am having an issue getting OpenCV 2.4 to capture from an MJPEG stream from a Raspberry Pi, I have checked the stream URL in a browser and it seems to be working fine, however when I try to open it in OpenCV it seems to hang when I attempt to open it (I get neither the error or success messages on the terminal).
cv::VideoCapture vcap;
cv::Mat raw_image;
const string videoStreamAddress = "http://192.168.0.28:8080/?action=stream";
if(!vcap.open(videoStreamAddress))
{
cout<<"Error opening video stream"<<endl;
return -1;
}
cout<<"Stream opened"<<endl;
我使用 MJPEG-Streamer 提供流。
当捕获RTSP视频流时,同样的代码工作正常。
I am using MJPEG-Streamer to provide the stream. The same code works fine when capturing form a RTSP video stream.
编辑:我试图更改由<$ c捕获的图像的JPEG质量和分辨率
I tried changing the JPEG quality and resolution of the images captured by raspistill
on the Pi and I now get the message saying the stream failed to open.
推荐答案
p>我发现的答案,它类似于Hitesh建议,我只需要一个。之前
mjpg
让OpenCV认为它是一个文件的URI。
I found the answer, it is similar to what Hitesh suggested, I just needed to have a .
before mjpg
to make OpenCV think it was a URI to a file.
我在此对类似问题的回答。
I found this in this answer to a similar question.
这篇关于MJPEG流无法在OpenCV 2.4中打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!