41 #ifndef ARCONTROLLER_H
42 #define ARCONTROLLER_H
47 #include <AR/arMulti.h>
56 # include <AR2/tracking.h>
70 # define pthread_mutex_t CRITICAL_SECTION
71 # define pthread_mutex_init(pm, a) InitializeCriticalSectionEx(pm, 4000, CRITICAL_SECTION_NO_DEBUG_INFO)
72 # define pthread_mutex_lock(pm) EnterCriticalSection(pm)
73 # define pthread_mutex_unlock(pm) LeaveCriticalSection(pm)
74 # define pthread_mutex_destroy(pm) DeleteCriticalSection(pm)
85 #pragma mark Private types and instance variables
98 bool stateWaitingMessageLogged;
104 pthread_mutex_t m_videoSourceLock;
105 bool m_videoSourceIsStereo;
106 int m_videoSourceFrameStamp0;
107 int m_videoSourceFrameStamp1;
110 ARdouble m_projectionNearPlane;
111 ARdouble m_projectionFarPlane;
112 ARdouble m_projectionMatrix0[16];
113 ARdouble m_projectionMatrix1[16];
114 bool m_projectionMatrixSet;
118 AR_LABELING_THRESH_MODE thresholdMode;
122 int patternDetectionMode;
123 AR_MATRIX_CODE_TYPE matrixCodeType;
126 std::vector<ARMarker *> markers;
128 bool doMarkerDetection;
130 ARHandle *m_arHandle0;
131 ARHandle *m_arHandle1;
132 ARPattHandle *m_arPattHandle;
133 AR3DHandle *m_ar3DHandle;
134 ARdouble m_transL2R[3][4];
135 AR3DStereoHandle *m_ar3DStereoHandle;
138 bool doNFTMarkerDetection;
143 THREAD_HANDLE_T *trackingThreadHandle;
144 AR2HandleT *m_ar2Handle;
145 KpmHandle *m_kpmHandle;
146 AR2SurfaceSetT *surfaceSet[PAGES_MAX];
150 void setError(
int error);
152 #pragma mark Private methods.
157 void lockVideoSource();
158 void unlockVideoSource();
176 bool removeMarker(
ARMarker* marker);
184 bool unloadNFTData(
void);
185 bool loadNFTData(
void);
190 #pragma mark Public API
208 static void logvBuf(va_list args,
const char* format,
char **bufPtr,
int* lenPtr);
209 static void logvWriteBuf(
char* buf,
int len,
const int logLevel);
212 static void logv(
const int logLevel,
const char* format, ...);
219 static void logv(
const char* msg, ...);
235 bool initialiseBase(
const int patternSize = AR_PATT_SIZE1,
const int patternCountMax = AR_PATT_NUM_MAX);
257 bool startRunning(
const char* vconf,
const char* cparaName,
const char* cparaBuff,
const long cparaBuffLen);
274 bool startRunningStereo(
const char* vconfL,
const char* cparaNameL,
const char* cparaBuffL,
const long cparaBuffLenL,
275 const char* vconfR,
const char* cparaNameR,
const char* cparaBuffR,
const long cparaBuffLenR,
276 const char* transL2RName,
const char* transL2RBuff,
const long transL2RBuffLen);
278 #if TARGET_PLATFORM_ANDROID
279 bool videoAcceptImage(JNIEnv* env, jobject obj,
const int videoSourceIndex, jbyteArray pinArray, jint width, jint height, jint cameraIndex, jboolean cameraIsFrontFacing);
292 bool videoParameters(
const int videoSourceIndex,
int *width,
int *height, AR_PIXEL_FORMAT *pixelFormat);
334 int addMarker(
const char* cfg);
341 bool removeMarker(
int UID);
529 bool loadOpticalParams(
const char *optical_param_name,
const char *optical_param_buff,
const long optical_param_buffLen, ARdouble *fovy_p, ARdouble *aspect_p, ARdouble m[16], ARdouble p[16]);
534 #endif // !ARCONTROLLER_H