-
Notifications
You must be signed in to change notification settings - Fork 14
/
ofxInteractiveSurface.h
91 lines (70 loc) · 2.55 KB
/
ofxInteractiveSurface.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
//
// ofxInteractiveSurface.h
// ofxInteractiveSurface
//
// Created by Patricio Gonzalez Vivo on 5/3/12.
// Copyright (c) 2012 http://PatricioGonzalezVivo.com . All rights reserved.
//
#ifndef OFXTRACKEDSURFACE
#define OFXTRACKEDSURFACE
#include "ofMain.h"
#include "ofxKinect.h"
#include "ofxOpenCv.h"
#include "ofxBlobTracker.h"
#include "ofxInteractiveViewPort.h"
#include "ofxKinectAutoCalibrator.h"
enum ofxTrackMode {
TRACK_NONE,
TRACK_JUST_OBJECT,
TRACK_JUST_HANDS,
TRACK_ACTIVE_OBJECT,
TRACK_ACTIVE_HANDS,
TRACK_BOTH
};
class ofxInteractiveSurface {
public:
ofxInteractiveSurface();
void load(); // Load previus calibration setup from "settings.xml"
void calibrate(); // Make a new calibration
void setTrackMode(ofxTrackMode _trackMode){ trackMode = _trackMode;};
int getWidth() const {return width; };
int getHeight() const {return height; };
bool isCalibrated() const {bool bCalibrated;};
void update();
void draw(ofTexture &texture);
void exit();
// Events
ofEvent<ofPolyline> calibrationDone;
ofEvent<ofxBlob> objectAdded;
ofEvent<ofxBlob> objectMoved;
ofEvent<ofxBlob> objectDeleted;
ofEvent<ofxBlob> handAdded;
ofEvent<ofxBlob> handMoved;
ofEvent<ofxBlob> handDeleted;
bool bDebug;
private:
void _cleanBackground(float &_threshold);
void _objectAdded(ofxBlob &_blob);
void _objectMoved(ofxBlob &_blob);
void _objectDeleted(ofxBlob &_blob);
void _handAdded(ofxBlob &_blob);
void _handMoved(ofxBlob &_blob);
void _handDeleted(ofxBlob &_blob);
ofxKinect kinect;
ofxTrackMode trackMode;
ofxInteractiveViewPort view;
ofxKinectAutoCalibrator autoCalibrator;
ofxPanel gui;
ofxFloatSlider minDist;
ofxFloatSlider maxDist;
ofxIntSlider objectsImageThreshold;
ofxCvFloatImage surfaceImage;
ofxCvGrayscaleImage objectsImage;
ofxCvGrayscaleImage handsImage;
ofPolyline surfaceContour;
ofxBlobTracker hands;
ofxBlobTracker objects;
int width, height, numPixels, countDown;
bool bCalibrated;
};
#endif