aboutsummaryrefslogtreecommitdiff
path: root/samples/common/include/CVUtils/CvWindowOutput.hpp
blob: 4b9ae3b743ddd5560693749d63a1b86162870c0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// Copyright © 2020 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//

#pragma once

#include "IFrameOutput.hpp"
#include <opencv2/opencv.hpp>

namespace common
{

class CvWindowOutput : public IFrameOutput<cv::Mat> {
public:

    CvWindowOutput() = default;

    ~CvWindowOutput() override = default;

    /**
     * @brief Creates a named window.
     *
     * Uses opencv to create a window with given name.
     *
     * @param windowName opencv window name.
     *
     */
    void Init(const std::string& windowName);

    /**
     * Writes frame to the window.
     *
     * @param frame data to write.
     */
    void WriteFrame(std::shared_ptr<cv::Mat>& frame) override;

    /**
     * Releases all windows.
     */
    void Close() override;

    /**
     * Always true.
     * @return true.
     */
    bool IsReady() const override;

private:
    std::string m_windowName;

};
}// namespace common