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

Capture frame from ip cam using opencv byC++

本文关键字:cam IP opencv byC++ 使用      更新时间:2023-10-16

my ipcam's ip http://admin:@192.168.1.124:80/
谁能教我如何使用OpenCV2.4.3编写真正的程序来连接到IPCAM希望能给我完整的程序参考多谢

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


#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;
}