C++ code Capturing image from IP / Ethernet Cameras (AXIS Cam)

妖精的绣舞 提交于 2019-12-03 22:13:53

问题


I've 4 Axis IP cams. I need a code to capture image from those cams. I've opencv code to capture image from USB cams but I don't kno how to capture from IP cams.


回答1:


int main()
{
    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;
    }   
    return 0;
}

no idea, how your urls look like, but opencv seems to insist, it has to end with mjpg. so if it doesn't, the trick is to append a dummy parameter:

http://my/cool/ip-cam.ie?dummy=video.mjpg

if you need to open all 4 cams at once, you need a VideoCapture for each one:

VideoCapture cap1("url1");
VideoCapture cap2("url2");
VideoCapture cap3("url3");
VideoCapture cap4("url4");


来源:https://stackoverflow.com/questions/15462323/c-code-capturing-image-from-ip-ethernet-cameras-axis-cam

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