rahulch

Untitled

Feb 26th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. QVideoFrame VideoFilterRunnable::run(QVideoFrame* input,
  2.                                      const QVideoSurfaceFormat& surfaceFormat,
  3.                                      QVideoFilterRunnable::RunFlags flags)
  4. {
  5.     if (input->isValid()) {
  6.         if (input->map(QAbstractVideoBuffer::ReadOnly)) {
  7.  
  8.             if (m_videoHeight == 0 && m_videoWidth == 0) {
  9.                 m_videoHeight = input->height();
  10.                 m_videoWidth = input->width();
  11.                 dmsMainWindow->setVideoHeight(m_videoHeight);
  12.                 dmsMainWindow->setVideoWidth(m_videoWidth);
  13.                 initDMS();
  14.             }
  15.             ++m_frameCount;
  16.             dmsMainWindow->setFrameCount(m_frameCount);
  17.  
  18.             cv::Mat img = cv::Mat(m_videoHeight, m_videoWidth, CV_8UC4, input->bits());
  19.             std::shared_ptr<DMSOutStr> DMSOut (new DMSOutStr);
  20.             DMS(img.data, img.cols, img.rows, DMSOut.get());
  21.             dmsMainWindow->populateOutputStructure(DMSOut.get());
  22.             input->unmap();
  23.         } else {
  24.              qDebug() << "error while mapping frame";
  25.         }
  26.     } else {
  27.          qDebug() << "invalid input";
  28.     }
  29.  
  30.     return *input;
  31. }
Add Comment
Please, Sign In to add comment