forked from juziyt/finger-tracking
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestApp.h
139 lines (100 loc) · 2.86 KB
/
testApp.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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#pragma once
#include "ofMain.h"
#include "ofxOpenCv.h"
#include "OscSend.h"
//#include "OscReceive.h"
#include "ofxCvMain.h"
#include "ofVbo.h"
#include <pthread.h>
#define NUM_BILLBOARDS 300
#define NUM_PAOPAO 5000
#define NUM_THREADS 1
#define _USE_LIVE_VIDEO
#define W 1024
#define H 768
class testApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
int highb(vector<int> x);
int lowb(vector<int> x);
int center(vector<int> x);
int minindex(vector<float> x);
int exist(vector<int> x, vector<int> y, int vx, int vy);
void filter(vector<int> x, vector<int> y);
void cluster(vector<int> x, vector<int> y);
float dist(vector<int> x, vector<int> y);
void drawFbo();
void keyPressed (int key);
ofVideoGrabber vidGrabber;
ofxCvColorImage colorImg;
ofxCvColorImage colorImgHSV;
ofxCvGrayscaleImage hueImg;
ofxCvGrayscaleImage satImg;
ofxCvGrayscaleImage valImg;
ofImage calder;
unsigned char * colorTrackedPixels;
ofTexture trackedTexture;
vector<int> px;
vector<int> py;
vector<int> cx;
vector<int> cy;
int minHue, maxHue, minSat, maxSat, minVal, maxVal;
float hue, hueWidth, sat, satWidth, val, valWidth;
int K = 2;
vector<int> ux;
vector<int> uy;
vector<int> uxx;
vector<int> uyy;
int alpha=20;
ofFbo rgbaFbo;
int flag1 = 0;
int flag2 = 0;
int p=0;
int xx0 = 2000;
int yy0 = 2000;
int xx1 = 2000;
int yy1 = 2000;
int xx3 = 2000;
int yy3 = 2000;
int xx4 = 0;
int yy4 = 0;
vector<int> xx2;
vector<int> yy2;
int ppx;
int ppy;
vector<int> pvx;
vector<int> pvy;
float a=2000;
int flag=0;
int cxx;
int cyy;
void addPoint(float x, float y) {
points.push_back(ofVec2f(x, y));
speeds.push_back(ofVec2f(ofRandom(0, 10), ofRandom(0, 10)));
}
vector <ofVec2f> points;
vector <ofVec2f> speeds;
ofVec3f cameraRotation;
float zoom, zoomTarget;
int paopao = 0;
int backr = 110;
int backg = 0;
int backb = 220;
// billboard particles
float billboardSizeTarget[NUM_BILLBOARDS];
float billboardSizeTargetFinal[NUM_PAOPAO];
ofShader billboardShader;
ofImage texture;
ofVboMesh billboards;
ofVboMesh billboardsFinal;
ofVec3f billboardVels[NUM_BILLBOARDS];
ofVec3f billboardVelsFinal[NUM_PAOPAO];
int step1 = 1;
int step2 = 0;
int step3 = 0;
int step4 = 0;
int step5 = 0;
int timer = 0;
};