使用opencv byC ++从ip cam捕获帧

时间:2014-01-14 17:37:17

标签: c++ opencv ip-camera

我的ipcam的ip http://admin:@192.168.1.124:80/
谁能教我如何使用opencv2.4.3编写真正的程序来连接到ipcam 我希望可以给我完整的程序来参考 非常感谢

1 个答案:

答案 0 :(得分:0)

基本相机样板,无论输入什么:


#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;
}
相关问题