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_TRACKERSINGLEMARKERIMPL_HEADERFILE__
00042 #define __ARTOOLKITPLUS_TRACKERSINGLEMARKERIMPL_HEADERFILE__
00043
00044
00045
00046
00047 #include <ARToolKitPlus/TrackerSingleMarker.h>
00048 #include <ARToolKitPlus/TrackerImpl.h>
00049 #include <ARToolKitPlus/Logger.h>
00050
00051
00052 #define ARSM_TEMPL_FUNC template <int __PATTERN_SIZE_X, int __PATTERN_SIZE_Y, int __PATTERN_SAMPLE_NUM, int __MAX_LOAD_PATTERNS, int __MAX_IMAGE_PATTERNS>
00053 #define ARSM_TEMPL_TRACKER TrackerSingleMarkerImpl<__PATTERN_SIZE_X, __PATTERN_SIZE_Y, __PATTERN_SAMPLE_NUM, __MAX_LOAD_PATTERNS, __MAX_IMAGE_PATTERNS>
00054
00055
00056 namespace ARToolKitPlus
00057 {
00058
00059
00061
00070 template <int __PATTERN_SIZE_X, int __PATTERN_SIZE_Y, int __PATTERN_SAMPLE_NUM, int __MAX_LOAD_PATTERNS=32, int __MAX_IMAGE_PATTERNS=32>
00071 class TrackerSingleMarkerImpl : public TrackerSingleMarker, protected TrackerImpl<__PATTERN_SIZE_X,__PATTERN_SIZE_Y, __PATTERN_SAMPLE_NUM, __MAX_LOAD_PATTERNS, __MAX_IMAGE_PATTERNS>
00072 {
00073 public:
00074 TrackerSingleMarkerImpl(int nWidth=DEF_CAMWIDTH, int nHeight=DEF_CAMHEIGHT);
00075 ~TrackerSingleMarkerImpl();
00076
00078
00082 virtual bool init(const char* nCamParamFile, ARFloat nNearClip, ARFloat nFarClip, ARToolKitPlus::Logger* nLogger=NULL);
00083 virtual bool init(Camera* camera, ARFloat nNearClip, ARFloat nFarClip, ARToolKitPlus::Logger* nLogger=NULL);
00084
00086
00089 virtual int addPattern(const char* nFileName);
00090
00092
00097 virtual int calc(const unsigned char* nImage, int nPattern=-1, bool nUpdateMatrix=true,
00098 ARMarkerInfo** nMarker_info=NULL, int* nNumMarkers=NULL);
00099
00101 virtual void setPatternWidth(ARFloat nWidth) { patt_width = nWidth; }
00102
00104
00110 virtual void getARMatrix(ARFloat nMatrix[3][4]) const;
00111
00113 virtual ARFloat getConfidence() const { return confidence; }
00114
00115
00116
00117
00118
00119
00120
00121 void cleanup() { AR_TEMPL_TRACKER::cleanup(); }
00122 bool setPixelFormat(PIXEL_FORMAT nFormat) { return AR_TEMPL_TRACKER::setPixelFormat(nFormat); }
00123 bool loadCameraFile(const char* nCamParamFile, ARFloat nNearClip, ARFloat nFarClip) { return AR_TEMPL_TRACKER::loadCameraFile(nCamParamFile, nNearClip, nFarClip); }
00124 void setLoadUndistLUT(bool nSet) { AR_TEMPL_TRACKER::setLoadUndistLUT(nSet); }
00125 void setLogger(ARToolKitPlus::Logger* nLogger) { AR_TEMPL_TRACKER::setLogger(nLogger); }
00126 int arDetectMarker(ARUint8 *dataPtr, int thresh, ARMarkerInfo **marker_info, int *marker_num) { return AR_TEMPL_TRACKER::arDetectMarker(dataPtr, thresh, marker_info, marker_num); }
00127 int arDetectMarkerLite(ARUint8 *dataPtr, int thresh, ARMarkerInfo **marker_info, int *marker_num) { return AR_TEMPL_TRACKER::arDetectMarkerLite(dataPtr, thresh, marker_info, marker_num); }
00128 ARFloat arMultiGetTransMat(ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config) { return AR_TEMPL_TRACKER::arMultiGetTransMat(marker_info, marker_num, config); }
00129 ARFloat arGetTransMat(ARMarkerInfo *marker_info, ARFloat center[2], ARFloat width, ARFloat conv[3][4]) { return AR_TEMPL_TRACKER::arGetTransMat(marker_info, center, width, conv); }
00130 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); }
00131 ARFloat rppMultiGetTransMat(ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config) { return AR_TEMPL_TRACKER::rppMultiGetTransMat(marker_info, marker_num, config); }
00132 ARFloat rppGetTransMat(ARMarkerInfo *marker_info, ARFloat center[2], ARFloat width, ARFloat conv[3][4]) { return AR_TEMPL_TRACKER::rppGetTransMat(marker_info, center, width, conv); }
00133 int arLoadPatt(char *filename) { return AR_TEMPL_TRACKER::arLoadPatt(filename); }
00134 int arFreePatt(int patno) { return AR_TEMPL_TRACKER::arFreePatt(patno); }
00135 int arMultiFreeConfig(ARMultiMarkerInfoT *config) { return AR_TEMPL_TRACKER::arMultiFreeConfig(config); }
00136 ARMultiMarkerInfoT *arMultiReadConfigFile(const char *filename) { return AR_TEMPL_TRACKER::arMultiReadConfigFile(filename); }
00137 void activateBinaryMarker(int nThreshold) { AR_TEMPL_TRACKER::activateBinaryMarker(nThreshold); }
00138 void setMarkerMode(MARKER_MODE nMarkerMode) { AR_TEMPL_TRACKER::setMarkerMode(nMarkerMode); }
00139 void activateVignettingCompensation(bool nEnable, int nCorners=0, int nLeftRight=0, int nTopBottom=0) { AR_TEMPL_TRACKER::activateVignettingCompensation(nEnable, nCorners, nLeftRight, nTopBottom); }
00140 void changeCameraSize(int nWidth, int nHeight) { AR_TEMPL_TRACKER::changeCameraSize(nWidth, nHeight); }
00141 void setUndistortionMode(UNDIST_MODE nMode) { AR_TEMPL_TRACKER::setUndistortionMode(nMode); }
00142 bool setPoseEstimator(POSE_ESTIMATOR nMethod) { return AR_TEMPL_TRACKER::setPoseEstimator(nMethod); }
00143 void setBorderWidth(ARFloat nFraction) { AR_TEMPL_TRACKER::setBorderWidth(nFraction); }
00144 void setThreshold(int nValue) { AR_TEMPL_TRACKER::setThreshold(nValue); }
00145 int getThreshold() const { return AR_TEMPL_TRACKER::getThreshold(); }
00146 void activateAutoThreshold(bool nEnable) { AR_TEMPL_TRACKER::activateAutoThreshold(nEnable); }
00147 bool isAutoThresholdActivated() const { return AR_TEMPL_TRACKER::isAutoThresholdActivated(); }
00148 void setNumAutoThresholdRetries(int nNumRetries) { AR_TEMPL_TRACKER::setNumAutoThresholdRetries(nNumRetries); }
00149 const ARFloat* getModelViewMatrix() const { return AR_TEMPL_TRACKER::getModelViewMatrix(); }
00150 const ARFloat* getProjectionMatrix() const { return AR_TEMPL_TRACKER::getProjectionMatrix(); }
00151 const char* getDescription() { return AR_TEMPL_TRACKER::getDescription(); }
00152 PIXEL_FORMAT getPixelFormat() const { return static_cast<PIXEL_FORMAT>(AR_TEMPL_TRACKER::getPixelFormat()); }
00153 int getBitsPerPixel() const { return static_cast<PIXEL_FORMAT>(AR_TEMPL_TRACKER::getBitsPerPixel()); }
00154 int getNumLoadablePatterns() const { return AR_TEMPL_TRACKER::getNumLoadablePatterns(); }
00155 void setImageProcessingMode(IMAGE_PROC_MODE nMode) { AR_TEMPL_TRACKER::setImageProcessingMode(nMode); }
00156 Profiler& getProfiler() { return AR_TEMPL_TRACKER::getProfiler(); }
00157 Camera* getCamera() { return AR_TEMPL_TRACKER::getCamera(); }
00158 void setCamera(Camera* nCamera) { AR_TEMPL_TRACKER::setCamera(nCamera); }
00159 void setCamera(Camera* nCamera, ARFloat nNearClip, ARFloat nFarClip) { AR_TEMPL_TRACKER::setCamera(nCamera, nNearClip, nFarClip); }
00160 ARFloat calcOpenGLMatrixFromMarker(ARMarkerInfo* nMarkerInfo, ARFloat nPatternCenter[2], ARFloat nPatternSize, ARFloat *nOpenGLMatrix) { return AR_TEMPL_TRACKER::calcOpenGLMatrixFromMarker(nMarkerInfo, nPatternCenter, nPatternSize, nOpenGLMatrix); }
00161 ARFloat executeSingleMarkerPoseEstimator(ARMarkerInfo *marker_info, ARFloat center[2], ARFloat width, ARFloat conv[3][4]) { return AR_TEMPL_TRACKER::executeSingleMarkerPoseEstimator(marker_info, center, width, conv); }
00162 ARFloat executeMultiMarkerPoseEstimator(ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config) { return AR_TEMPL_TRACKER::executeMultiMarkerPoseEstimator(marker_info, marker_num, config); }
00163
00164
00165 static void* operator new(size_t size);
00166
00167 static void operator delete(void *rawMemory);
00168
00169 static size_t getMemoryRequirements();
00170
00171 protected:
00172 ARFloat confidence;
00173 ARFloat patt_width;
00174 ARFloat patt_center[2];
00175 ARFloat patt_trans[3][4];
00176 };
00177
00178
00179 }
00180
00181 #include "../src/TrackerSingleMarkerImpl.cxx"
00182
00183
00184 #endif //__ARTOOLKITPLUS_TRACKERSINGLEMARKERIMPL_HEADERFILE__