summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt/module/frame.hpp
blob: 1e7c82b6a69bab15545948cb052f760fbf48a026 (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
#pragma once

#include "pt-api.hpp"

#include <opencv2/core.hpp>
#include <QImage>

#ifdef __clang__
#   pragma clang diagnostic push
#   pragma clang diagnostic ignored "-Wweak-vtables"
#endif

namespace pt_module {

struct Frame final : pt_frame
{
    cv::Mat mat;

    operator const cv::Mat&() const& { return mat; }
    operator cv::Mat&() & { return mat; }
};

struct Preview final : pt_preview
{
    Preview(int w, int h);

    void set_last_frame(const pt_frame& frame) override;
    QImage get_bitmap() override;
    void draw_head_center(f x, f y) override;

    operator cv::Mat&() { return frame_copy; }
    operator cv::Mat const&() const { return frame_copy; }

private:
    static void ensure_size(cv::Mat& frame, int w, int h, int type);

    cv::Mat frame_copy, frame_out, frame_tmp;
};

} // ns pt_module

#ifdef __clang__
#   pragma clang diagnostic pop
#endif