/
screen.hpp
49 lines (41 loc) · 881 Bytes
/
screen.hpp
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
#include <opencv2/core/types_c.h>
#include <opencv2/highgui/highgui_c.h>
#include <opencv2/core/core.hpp>
#include <opencv2/core/mat.hpp>
#include <opencv2/core/operations.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
using namespace cv;
class Screen
{
Mat backstore;
const char* name;
public:
Screen() :
name("ui")
{
namedWindow(name, CV_WINDOW_NORMAL);
setWindowProperty(name, CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN);
}
void setSize(Size size)
{
backstore = Mat::zeros(size, CV_8UC3);
}
Mat getBackstore()
{
return backstore;
}
void refresh()
{
imshow(name, backstore);
}
void refresh(const Mat& img)
{
backstore = img.clone();
refresh();
}
void operator<<(const Mat& img)
{
refresh(img);
}
};