-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathofxARTNftTracker.h
97 lines (73 loc) · 2.6 KB
/
ofxARTNftTracker.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
//
// ofxARTNftTracker.h
// artool5example
//
// Created by nausea on 12/23/15.
//
//
#pragma once
#include "ofxARTGenericTracker.h"
#include <AR/gsub_lite.h>
#include <AR/arMulti.h>
#include <AR/arFilterTransMat.h>
#include <AR2/tracking.h>
#include <AR2/util.h>
#include <KPM/kpm.h>
#include "ARMarkerNFT.h"
#include "trackingSub.h"
#include "ofxARTNftUtils.h"
#define PAGES_MAX 10
namespace ofxArtool5 {
enum PageStatus{
PAGE_NOT_INITED = -2,
PAGE_INITED_OK = -1
};
class NftTracker : public GenericTracker{
public:
NftTracker();
~NftTracker();
void nullArtPointers();
void cleanup();
bool setup(ofVec2f _camSize, ofVec2f _viewportSize, ofPixelFormat pf=OF_PIXELS_BGR, string pthCamParam="ARTdata/camera_para.dat", string pthMarkerData="ARTdata/markers.dat", string pthCustomDat="ARTdata/custom.dat");
void update(ARUint8 * arPix);
template<class T> inline void update(ofBaseHasPixels_<T> & ofImg){GenericTracker::update(ofImg);}
//MATRICES
void beginAR(ofRectangle & rViewport);
void beginAR();
void endAR();
void loadProjectionMatrix();
void loadModelMatrix();
void loadModelMatrix(ARMarkerNFT * mk);
//MARKERS
int getNumMarkers(){return markersNFTCount;}
ARMarkerNFT * getMarkers(){return markersNFT;}
ARMarkerNFT & getMarker(int id){return getMarkers()[id];}
ARMarkerNFT & getSelectedMarker(){return getMarker(selectedId);}
void drawDebug();
//GETTERS
bool isFound(){return bFound;}
ofEvent<int> evNewMarker;
ofEvent<int> evLostMarker;
protected:
bool loadNFTData(string pthCustomDat);
int unloadNFTData();
bool initNFT(ARParamLT * cparamLT, AR_PIXEL_FORMAT pixFormat);
//SETUP
bool setupCamera(string pthCamParam, ofVec2f _camSize, ofVec2f _viewportSize, ofPixelFormat pf=OF_PIXELS_RGB);
void updateMarkerDetection(ARUint8 * arPix);
void updateMarkers();
KpmHandle * kpmHandle;
AR2HandleT * ar2Handle;
ARMarkerNFT * markersNFT;
THREAD_HANDLE_T * threadHandle;
AR2SurfaceSetT * surfaceSet[PAGES_MAX];
ARGL_CONTEXT_SETTINGS_REF gArglSettings;
ARdouble cameraLens[16];
float trackingTrans[3][4];
int markersNFTCount;
int surfaceSetCount;
int selectedId;
int detectedPage;
bool bFound;
};
}