-
Notifications
You must be signed in to change notification settings - Fork 0
/
AbstractEffect.h
58 lines (47 loc) · 2.12 KB
/
AbstractEffect.h
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
54
55
56
57
58
#ifndef DW_AbstractEffect
#define DW_AbstractEffect
#define DW_MAX_COLORMAPS 12
#define DW_MAX_GRIDORDER 10 // this means it stops at 9 because grid order is not zero-based.
#include <iostream>
#include <cmath>
#include <opencv2/opencv.hpp>
#include "DWObject.h"
using namespace cv;
using namespace std;
//create an abstract class for all the effects I am going to create.
class AbstractEffect : public DWObject {
public:
AbstractEffect();
virtual string const className() = 0; // need class name.
virtual void init() = 0; // initialize the set-up if needed.
void addNewFrame(Mat frame); // copy in the latest frame
virtual void drawEffect() = 0; // draw the intended effect.
Mat getOutFrame(); // obtain the latest graphic
virtual void togglePresets() = 0; // toggle to the next set of presets.
void changeColorMap(); // toggle through the colormaps.
void toggleColorMapsOn(); // toggle colormaps on/off switch.
void setColorMapApply(bool bColorMap); // decide whether to use color map.
void setOutFrameToBlack(); // set outFrame to same size as last and black.
void setGridOrder(int order); // set grid order for output grid.
void incrementGridOrder();
void computeRandColorMapList();
// get a random configuration.
virtual void getRandomConfig(bool doGrid=false);
// do background subtraction.
void doBGSubtraction(); // do background substraction.
protected:
Mat m_lastFrame; // latest frame from the video capture for processing.
Mat m_outFrame; // this is the frame that will be displayed.
// background substraction.
Mat m_fgMask; // this is the foreground mask generated during background subtraction.
Ptr<BackgroundSubtractorMOG2> m_bgSubstractor; // this is the actual background subtractor.
// some colormap items.
int m_currentColorMap; // current colormap being used.
bool m_bApplyColorMap; // boolean that decides whether we apply the color map.
// image grid -- create a grid of images
// - option 1: same image different colour maps.
// - option 2: series of images in a grid.
int m_gridOrder; // 1x1, 2x2, 3x3, etc.
vector<int> m_randColorMapList; // order^2 maps.
};
#endif