How to get MJPG stream video from android IPWebcam using opencv

前端 未结 5 1505
暗喜
暗喜 2021-02-04 19:48

I am using the IP Webcam program on android and receiving it on my PC by WiFi. What I want is to use opencv in Visual Studio, C++, to get that video stream, there is an option t

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-04 20:32

    Working example for me

    // OpenCVTest.cpp : Defines the entry point for the console application.
    //
    
    #include "stdafx.h"
    #include "opencv2/highgui/highgui.hpp"
    
    /**
    * @function main
    */
    int main( int argc, const char** argv )
    {
        CvCapture* capture;
        IplImage* frame = 0;
    
        while (true)
        {
            //Read the video stream
            capture = cvCaptureFromFile("http://192.168.1.129:8080/webcam.mjpeg");
            frame = cvQueryFrame( capture );
    
            // create a window to display detected faces
            cvNamedWindow("Sample Program", CV_WINDOW_AUTOSIZE);
    
            // display face detections
            cvShowImage("Sample Program", frame);
    
            int c = cvWaitKey(10);
            if( (char)c == 27 ) { exit(0); }
    
        }
    
        // clean up and release resources
        cvReleaseImage(&frame);
    
        return 0;
    
    }
    

    Broadcast mjpeg from a webcam with vlc, how described at http://tumblr.martinml.com/post/2108887785/how-to-broadcast-a-mjpeg-stream-from-your-webcam-with

提交回复
热议问题