OpenCV获取RTSP解码播放

#include


int main(int argc, char **argv){

    IplImage *pFrame = NULL, *srcImage = NULL;

    CvCapture *pCapture = NULL;

    //pCapture = cvCaptureFromFile("rtsp://admin:[email protected]:554/h264/ch1/main/av_stream");
    pCapture = cvCreateFileCapture("rtsp://192.168.1.15:8554/djxzBrightness.mp4");
    //pCapture = cvCreateCameraCapture(1);
    if (!pCapture){
        printf("Can not get the video stream from the camera!\n");
        return NULL;
    }

    //read the video by frame
    //while(1)
    while (1){
        //pFrame = cvQueryFrame(pCapture);
        if (srcImage == NULL)
        {
            pFrame = cvQueryFrame(pCapture);
            srcImage = cvCloneImage(pFrame);
            cvShowImage("123234", srcImage);
            //cout<width<<","<height<            cvWaitKey(10);
            cvReleaseImage(&srcImage);
            srcImage = NULL;
        }

    }
    cvReleaseCapture(&pCapture);
    cvReleaseImage(&pFrame);

    return 0;
}

转载于:https://www.cnblogs.com/ssjie/p/4978911.html

你可能感兴趣的:(人工智能,c/c++,java)