例如,我们有工作的 rtsp 流测试,例如:“rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov”(它在发布本文时有效)
现在我想在 openCV 中捕捉这个视频流(opencv 2.4.7 / 2.4.8)
我的代码在本地电影文件上完美运行,但是当我尝试捕获 rtsp 时,我收到如下消息:“无法读取电影文件 rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov”
我尝试了几种不同的方法,例如:
CvCapture *camera = cvCreateFileCapture("rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov");
if (camera == NULL) {
printf("video is null, aborting...");
return -1;
}
else{
printf("video ok");
}
or:
cv::VideoCapture vcap;
//open the video stream and make sure it's opened
if(!vcap.open("rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov")) {
std::cout << "Error opening video stream or file" << std::endl;
return -1;
}
任何想法 ?
--
Niedved
以下代码对我来说没有任何问题。如果您有该流的用户名和密码,请不要忘记将其包含在 url 地址中。
cv::VideoCapture capture(url);
if (!capture->isOpened()) {
//Error
}
cv::namedWindow("TEST", CV_WINDOW_AUTOSIZE);
cv::Mat frame;
while(m_enable) {
if (!capture->read(frame)) {
//Error
}
cv::imshow("TEST", frame);
cv::waitKey(30);
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)