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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
#pragma once
#include <set>
#include "ofMain.h"
#include "tesselator.h"
#include "ofxOpenCv.h"
//#include "ofxOpenCvUtilsForeground.h"
#include <opencv2/opencv.hpp>
#include "ofxBlobsManager.h"
#define CAM_WIDTH_FG 640
#define CAM_HEIGHT_FG 480
#define chan_R 1
#define chan_G 2
#define chan_B 3
#define chan_H 4
#define chan_S 5
#define chan_V 6
class testApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
int windowWidth, windowHeight;
ofVideoPlayer vidPlayer;
//matrix types in ofxOpenCv\libs\opencv\include\opencv2\core\types_c.h
//cv::Mat is dynamic
//try to accumulate background using SHORT datatype ie CV_16UC / 4 (would 4 be faster, 64 bits)
cv::Mat accumulator,outmat,hsvback,hsvfront,backchan,frontchan,output; // background accumulation
int frameno;
ofxCvColorImage currentFrame;
ofxCvColorImage background;
ofxCvColorImage mogoutput;
ofxCvGrayscaleImage grayFrame;
ofxCvGrayscaleImage grayBg;
ofxCvGrayscaleImage grayDiff;
float learningRate;
bool bFirstFrame;
ofxCvContourFinder contourFinder;
float threshold;
cv::BackgroundSubtractorMOG mog;
float mogf;
int diffchannel;
bool removeShadows;
int shadowThreshold;
/*
ofxOpenCvUtilsForeground* fg;
ofxOpenCvUtilsMeanShift* meanShift;
ofxCvColorImage blobFrame;
ofxCvColorImage trackFrame;
ofxCvGrayscaleImage resultFrame;
float blockSize;
float minBlobSize;
float maxBlobSize;
float shadowThreshold;
float blur;
bool selectEnabled;
bool useMoG;
bool isTracking;
*/
};
|