IP camera and OPENCV

六月ゝ 毕业季﹏ 提交于 2019-11-29 12:45:19

if it's a recent opencv version, this might work:

Mat frame;
namedWindow("video", 1);
VideoCapture cap("http://150.214.93.55/mjpg/video.mjpg");
while ( cap.isOpened() )
{
    cap >> frame;
    if(frame.empty()) break;

    imshow("video", frame);
    if(waitKey(30) >= 0) break;
}   

one way or the other, opencv seems to insist, that the url must end with ".mjpg" (dot mjpg), so if it doesn't, add a dummy param to it, like : my/fancy/url?type=.mjpg

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