aboutsummaryrefslogtreecommitdiff
path: root/samples/common/src/CVUtils/CvWindowOutput.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'samples/common/src/CVUtils/CvWindowOutput.cpp')
-rw-r--r--samples/common/src/CVUtils/CvWindowOutput.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/samples/common/src/CVUtils/CvWindowOutput.cpp b/samples/common/src/CVUtils/CvWindowOutput.cpp
new file mode 100644
index 0000000000..190a7602e2
--- /dev/null
+++ b/samples/common/src/CVUtils/CvWindowOutput.cpp
@@ -0,0 +1,33 @@
+//
+// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include "CvWindowOutput.hpp"
+
+namespace common
+{
+
+void CvWindowOutput::Init(const std::string& windowName)
+{
+ m_windowName = windowName;
+ cv::namedWindow(m_windowName, cv::WINDOW_AUTOSIZE);
+}
+
+void CvWindowOutput::WriteFrame(std::shared_ptr<cv::Mat>& frame)
+{
+ cv::cvtColor(*frame, *frame, cv::COLOR_RGB2BGR);
+ cv::imshow( m_windowName, *frame);
+ cv::waitKey(30);
+}
+
+void CvWindowOutput::Close()
+{
+ cv::destroyWindow(m_windowName);
+}
+
+bool CvWindowOutput::IsReady() const
+{
+ return true;
+}
+}// namespace common \ No newline at end of file