00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef __ARTOOLKITPLUS_TRACKERMULTIMARKERIMPL_HEADERFILE__
00042 #define __ARTOOLKITPLUS_TRACKERMULTIMARKERIMPL_HEADERFILE__
00043
00044
00045 #include <ARToolKitPlus/TrackerMultiMarker.h>
00046 #include <ARToolKitPlus/TrackerImpl.h>
00047 #include <ARToolKitPlus/Logger.h>
00048
00049
00050 #define ARMM_TEMPL_FUNC template <int __PATTERN_SIZE_X, int __PATTERN_SIZE_Y, int __PATTERN_SAMPLE_NUM, int __MAX_LOAD_PATTERNS, int __MAX_IMAGE_PATTERNS>
00051 #define ARMM_TEMPL_TRACKER TrackerMultiMarkerImpl<__PATTERN_SIZE_X, __PATTERN_SIZE_Y, __PATTERN_SAMPLE_NUM, __MAX_LOAD_PATTERNS, __MAX_IMAGE_PATTERNS>
00052
00053
00054 namespace ARToolKitPlus
00055 {
00056
00057
00059
00068 template <int __PATTERN_SIZE_X, int __PATTERN_SIZE_Y, int __PATTERN_SAMPLE_NUM, int __MAX_LOAD_PATTERNS=32, int __MAX_IMAGE_PATTERNS=32>
00069 class TrackerMultiMarkerImpl : public TrackerMultiMarker, protected TrackerImpl<__PATTERN_SIZE_X,__PATTERN_SIZE_Y, __PATTERN_SAMPLE_NUM, __MAX_LOAD_PATTERNS, __MAX_IMAGE_PATTERNS>
00070 {
00071 public:
00072 TrackerMultiMarkerImpl(int nWidth=320, int nHeight=240);
00073 ~TrackerMultiMarkerImpl();
00074
00077
00082 virtual bool init(const char* nCamParamFile, const char* nMultiFile, ARFloat nNearClip, ARFloat nFarClip,
00083 ARToolKitPlus::Logger* nLogger=NULL);
00084 virtual bool init(Camera* camera, const char* nMultiFile, ARFloat nNearClip, ARFloat nFarClip,
00085 ARToolKitPlus::Logger* nLogger=NULL);
00086
00088
00091 virtual int calc(const unsigned char* nImage);
00092
00094 virtual int getNumDetectedMarkers() const { return numDetected; }
00095
00097
00102 virtual void setUseDetectLite(bool nEnable) { useDetectLite = nEnable; }
00103
00104 virtual void getDetectedMarkers(int*& nMarkerIDs);
00105
00106 virtual const ARMarkerInfo& getDetectedMarker(int nWhich) const { return detectedMarkers[nWhich]; }
00107
00108 virtual const ARMultiMarkerInfoT* getMultiMarkerConfig() const { return config; }
00109
00111
00117 virtual void getARMatrix(ARFloat nMatrix[3][4]) const;
00118
00119
00120
00121
00122
00123
00124
00125 void cleanup() { AR_TEMPL_TRACKER::cleanup(); }
00126 bool setPixelFormat(PIXEL_FORMAT nFormat) { return AR_TEMPL_TRACKER::setPixelFormat(nFormat); }
00127 bool loadCameraFile(const char* nCamParamFile, ARFloat nNearClip, ARFloat nFarClip) { return AR_TEMPL_TRACKER::loadCameraFile(nCamParamFile, nNearClip, nFarClip); }
00128 void setLoadUndistLUT(bool nSet) { AR_TEMPL_TRACKER::setLoadUndistLUT(nSet); }
00129 void setLogger(ARToolKitPlus::Logger* nLogger) { AR_TEMPL_TRACKER::setLogger(nLogger); }
00130 int arDetectMarker(ARUint8 *dataPtr, int thresh, ARMarkerInfo **marker_info, int *marker_num) { return AR_TEMPL_TRACKER::arDetectMarker(dataPtr, thresh, marker_info, marker_num); }
00131 int arDetectMarkerLite(ARUint8 *dataPtr, int thresh, ARMarkerInfo **marker_info, int *marker_num) { return AR_TEMPL_TRACKER::arDetectMarkerLite(dataPtr, thresh, marker_info, marker_num); }
00132 ARFloat arMultiGetTransMat(ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config) { return AR_TEMPL_TRACKER::arMultiGetTransMat(marker_info, marker_num, config); }
00133 ARFloat arGetTransMat(ARMarkerInfo *marker_info, ARFloat center[2], ARFloat width, ARFloat conv[3][4]) { return AR_TEMPL_TRACKER::arGetTransMat(marker_info, center, width, conv); }
00134 ARFloat arGetTransMatCont(ARMarkerInfo *marker_info, ARFloat prev_conv[3][4], ARFloat center[2], ARFloat width, ARFloat conv[3][4]) { return AR_TEMPL_TRACKER::arGetTransMatCont(marker_info, prev_conv, center, width, conv); }
00135 ARFloat rppMultiGetTransMat(ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config) { return AR_TEMPL_TRACKER::rppMultiGetTransMat(marker_info, marker_num, config); }
00136 ARFloat rppGetTransMat(ARMarkerInfo *marker_info, ARFloat center[2], ARFloat width, ARFloat conv[3][4]) { return AR_TEMPL_TRACKER::rppGetTransMat(marker_info, center, width, conv); }
00137 int arLoadPatt(char *filename) { return AR_TEMPL_TRACKER::arLoadPatt(filename); }
00138 int arFreePatt(int patno) { return AR_TEMPL_TRACKER::arFreePatt(patno); }
00139 int arMultiFreeConfig(ARMultiMarkerInfoT *config) { return AR_TEMPL_TRACKER::arMultiFreeConfig(config); }
00140 ARMultiMarkerInfoT *arMultiReadConfigFile(const char *filename) { return AR_TEMPL_TRACKER::arMultiReadConfigFile(filename); }
00141 void activateBinaryMarker(int nThreshold) { AR_TEMPL_TRACKER::activateBinaryMarker(nThreshold); }
00142 void setMarkerMode(MARKER_MODE nMarkerMode) { AR_TEMPL_TRACKER::setMarkerMode(nMarkerMode); }
00143 void activateVignettingCompensation(bool nEnable, int nCorners=0, int nLeftRight=0, int nTopBottom=0) { AR_TEMPL_TRACKER::activateVignettingCompensation(nEnable, nCorners, nLeftRight, nTopBottom); }
00144 void changeCameraSize(int nWidth, int nHeight) { AR_TEMPL_TRACKER::changeCameraSize(nWidth, nHeight); }
00145 void setUndistortionMode(UNDIST_MODE nMode) { AR_TEMPL_TRACKER::setUndistortionMode(nMode); }
00146 bool setPoseEstimator(POSE_ESTIMATOR nMethod) { return AR_TEMPL_TRACKER::setPoseEstimator(nMethod); }
00147 void setBorderWidth(ARFloat nFraction) { AR_TEMPL_TRACKER::setBorderWidth(nFraction); }
00148 void setThreshold(int nValue) { AR_TEMPL_TRACKER::setThreshold(nValue); }
00149 int getThreshold() const { return AR_TEMPL_TRACKER::getThreshold(); }
00150 void activateAutoThreshold(bool nEnable) { AR_TEMPL_TRACKER::activateAutoThreshold(nEnable); }
00151 bool isAutoThresholdActivated() const { return AR_TEMPL_TRACKER::isAutoThresholdActivated(); }
00152 void setNumAutoThresholdRetries(int nNumRetries) { AR_TEMPL_TRACKER::setNumAutoThresholdRetries(nNumRetries); }
00153 const ARFloat* getModelViewMatrix() const { return AR_TEMPL_TRACKER::getModelViewMatrix(); }
00154 const ARFloat* getProjectionMatrix() const { return AR_TEMPL_TRACKER::getProjectionMatrix(); }
00155 const char* getDescription() { return AR_TEMPL_TRACKER::getDescription(); }
00156 PIXEL_FORMAT getPixelFormat() const { return static_cast<PIXEL_FORMAT>(AR_TEMPL_TRACKER::getPixelFormat()); }
00157 int getBitsPerPixel() const { return static_cast<PIXEL_FORMAT>(AR_TEMPL_TRACKER::getBitsPerPixel()); }
00158 int getNumLoadablePatterns() const { return AR_TEMPL_TRACKER::getNumLoadablePatterns(); }
00159 void setImageProcessingMode(IMAGE_PROC_MODE nMode) { AR_TEMPL_TRACKER::setImageProcessingMode(nMode); }
00160 Profiler& getProfiler() { return AR_TEMPL_TRACKER::getProfiler(); }
00161 Camera* getCamera() { return AR_TEMPL_TRACKER::getCamera(); }
00162 void setCamera(Camera* nCamera) { AR_TEMPL_TRACKER::setCamera(nCamera); }
00163 void setCamera(Camera* nCamera, ARFloat nNearClip, ARFloat nFarClip) { AR_TEMPL_TRACKER::setCamera(nCamera, nNearClip, nFarClip); }
00164 ARFloat calcOpenGLMatrixFromMarker(ARMarkerInfo* nMarkerInfo, ARFloat nPatternCenter[2], ARFloat nPatternSize, ARFloat *nOpenGLMatrix) { return AR_TEMPL_TRACKER::calcOpenGLMatrixFromMarker(nMarkerInfo, nPatternCenter, nPatternSize, nOpenGLMatrix); }
00165 ARFloat executeSingleMarkerPoseEstimator(ARMarkerInfo *marker_info, ARFloat center[2], ARFloat width, ARFloat conv[3][4]) { return AR_TEMPL_TRACKER::executeSingleMarkerPoseEstimator(marker_info, center, width, conv); }
00166 ARFloat executeMultiMarkerPoseEstimator(ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config) { return AR_TEMPL_TRACKER::executeMultiMarkerPoseEstimator(marker_info, marker_num, config); }
00167
00168 static void* operator new(size_t size);
00169
00170 static void operator delete(void *rawMemory);
00171
00172 static size_t getMemoryRequirements();
00173
00174 protected:
00175 int numDetected;
00176 bool useDetectLite;
00177
00178 ARMultiMarkerInfoT *config;
00179
00180 int detectedMarkerIDs[AR_TEMPL_TRACKER::MAX_IMAGE_PATTERNS];
00181 ARMarkerInfo detectedMarkers[AR_TEMPL_TRACKER::MAX_IMAGE_PATTERNS];
00182 };
00183
00184
00185 };
00186
00187
00188 #include "../src/TrackerMultiMarkerImpl.cxx"
00189
00190
00191 #endif //__ARTOOLKITPLUS_TRACKERMULTIMARKERIMPL_HEADERFILE__