当前位置: 首页>>代码示例>>C++>>正文


C++ VideoBuffer::disconnect方法代码示例

本文整理汇总了C++中VideoBuffer::disconnect方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoBuffer::disconnect方法的具体用法?C++ VideoBuffer::disconnect怎么用?C++ VideoBuffer::disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VideoBuffer的用法示例。


在下文中一共展示了VideoBuffer::disconnect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........
            return 1;
        }

        while (cap.read(frame))
        {
            detectandshow(&alpr, frame, "", outputJson);
            usleep(1000);
            framenum++;
        }
    }
    else if (startsWith(filename, "http://") || startsWith(filename, "https://"))
    {
        int framenum = 0;

        VideoBuffer videoBuffer;

        videoBuffer.connect(filename, 5);

        cv::Mat latestFrame;

        while (program_active)
        {
            int response = videoBuffer.getLatestFrame(&latestFrame);

            if (response != -1)
            {
                detectandshow( &alpr, latestFrame, "", outputJson);
            }

            // Sleep 10ms
            usleep(10000);
        }

        videoBuffer.disconnect();

        std::cout << "Video processing ended" << std::endl;
    }
    else if (hasEndingInsensitive(filename, ".avi") || hasEndingInsensitive(filename, ".mp4") || hasEndingInsensitive(filename, ".webm") ||
             hasEndingInsensitive(filename, ".flv") || hasEndingInsensitive(filename, ".mjpg") || hasEndingInsensitive(filename, ".mjpeg"))
    {
        if (fileExists(filename.c_str()))
        {
            int framenum = 0;

            cv::VideoCapture cap=cv::VideoCapture();
            cap.open(filename);
            cap.set(CV_CAP_PROP_POS_MSEC, seektoms);

            while (cap.read(frame))
            {
                if (SAVE_LAST_VIDEO_STILL)
                {
                    cv::imwrite(LAST_VIDEO_STILL_LOCATION, frame);
                }
                std::cout << "Frame: " << framenum << std::endl;

                detectandshow( &alpr, frame, "", outputJson);
                //create a 1ms delay
                usleep(1000);
                framenum++;
            }
        }
        else
        {
            std::cerr << "Video file not found: " << filename << std::endl;
        }
开发者ID:HSOFEUP,项目名称:openalpr,代码行数:67,代码来源:main.cpp

示例2: main


//.........这里部分代码省略.........
          motiondetector.ResetMotionDetection(&frame);
        detectandshow(&alpr, frame, "", outputJson);
        sleep_ms(10);
        framenum++;
      }
    }
    else if (startsWith(filename, "http://") || startsWith(filename, "https://"))
    {
      int framenum = 0;

      VideoBuffer videoBuffer;

      videoBuffer.connect(filename, 5);

      cv::Mat latestFrame;

      while (program_active)
      {
        std::vector<cv::Rect> regionsOfInterest;
        int response = videoBuffer.getLatestFrame(&latestFrame, regionsOfInterest);

        if (response != -1)
        {
          if (framenum == 0)
            motiondetector.ResetMotionDetection(&latestFrame);
          detectandshow(&alpr, latestFrame, "", outputJson);
        }

        // Sleep 10ms
        sleep_ms(10);
        framenum++;
      }

      videoBuffer.disconnect();

      std::cout << "Video processing ended" << std::endl;
    }
    else if (hasEndingInsensitive(filename, ".avi") || hasEndingInsensitive(filename, ".mp4") ||
                                                       hasEndingInsensitive(filename, ".webm") ||
                                                       hasEndingInsensitive(filename, ".flv") || hasEndingInsensitive(filename, ".mjpg") ||
                                                       hasEndingInsensitive(filename, ".mjpeg") ||
             hasEndingInsensitive(filename, ".mkv")
        )
    {
      if (fileExists(filename.c_str()))
      {
        int framenum = 0;

        cv::VideoCapture cap = cv::VideoCapture();
        cap.open(filename);
        cap.set(CV_CAP_PROP_POS_MSEC, seektoms);

        while (cap.read(frame))
        {
          if (SAVE_LAST_VIDEO_STILL)
          {
            cv::imwrite(LAST_VIDEO_STILL_LOCATION, frame);
          }
          if (!outputJson)
            std::cout << "Frame: " << framenum << std::endl;
          
          if (framenum == 0)
            motiondetector.ResetMotionDetection(&frame);
          detectandshow(&alpr, frame, "", outputJson);
          //create a 1ms delay
          sleep_ms(1);
开发者ID:AndyTsangChun,项目名称:openalpr,代码行数:67,代码来源:main.cpp


注:本文中的VideoBuffer::disconnect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。