Question

my ipcam's iphttp://admin:@192.168.1.124:80/
who can teach me how to use opencv2.4.3 to write the true program to connect to ipcam i hope can give me the complete program to reference thanks a lot

Was it helpful?

Solution

basic camera boilerplate, no matter what input:


#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"

using namespace cv;

int main()
{
    VideoCapture cap("http://admin:@192.168.1.124:80/"); // connect to an ip-cam ( might need some additional dummy param like: '?type=mjpeg' at the end
    //VideoCapture cap("/home/me/some.avi"); // load a video file
    //VideoCapture cap(-1); // get the 1st 'local' usb webcam
    while( cap.isOpened() )
    {
        Mat frame;
        if ( ! cap.read(frame) )
            break;

        //
        // your processing here
        //

        imshow("lalala",frame);
        int k = waitKey(10);
        if ( k==27 )
            break;
    }
    return 0;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top