xref: /aosp_15_r20/external/armnn/samples/common/src/CVUtils/CvWindowOutput.cpp (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1 //
2 // Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "CvWindowOutput.hpp"
7 
8 namespace common
9 {
10 
Init(const std::string & windowName)11 void CvWindowOutput::Init(const std::string& windowName)
12 {
13     m_windowName = windowName;
14     cv::namedWindow(m_windowName, cv::WINDOW_AUTOSIZE);
15 }
16 
WriteFrame(std::shared_ptr<cv::Mat> & frame)17 void CvWindowOutput::WriteFrame(std::shared_ptr<cv::Mat>& frame)
18 {
19     cv::cvtColor(*frame, *frame, cv::COLOR_RGB2BGR);
20     cv::imshow( m_windowName, *frame);
21     cv::waitKey(30);
22 }
23 
Close()24 void CvWindowOutput::Close()
25 {
26     cv::destroyWindow(m_windowName);
27 }
28 
IsReady() const29 bool CvWindowOutput::IsReady() const
30 {
31     return true;
32 }
33 }// namespace common