Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- QVideoFrame VideoFilterRunnable::run(QVideoFrame* input,
- const QVideoSurfaceFormat& surfaceFormat,
- QVideoFilterRunnable::RunFlags flags)
- {
- if (input->isValid()) {
- if (input->map(QAbstractVideoBuffer::ReadOnly)) {
- if (m_videoHeight == 0 && m_videoWidth == 0) {
- m_videoHeight = input->height();
- m_videoWidth = input->width();
- dmsMainWindow->setVideoHeight(m_videoHeight);
- dmsMainWindow->setVideoWidth(m_videoWidth);
- initDMS();
- }
- ++m_frameCount;
- dmsMainWindow->setFrameCount(m_frameCount);
- cv::Mat img = cv::Mat(m_videoHeight, m_videoWidth, CV_8UC4, input->bits());
- std::shared_ptr<DMSOutStr> DMSOut (new DMSOutStr);
- DMS(img.data, img.cols, img.rows, DMSOut.get());
- dmsMainWindow->populateOutputStructure(DMSOut.get());
- input->unmap();
- } else {
- qDebug() << "error while mapping frame";
- }
- } else {
- qDebug() << "invalid input";
- }
- return *input;
- }
Add Comment
Please, Sign In to add comment