/
FaceLoader.h
66 lines (50 loc) · 1.12 KB
/
FaceLoader.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
/*
* FaceLoader.h
*
* Created on: 22/01/2012
* Author: arturo
*/
#ifndef FACELOADER_H_
#define FACELOADER_H_
#include "ofConstants.h"
#include "ofVectorMath.h"
#include "ofImage.h"
#include "ofxFaceTrackerThreaded.h"
#include "ofThread.h"
#include "ofFileUtils.h"
#include "ofxGui.h"
class FaceLoader: public ofThread {
public:
FaceLoader();
virtual ~FaceLoader();
enum Mode{
Random,
Sequential
};
void setup(string folder, Mode mode);
void update();
void setMode(Mode mode);
ofImage & getCurrentImg();
ofxFaceTracker & getTracker();
vector<ofVec2f> & getCurrentImagePoints();
void threadedFunction();
string loadNext();
string loadPrevious();
int getTotalFaces();
int getCurrentFace();
string getCurrentFacePath();
ofEvent<string> newFaceLoadedE;
private:
void resizeAndDiscardImages(string path);
void loadFace(string face);
ofxFaceTracker tracker;
ofImage src[2], *currentImg, *nextImg;
vector<ofVec2f> srcPoints[2], *currentPoints, *nextPoints;
ofDirectory faces;
bool loadNextFace;
Poco::Condition loadNew;
Mode mode;
int currentFace;
//ofMutex mutex;
};
#endif /* FACELOADER_H_ */