zoukankan      html  css  js  c++  java
  • OpenCV获取RTSP解码播放

    #include <opencv2/opencv.hpp>


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

        IplImage *pFrame = NULL, *srcImage = NULL;

        CvCapture *pCapture = NULL;

        //pCapture = cvCaptureFromFile("rtsp://admin:12345@192.168.7.45: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! ");
            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<<pFrame->width<<","<<pFrame->height<<endl;
                cvWaitKey(10);
                cvReleaseImage(&srcImage);
                srcImage = NULL;
            }

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

        return 0;
    }

  • 相关阅读:
    大数据基础——MR编程应用——对中间件的操作
    Hadoop_Hive整理——原理及配置
    Hadoop&Hive——小结
    mysql_小结之事务
    Linux_大数据与数据仓库
    移动布局小结
    JDBC——小结
    Mysql优化反刍
    NoSql-Verson1.0
    python-6
  • 原文地址:https://www.cnblogs.com/ssjie/p/4978911.html
Copyright © 2011-2022 走看看