Ask Your Question

Revision history [back]

OpenCV ip camera

I try to obtain the video of an ip cam but I obtain this message each time: WARNING: Couldn't read movie file http://XXX.XXX.XXX.XXX/mjpg/video.mjpg".

#include <opencv2/opencv.hpp>
int main(void)
{
cv::VideoCapture camera;
    camera.open("http://204.248.124.202/mjpg/video.mjpg"); 
    if (camera.isOpened()==true)
    {
        cv::namedWindow("camera");
        int key = 0;
        while (key != 27)
        {
            cv::Mat_<cv::Vec3b> image;        
            camera.grab();
            camera.retrieve(image);
            cv::imshow("camera",image);
            key = cv::waitKey(10);

        }
    }
}

Thanks.