1 // 2 // Copyright © 2020 Arm Ltd and Contributors. All rights reserved. 3 // SPDX-License-Identifier: MIT 4 // 5 6 #pragma once 7 8 #include "IFrameOutput.hpp" 9 #include <opencv2/opencv.hpp> 10 11 namespace common 12 { 13 14 class CvWindowOutput : public IFrameOutput<cv::Mat> { 15 public: 16 17 CvWindowOutput() = default; 18 19 ~CvWindowOutput() override = default; 20 21 /** 22 * @brief Creates a named window. 23 * 24 * Uses opencv to create a window with given name. 25 * 26 * @param windowName opencv window name. 27 * 28 */ 29 void Init(const std::string& windowName); 30 31 /** 32 * Writes frame to the window. 33 * 34 * @param frame data to write. 35 */ 36 void WriteFrame(std::shared_ptr<cv::Mat>& frame) override; 37 38 /** 39 * Releases all windows. 40 */ 41 void Close() override; 42 43 /** 44 * Always true. 45 * @return true. 46 */ 47 bool IsReady() const override; 48 49 private: 50 std::string m_windowName; 51 52 }; 53 }// namespace common