TrackerImpl.h
Go to the documentation of this file.
1 /* ========================================================================
2 * PROJECT: ARToolKitPlus
3 * ========================================================================
4 * This work is based on the original ARToolKit developed by
5 * Hirokazu Kato
6 * Mark Billinghurst
7 * HITLab, University of Washington, Seattle
8 * http://www.hitl.washington.edu/artoolkit/
9 *
10 * Copyright of the derived and new portions of this work
11 * (C) 2006 Graz University of Technology
12 *
13 * This framework is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This framework is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this framework; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 *
27 * For further information please contact
28 * Dieter Schmalstieg
29 * <schmalstieg@icg.tu-graz.ac.at>
30 * Graz University of Technology,
31 * Institut for Computer Graphics and Vision,
32 * Inffeldgasse 16a, 8010 Graz, Austria.
33 * ========================================================================
34 ** @author Daniel Wagner
35 *
36 * $Id: TrackerImpl.h 172 2006-07-25 14:05:47Z daniel $
37 * @file
38 * ======================================================================== */
39 
40 
41 #ifndef __ARTOOLKIT_TRACKERIMPL_HEADERFILE__
42 #define __ARTOOLKIT_TRACKERIMPL_HEADERFILE__
43 
44 
45 #include <ARToolKitPlus/ar.h>
46 #include <ARToolKitPlus/arMulti.h>
47 #include <ARToolKitPlus/matrix.h>
48 #include <ARToolKitPlus/Tracker.h>
50 #include <ARToolKitPlus/Camera.h>
53 
54 
55 #if defined(_MSC_VER)
56 # if _MSC_VER<1300
57 # define _OLD_MSCOMPILER_
58 # pragma message (">>> Compiling for old MS Compiler")
59 # endif
60 #endif
61 
62 
63 #define AR_TEMPL_FUNC template <int __PATTERN_SIZE_X, int __PATTERN_SIZE_Y, int __PATTERN_SAMPLE_NUM, int __MAX_LOAD_PATTERNS, int __MAX_IMAGE_PATTERNS>
64 #define AR_TEMPL_TRACKER TrackerImpl<__PATTERN_SIZE_X, __PATTERN_SIZE_Y, __PATTERN_SAMPLE_NUM, __MAX_LOAD_PATTERNS, __MAX_IMAGE_PATTERNS>
65 
66 
67 namespace ARToolKitPlus {
68 
69 
70 // Compile time information...
71 //
72 static bool usesSinglePrecision();
73 //const char* getDescriptionString(); /// Returns a short description string about compile time settings
74 
75 #ifndef _ARTKP_NO_MEMORYMANAGER_
76 extern MemoryManager* memManager;
77 #endif //_ARTKP_NO_MEMORYMANAGER_
78 
79 void artkp_Free(void* nRawMemory);
80 
81 template<class T> T* artkp_Alloc(size_t size)
82 {
83 #ifndef _ARTKP_NO_MEMORYMANAGER_
84  if(memManager)
85  return (T*)memManager->getMemory(size*sizeof(T));
86  else
87 #endif //_ARTKP_NO_MEMORYMANAGER_
88  return (T*)::malloc(size*sizeof(T));
89 }
90 
91 
93 template <int __PATTERN_SIZE_X, int __PATTERN_SIZE_Y, int __PATTERN_SAMPLE_NUM, int __MAX_LOAD_PATTERNS, int __MAX_IMAGE_PATTERNS>
94 class TrackerImpl : public Tracker
95 {
96 public:
97  enum {
98  PATTERN_WIDTH = __PATTERN_SIZE_X,
99  PATTERN_HEIGHT = __PATTERN_SIZE_Y,
100  PATTERN_SAMPLE_NUM = __PATTERN_SAMPLE_NUM,
101 
102  MAX_LOAD_PATTERNS = __MAX_LOAD_PATTERNS,
103  MAX_IMAGE_PATTERNS = __MAX_IMAGE_PATTERNS,
105 
106 #ifdef SMALL_LUM8_TABLE
107  LUM_TABLE_SIZE = (0xffff >> 6) + 1,
108 #else
109  LUM_TABLE_SIZE = 0xffff + 1,
110 #endif
111  };
112 
113 
114  TrackerImpl();
115  virtual ~TrackerImpl();
116 
118  virtual void cleanup();
119 
120 
122 
125  virtual bool setPixelFormat(PIXEL_FORMAT nFormat);
126 
128 
135  virtual bool loadCameraFile(const char* nCamParamFile, ARFloat nNearClip, ARFloat nFarClip);
136 
137  virtual void setLoadUndistLUT(bool nSet) { loadCachedUndist = nSet; }
138 
140  virtual void setLogger(ARToolKitPlus::Logger* nLogger) { logger = nLogger; }
141 
143  virtual int arDetectMarker(ARUint8 *dataPtr, int thresh, ARMarkerInfo **marker_info, int *marker_num);
144 
146  virtual int arDetectMarkerLite(ARUint8 *dataPtr, int thresh, ARMarkerInfo **marker_info, int *marker_num);
147 
149  virtual ARFloat arMultiGetTransMat(ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config);
150 
152  virtual ARFloat arGetTransMat(ARMarkerInfo *marker_info, ARFloat center[2], ARFloat width, ARFloat conv[3][4]);
153 
154  virtual ARFloat arGetTransMatCont(ARMarkerInfo *marker_info, ARFloat prev_conv[3][4], ARFloat center[2], ARFloat width, ARFloat conv[3][4]);
155 
156  // RPP integration -- [t.pintaric]
157  virtual ARFloat rppMultiGetTransMat(ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config);
158  virtual ARFloat rppGetTransMat(ARMarkerInfo *marker_info, ARFloat center[2], ARFloat width, ARFloat conv[3][4]);
159 
161  virtual int arLoadPatt(char *filename);
162 
164  virtual int arFreePatt(int patno);
165 
166  virtual int arMultiFreeConfig( ARMultiMarkerInfoT *config );
167 
168  virtual ARMultiMarkerInfoT *arMultiReadConfigFile(const char *filename);
169 
170  virtual void activateBinaryMarker(int nThreshold) { binaryMarkerThreshold = nThreshold; }
171 
173 
177  virtual void setMarkerMode(MARKER_MODE nMarkerMode);
178 
179 
181 
192  virtual void activateVignettingCompensation(bool nEnable, int nCorners=0, int nLeftRight=0, int nTopBottom=0);
193 
194 
196 
201  static bool calcCameraMatrix(const char* nCamParamFile, int nWidth, int nHeight,
202  ARFloat nNear, ARFloat nFar, ARFloat *nMatrix);
203 
204 
206  virtual void changeCameraSize(int nWidth, int nHeight);
207 
208 
210 
214  virtual void setUndistortionMode(UNDIST_MODE nMode);
215 
217 
221  virtual bool setPoseEstimator(POSE_ESTIMATOR nMethod);
222 
224 
230  virtual void setBorderWidth(ARFloat nFraction) { relBorderWidth = nFraction; }
231 
232 
234  virtual void setThreshold(int nValue) { thresh = nValue; }
235 
236 
238  virtual int getThreshold() const { return thresh; }
239 
240 
242  virtual void activateAutoThreshold(bool nEnable) { autoThreshold.enable = nEnable; }
243 
244 
246  virtual bool isAutoThresholdActivated() const { return autoThreshold.enable; }
247 
249 
258  virtual void setNumAutoThresholdRetries(int nNumRetries) { autoThreshold.numRandomRetries = nNumRetries>=1 ? nNumRetries : 1; }
259 
260 
262 
268 
269 
271  virtual const ARFloat* getModelViewMatrix() const { return gl_para; }
272 
273 
275  virtual const ARFloat* getProjectionMatrix() const { return gl_cpara; }
276 
277 
279  virtual const char* getDescription();
280 
281 
283  virtual PIXEL_FORMAT getPixelFormat() const { return static_cast<PIXEL_FORMAT>(pixelFormat); }
284 
285 
287  virtual int getBitsPerPixel() const { return pixelSize*8; }
288 
289 
291  virtual int getNumLoadablePatterns() const { return MAX_LOAD_PATTERNS; }
292 
293 
295  virtual Camera* getCamera() { return arCamera; }
296 
297 
299  virtual void setCamera(Camera* nCamera);
300 
301 
303  virtual void setCamera(Camera* nCamera, ARFloat nNearClip, ARFloat nFarClip);
304 
305 
306  virtual ARFloat calcOpenGLMatrixFromMarker(ARMarkerInfo* nMarkerInfo, ARFloat nPatternCenter[2], ARFloat nPatternSize, ARFloat *nOpenGLMatrix);
307 
308 
309  virtual ARFloat executeSingleMarkerPoseEstimator(ARMarkerInfo *marker_info, ARFloat center[2], ARFloat width, ARFloat conv[3][4]);
310 
311 
312  virtual ARFloat executeMultiMarkerPoseEstimator(ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config);
313 
314 
315 
316 protected:
317  bool checkPixelFormat();
318 
319  void checkImageBuffer();
320 
321  //static int arParamChangeSize( ARParam *source, int xsize, int ysize, ARParam *newparam );
322 
323  //static int arParamSave( char *filename, int num, ARParam *param, ...);
324  //static int arParamLoad( char *filename, int num, ARParam *param, ...);
325 
326  // converts an ARToolKit transformation matrix for usage with OpenGL
328 
329  // converts an ARToolKit projection matrix for usage with OpenGL
330  static bool convertProjectionMatrixToOpenGLStyle(ARParam *param, ARFloat gnear, ARFloat gfar, ARFloat m[16]);
331  static bool convertProjectionMatrixToOpenGLStyle2(ARFloat cparam[3][4], int width, int height, ARFloat gnear, ARFloat gfar, ARFloat m[16]);
332 
333 
334  ARMarkerInfo2* arDetectMarker2(ARInt16 *limage, int label_num, int *label_ref,
335  int *warea, ARFloat *wpos, int *wclip,
336  int area_max, int area_min, ARFloat factor, int *marker_num);
337 
338  int arGetContour(ARInt16 *limage, int *label_ref, int label, int clip[4], ARMarkerInfo2 *marker_infoTWO);
339 
340  int check_square(int area, ARMarkerInfo2 *marker_infoTWO, ARFloat factor);
341 
342  int arGetCode(ARUint8 *image, int *x_coord, int *y_coord, int *vertex,
343  int *code, int *dir, ARFloat *cf, int thresh);
344 
345  int arGetPatt(ARUint8 *image, int *x_coord, int *y_coord, int *vertex,
346  ARUint8 ext_pat[PATTERN_HEIGHT][PATTERN_WIDTH][3]);
347 
348  int pattern_match( ARUint8 *data, int *code, int *dir, ARFloat *cf);
349 
350  int downsamplePattern(ARUint8* data, unsigned char* imgPtr);
351 
352  int bitfield_check_simple(ARUint8 *data, int *code, int *dir, ARFloat *cf, int thresh);
353 
354  int bitfield_check_BCH(ARUint8 *data, int *code, int *dir, ARFloat *cf, int thresh);
355 
356  void gen_evec(void);
357 
358  ARMarkerInfo* arGetMarkerInfo(ARUint8 *image, ARMarkerInfo2 *marker_info2, int *marker_num, int thresh);
359 
360  ARFloat arGetTransMat2(ARFloat rot[3][3], ARFloat ppos2d[][2], ARFloat ppos3d[][2], int num, ARFloat conv[3][4]);
361 
362 
363  ARFloat arGetTransMat4(ARFloat rot[3][3], ARFloat ppos2d[][2], ARFloat ppos3d[][3], int num, ARFloat conv[3][4]);
364 
365  ARFloat arGetTransMat5(ARFloat rot[3][3], ARFloat ppos2d[][2],
366  ARFloat ppos3d[][3], int num, ARFloat conv[3][4],
367  Camera *pCam);
368  //ARFloat *dist_factor, ARFloat cpara[3][4]);
369 
370  ARFloat arGetTransMatSub(ARFloat rot[3][3], ARFloat ppos2d[][2],
371  ARFloat pos3d[][3], int num, ARFloat conv[3][4],
372  Camera *pCam);
373  //ARFloat *dist_factor, ARFloat cpara[3][4] );
374 
375  ARFloat arModifyMatrix(ARFloat rot[3][3], ARFloat trans[3], ARFloat cpara[3][4],
376  ARFloat vertex[][3], ARFloat pos2d[][2], int num);
377 
378  ARFloat arModifyMatrix2(ARFloat rot[3][3], ARFloat trans[3], ARFloat cpara[3][4],
379  ARFloat vertex[][3], ARFloat pos2d[][2], int num);
380 
381  int arGetAngle(ARFloat rot[3][3], ARFloat *wa, ARFloat *wb, ARFloat *wc);
382 
383  int arGetRot(ARFloat a, ARFloat b, ARFloat c, ARFloat rot[3][3]);
384 
386  ARFloat trans[3], ARFloat trans2[3][4],
387  ARFloat cpara[3][4], ARFloat ret[3][4]);
388 
389  int arGetInitRot(ARMarkerInfo *marker_info, ARFloat cpara[3][4], ARFloat rot[3][3]);
390 
391 
392  ARFloat arGetTransMatCont2(ARMarkerInfo *marker_info, ARFloat center[2], ARFloat width, ARFloat conv[3][4]);
393 
394  ARFloat arGetTransMatContSub(ARMarkerInfo *marker_info, ARFloat prev_conv[3][4], ARFloat center[2], ARFloat width, ARFloat conv[3][4]);
395 
396 
397 
398  ARInt16* arLabeling(ARUint8 *image, int thresh,int *label_num, int **area,
399  ARFloat **pos, int **clip, int **label_ref );
400 
401 
402  ARInt16* arLabeling_ABGR(ARUint8 *image, int thresh,int *label_num, int **area, ARFloat **pos, int **clip, int **label_ref);
403  ARInt16* arLabeling_BGR(ARUint8 *image, int thresh,int *label_num, int **area, ARFloat **pos, int **clip, int **label_ref);
404  ARInt16* arLabeling_RGB(ARUint8 *image, int thresh,int *label_num, int **area, ARFloat **pos, int **clip, int **label_ref);
405  ARInt16* arLabeling_RGB565(ARUint8 *image, int thresh,int *label_num, int **area, ARFloat **pos, int **clip, int **label_ref);
406  ARInt16* arLabeling_LUM(ARUint8 *image, int thresh,int *label_num, int **area, ARFloat **pos, int **clip, int **label_ref);
407 
408  //ARInt16* labeling2(ARUint8 *image, int thresh,int *label_num, int **area,
409  // ARFloat **pos, int **clip, int **label_ref, int LorR );
410 
411  //ARInt16* labeling3(ARUint8 *image, int thresh, int *label_num, int **area,
412  // ARFloat **pos, int **clip, int **label_ref, int LorR );
413 
414 
415  int arActivatePatt(int patno);
416 
417  int arDeactivatePatt(int patno);
418 
419  int arMultiActivate(ARMultiMarkerInfoT *config);
420 
421  int arMultiDeactivate( ARMultiMarkerInfoT *config );
422 
423  int verify_markers(ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config);
424 
425  int arInitCparam( Camera *pCam );
426 
427  int arGetLine(int x_coord[], int y_coord[], int coord_num, int vertex[], ARFloat line[4][3], ARFloat v[4][2]);
428 
429  int arGetLine2(int x_coord[], int y_coord[], int coord_num, int vertex[], ARFloat line[4][3], ARFloat v[4][2], Camera *pCam);
430 
431  static int arUtilMatMul(ARFloat s1[3][4], ARFloat s2[3][4], ARFloat d[3][4]);
432 
433  static int arUtilMatInv(ARFloat s[3][4], ARFloat d[3][4]);
434 
435  static int arMatrixPCA(ARMat *input, ARMat *evec, ARVec *ev, ARVec *mean);
436 
437  static int arMatrixPCA2(ARMat *input, ARMat *evec, ARVec *ev);
438 
439  static int arParamSaveDouble(char *filename, int num, ARParamDouble *param, ...);
440 
441  static int arParamLoadDouble(char *filename, int num, ARParamDouble *param, ...);
442 
443  static int arParamDecomp(ARParam *source, ARParam *icpara, ARFloat trans[3][4]);
444 
445  static int arParamDecompMat(ARFloat source[3][4], ARFloat cpara[3][4], ARFloat trans[3][4]);
446 
447  int arParamObserv2Ideal_none(Camera* pCam, ARFloat ox, ARFloat oy, ARFloat *ix, ARFloat *iy);
448 
449  int arParamObserv2Ideal_LUT(Camera* pCam, ARFloat ox, ARFloat oy, ARFloat *ix, ARFloat *iy);
450 
451  int arParamObserv2Ideal_std(Camera* pCam, ARFloat ox, ARFloat oy, ARFloat *ix, ARFloat *iy);
452  int arParamIdeal2Observ_std(Camera* pCam, ARFloat ix, ARFloat iy, ARFloat *ox, ARFloat *oy);
453 
454  typedef int (TrackerImpl::* ARPARAM_UNDIST_FUNC)(Camera* pCam, ARFloat ox, ARFloat oy, ARFloat *ix, ARFloat *iy);
455 
456  typedef ARFloat (TrackerImpl::* POSE_ESTIMATOR_FUNC)(ARMarkerInfo *marker_info, ARFloat center[2], ARFloat width, ARFloat conv[3][4]);
457  typedef ARFloat (TrackerImpl::* MULTI_POSE_ESTIMATOR_FUNC)(ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config);
458 
459  void buildUndistO2ITable(Camera* pCam);
460 
461  void checkRGB565LUT();
462 
463  // calculates amount of data that will be allocated via artkp_Alloc()
464  static size_t getDynamicMemoryRequirements();
465 
467 
468 
469 public:
470  static void* operator new(size_t size);
471 
472  static void operator delete(void *rawMemory);
473 
474 
475  // required for calib camera, should otherwise not be used directly
476  //
477  void setFittingMode(int nWhich) { arFittingMode = nWhich; }
478 
479  ARFloat arGetTransMat3(ARFloat rot[3][3], ARFloat ppos2d[][2],
480  ARFloat ppos3d[][2], int num, ARFloat conv[3][4],
481  Camera *pCam);
482 
483  static int arParamObserv2Ideal(Camera *pCam, ARFloat ox, ARFloat oy, ARFloat *ix, ARFloat *iy);
484  static int arParamIdeal2Observ(Camera *pCam, ARFloat ix, ARFloat iy, ARFloat *ox, ARFloat *oy);
485 
486 
487 protected:
488  //int refineCorner(ARFloat &edge_x, ARFloat &edge_y, const ARFloat old_edge_x, const ARFloat old_edge_y, const int roi_radius,
489  // const void* img_ptr, const int img_width, const int img_height);
490 
491  struct AutoThreshold {
492  enum {
493  MINLUM0 = 255,
495  };
496 
497  void reset()
498  {
500  }
501 
502  void addValue(int nRed, int nGreen, int nBlue, int nPixelFormat)
503  {
504  int lum;
505 
506  // in RGB565 and LUM8 all three values are simply the grey value...
507  if(nPixelFormat==PIXEL_FORMAT_RGB565 || nPixelFormat==PIXEL_FORMAT_LUM)
508  lum = nRed;
509  else
510  lum = (nRed + (nGreen<<1) + nBlue)>>2;
511 
512  if(lum<minLum)
513  minLum = lum;
514  if(lum>maxLum)
515  maxLum = lum;
516  }
517 
518  int calc()
519  {
520  return (minLum+maxLum)/2;
521  }
522 
523  bool enable;
526  } autoThreshold;
527 
528 
531 
533 
534  // arDetectMarker.cpp
535  //
539 
541  int prev_num;
542 
544  int sprev_num[2];
545 
546  // arDetectMarker2.cpp
547  //
548  ARMarkerInfo2 *marker_infoTWO; // CAUTION: this member has to be manually allocated!
549  // see TrackerSingleMarker for more info on this.
550 
553 
554 
555  // arGetCode.cpp
558  int pat[MAX_LOAD_PATTERNS][4][PATTERN_HEIGHT*PATTERN_WIDTH*3];
560  int patBW[MAX_LOAD_PATTERNS][4][PATTERN_HEIGHT*PATTERN_WIDTH*3];
562 
563  ARFloat evec[EVEC_MAX][PATTERN_HEIGHT*PATTERN_WIDTH*3];
565  int evec_dim;
566  int evecf;
570  int evecBWf;
571 
572  // arGetMarkerInfo.cpp
573  //
575 
576  // arGetTransMat.cpp
577  //
578  ARFloat pos2d[P_MAX][2];
579  ARFloat pos3d[P_MAX][3];
580 
581  // arLabeling.cpp
582  //
583  ARInt16 *l_imageL; //[HARDCODED_BUFFER_WIDTH*HARDCODED_BUFFER_HEIGHT]; // dyna
586 
587  int *workL; //[WORK_SIZE]; // dyna
588  int *work2L; //[WORK_SIZE*7]; // dyna
589 
590  int *workR;
591  int *work2R;
592  int *wareaR;
593  int *wclipR;
595 
598  int *wareaL; //[WORK_SIZE]; // dyna
599  int *wclipL; //[WORK_SIZE*4]; // dyna
600  ARFloat *wposL; //[WORK_SIZE*2]; // dyna
601 
609 
611 
613 
614  unsigned char *RGB565_to_LUM8_LUT; // lookup table for RGB565 to LUM8 conversion
615 
616 
617  // camera distortion addon by Daniel
618  //
620  unsigned int *undistO2ITable;
621  //unsigned int *undistI2OTable;
622 
623 
625 
627  //ARPARAM_UNDIST_FUNC arParamIdeal2Observ_func;
628 
629  // RPP integration -- [t.pintaric]
631  //POSE_ESTIMATOR_FUNC poseEstimator_func;
632  //MULTI_POSE_ESTIMATOR_FUNC multiPoseEstimator_func;
633 
635 
637  int thresh;
638 
640 
641  ARFloat gl_para[16];
643 
645 
646  struct {
647  bool enabled;
649  } vignetting;
650 
653 };
654 
655 
656 } // namespace ARToolKitPlus
657 
658 
659 
660 // this is templated code, so we need to include all this here...
661 //
662 #include "../../src/extra/FixedPoint.h"
663 #include "../../src/core/arBitFieldPattern.cxx"
664 #include "../../src/core/arDetectMarker.cxx"
665 #include "../../src/core/arDetectMarker2.cxx"
666 #include "../../src/core/arGetCode.cxx"
667 #include "../../src/core/arGetMarkerInfo.cxx"
668 #include "../../src/core/arGetTransMat.cxx"
669 #include "../../src/core/arGetTransMat2.cxx"
670 #include "../../src/core/arGetTransMat3.cxx"
671 #include "../../src/core/rppGetTransMat.cxx" // RPP integration -- [t.pintaric]
672 #include "../../src/core/arGetTransMatCont.cxx"
673 #include "../../src/core/arLabeling.cxx"
674 #include "../../src/core/arMultiActivate.cxx"
675 #include "../../src/core/arMultiGetTransMat.cxx"
676 #include "../../src/core/rppMultiGetTransMat.cxx" // RPP integration -- [t.pintaric]
677 #include "../../src/core/arMultiReadConfigFile.cxx"
678 #include "../../src/core/arUtil.cxx"
679 #include "../../src/core/matrix.cxx"
680 #include "../../src/core/mPCA.cxx"
681 //#include "../../src/core/paramChangeSize.cxx"
682 #include "../../src/core/paramDecomp.cxx"
683 #include "../../src/core/paramDistortion.cxx"
684 #include "../../src/core/byteSwap.cxx"
685 #include "../../src/core/paramFile.cxx"
686 #include "../../src/core/vector.cxx"
687 
688 #include "../../src/CameraImpl.cxx"
689 #include "../../src/CameraAdvImpl.cxx"
690 #include "../../src/CameraFactory.cxx"
691 #include "../../src/extra/BCH.cxx"
692 
693 #include "../../src/TrackerImpl.cxx"
694 //#include "../../src/extra/harrisCornerDetector.cxx"
695 //#include "../../src/extra/cornerRefinement.cxx"
696 
697 
698 #endif //__ARTOOLKIT_TRACKERIMPL_HEADERFILE__
d
ARMarkerInfo * wmarker_info
Definition: TrackerImpl.h:537
static int arParamLoadDouble(char *filename, int num, ARParamDouble *param,...)
static int arMatrixPCA(ARMat *input, ARMat *evec, ARVec *ev, ARVec *mean)
virtual PIXEL_FORMAT getPixelFormat() const
Returns the compiled-in pixel format.
Definition: TrackerImpl.h:283
ARFloat epat[MAX_LOAD_PATTERNS][4][EVEC_MAX]
Definition: TrackerImpl.h:564
int arActivatePatt(int patno)
ARFloat pos3d[P_MAX][3]
Definition: TrackerImpl.h:579
virtual ARMultiMarkerInfoT * arMultiReadConfigFile(const char *filename)
reads a standard artoolkit multimarker config file
filename
bool param(const std::string &param_name, T &param_val, const T &default_val)
static int arUtilMatInv(ARFloat s[3][4], ARFloat d[3][4])
void artkp_Free(void *nRawMemory)
virtual int getThreshold() const
Returns the current threshold value.
Definition: TrackerImpl.h:238
int patBW[MAX_LOAD_PATTERNS][4][PATTERN_HEIGHT *PATTERN_WIDTH *3]
Definition: TrackerImpl.h:560
virtual int getBitsPerPixel() const
Returns the numbber of bits per pixel for the compiled-in pixel format.
Definition: TrackerImpl.h:287
int arGetLine(int x_coord[], int y_coord[], int coord_num, int vertex[], ARFloat line[4][3], ARFloat v[4][2])
virtual bool isAutoThresholdActivated() const
Returns true if automatic threshold detection is enabled.
Definition: TrackerImpl.h:246
virtual void activateBinaryMarker(int nThreshold)
activates binary markers
Definition: TrackerImpl.h:170
int arGetLine2(int x_coord[], int y_coord[], int coord_num, int vertex[], ARFloat line[4][3], ARFloat v[4][2], Camera *pCam)
int arGetPatt(ARUint8 *image, int *x_coord, int *y_coord, int *vertex, ARUint8 ext_pat[PATTERN_HEIGHT][PATTERN_WIDTH][3])
virtual bool setPixelFormat(PIXEL_FORMAT nFormat)
Sets the pixel format of the camera image.
virtual ARFloat rppMultiGetTransMat(ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config)
virtual void setCamera(Camera *nCamera)
Sets a new camera without specifying new near and far clip values.
virtual void setBorderWidth(ARFloat nFraction)
Sets a new relative border width. ARToolKit&#39;s default value is 0.25.
Definition: TrackerImpl.h:230
unsigned int * undistO2ITable
Definition: TrackerImpl.h:620
int arGetCode(ARUint8 *image, int *x_coord, int *y_coord, int *vertex, int *code, int *dir, ARFloat *cf, int thresh)
virtual const ARFloat * getProjectionMatrix() const
Returns an opengl-style projection transformation matrix.
Definition: TrackerImpl.h:275
#define AR_IMAGE_PROC_IN_FULL
Definition: config.h:136
virtual ARFloat arMultiGetTransMat(ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config)
calculates the transformation matrix between camera and the given multi-marker config ...
virtual void setUndistortionMode(UNDIST_MODE nMode)
Changes the undistortion mode.
ARFloat patpow[MAX_LOAD_PATTERNS][4]
Definition: TrackerImpl.h:559
ARPARAM_UNDIST_FUNC arParamObserv2Ideal_func
Definition: TrackerImpl.h:626
ARInt16 * arLabeling(ARUint8 *image, int thresh, int *label_num, int **area, ARFloat **pos, int **clip, int **label_ref)
XmlRpcServer s
int patf[MAX_LOAD_PATTERNS]
Definition: TrackerImpl.h:557
ARFloat(TrackerImpl::* POSE_ESTIMATOR_FUNC)(ARMarkerInfo *marker_info, ARFloat center[2], ARFloat width, ARFloat conv[3][4])
Definition: TrackerImpl.h:456
static int arParamIdeal2Observ(Camera *pCam, ARFloat ix, ARFloat iy, ARFloat *ox, ARFloat *oy)
ARFloat evecBW[EVEC_MAX][PATTERN_HEIGHT *PATTERN_WIDTH *3]
Definition: TrackerImpl.h:567
unsigned char * RGB565_to_LUM8_LUT
Definition: TrackerImpl.h:614
virtual int arLoadPatt(char *filename)
loads a pattern from a file
static bool usesSinglePrecision()
virtual int arDetectMarker(ARUint8 *dataPtr, int thresh, ARMarkerInfo **marker_info, int *marker_num)
marker detection using tracking history
int bitfield_check_simple(ARUint8 *data, int *code, int *dir, ARFloat *cf, int thresh)
int arGetContour_wx[AR_CHAIN_MAX]
Definition: TrackerImpl.h:551
POSE_ESTIMATOR poseEstimator
Definition: TrackerImpl.h:630
static int arMatrixPCA2(ARMat *input, ARMat *evec, ARVec *ev)
ARFloat arGetTransMat3(ARFloat rot[3][3], ARFloat ppos2d[][2], ARFloat ppos3d[][2], int num, ARFloat conv[3][4], Camera *pCam)
virtual int arFreePatt(int patno)
frees a pattern from memory
Tracker is the vision core of ARToolKit.
Definition: Tracker.h:70
virtual void changeCameraSize(int nWidth, int nHeight)
Changes the resolution of the camera after the camerafile was already loaded.
int arInitCparam(Camera *pCam)
void buildUndistO2ITable(Camera *pCam)
ARInt16 * arLabeling_ABGR(ARUint8 *image, int thresh, int *label_num, int **area, ARFloat **pos, int **clip, int **label_ref)
ARFloat arGetTransMatCont2(ARMarkerInfo *marker_info, ARFloat center[2], ARFloat width, ARFloat conv[3][4])
ARMarkerInfo2 * arDetectMarker2(ARInt16 *limage, int label_num, int *label_ref, int *warea, ARFloat *wpos, int *wclip, int area_max, int area_min, ARFloat factor, int *marker_num)
#define EVEC_MAX
Definition: config.h:194
virtual void activateAutoThreshold(bool nEnable)
Turns automatic threshold calculation on/off.
Definition: TrackerImpl.h:242
arPrevInfo sprev_info[2][MAX_IMAGE_PATTERNS]
Definition: TrackerImpl.h:543
static bool convertProjectionMatrixToOpenGLStyle(ARParam *param, ARFloat gnear, ARFloat gfar, ARFloat m[16])
#define AR_CHAIN_MAX
Definition: config.h:173
MemoryManager * memManager
Returns whether single or double precision is used.
virtual int arMultiFreeConfig(ARMultiMarkerInfoT *config)
frees a multimarker config from memory
ARInt16 * arLabeling_RGB565(ARUint8 *image, int thresh, int *label_num, int **area, ARFloat **pos, int **clip, int **label_ref)
ARInt16 * arLabeling_LUM(ARUint8 *image, int thresh, int *label_num, int **area, ARFloat **pos, int **clip, int **label_ref)
ARFloat arGetTransMat2(ARFloat rot[3][3], ARFloat ppos2d[][2], ARFloat ppos3d[][2], int num, ARFloat conv[3][4])
This file should only be compiled when using ARToolKitPlus as a DLL.
Definition: ar.h:60
virtual void setMarkerMode(MARKER_MODE nMarkerMode)
Activate the usage of id-based markers rather than template based markers.
virtual void cleanup()
does final clean up (memory deallocation)
struct ARToolKitPlus::TrackerImpl::@3 vignetting
static int arParamDecompMat(ARFloat source[3][4], ARFloat cpara[3][4], ARFloat trans[3][4])
int bitfield_check_BCH(ARUint8 *data, int *code, int *dir, ARFloat *cf, int thresh)
int arDeactivatePatt(int patno)
static int arUtilMatMul(ARFloat s1[3][4], ARFloat s2[3][4], ARFloat d[3][4])
unsigned char ARUint8
Definition: ar.h:66
int arGetRot(ARFloat a, ARFloat b, ARFloat c, ARFloat rot[3][3])
virtual void activateVignettingCompensation(bool nEnable, int nCorners=0, int nLeftRight=0, int nTopBottom=0)
activates the complensation of brightness falloff in the corners of the camera image ...
virtual const ARFloat * getModelViewMatrix() const
Returns an opengl-style modelview transformation matrix.
Definition: TrackerImpl.h:271
ARMarkerInfo * arGetMarkerInfo(ARUint8 *image, ARMarkerInfo2 *marker_info2, int *marker_num, int thresh)
ARFloat(TrackerImpl::* MULTI_POSE_ESTIMATOR_FUNC)(ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config)
Definition: TrackerImpl.h:457
ARFloat arModifyMatrix(ARFloat rot[3][3], ARFloat trans[3], ARFloat cpara[3][4], ARFloat vertex[][3], ARFloat pos2d[][2], int num)
int verify_markers(ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config)
void setFittingMode(int nWhich)
Definition: TrackerImpl.h:477
int arGetNewMatrix(ARFloat a, ARFloat b, ARFloat c, ARFloat trans[3], ARFloat trans2[3][4], ARFloat cpara[3][4], ARFloat ret[3][4])
ARFloat arGetTransMat4(ARFloat rot[3][3], ARFloat ppos2d[][2], ARFloat ppos3d[][3], int num, ARFloat conv[3][4])
int arGetInitRot(ARMarkerInfo *marker_info, ARFloat cpara[3][4], ARFloat rot[3][3])
static bool convertProjectionMatrixToOpenGLStyle2(ARFloat cparam[3][4], int width, int height, ARFloat gnear, ARFloat gfar, ARFloat m[16])
virtual void setNumAutoThresholdRetries(int nNumRetries)
Sets the number of times the threshold is randomized in case no marker was visible (Minimum: 1...
Definition: TrackerImpl.h:258
ARFloat arGetTransMat5(ARFloat rot[3][3], ARFloat ppos2d[][2], ARFloat ppos3d[][3], int num, ARFloat conv[3][4], Camera *pCam)
int pat[MAX_LOAD_PATTERNS][4][PATTERN_HEIGHT *PATTERN_WIDTH *3]
Definition: TrackerImpl.h:558
virtual void setLogger(ARToolKitPlus::Logger *nLogger)
sets an instance which implements the ARToolKit::Logger interface
Definition: TrackerImpl.h:140
ARFloat epatBW[MAX_LOAD_PATTERNS][4][EVEC_MAX]
Definition: TrackerImpl.h:568
int check_square(int area, ARMarkerInfo2 *marker_infoTWO, ARFloat factor)
int arParamIdeal2Observ_std(Camera *pCam, ARFloat ix, ARFloat iy, ARFloat *ox, ARFloat *oy)
virtual Camera * getCamera()
Returns the current camera.
Definition: TrackerImpl.h:295
ARMarkerInfo2 * marker_info2
Definition: TrackerImpl.h:536
int(TrackerImpl::* ARPARAM_UNDIST_FUNC)(Camera *pCam, ARFloat ox, ARFloat oy, ARFloat *ix, ARFloat *iy)
Definition: TrackerImpl.h:454
T * artkp_Alloc(size_t size)
Definition: TrackerImpl.h:81
ARToolKit::Logger specifies the interface for a logging application.
Definition: Logger.h:61
void addValue(int nRed, int nGreen, int nBlue, int nPixelFormat)
Definition: TrackerImpl.h:502
virtual void setThreshold(int nValue)
Sets the threshold value that is used for black/white conversion.
Definition: TrackerImpl.h:234
ARFloat pos2d[P_MAX][2]
Definition: TrackerImpl.h:578
Profiler & getProfiler()
Returns the internal profiler object.
Definition: TrackerImpl.h:466
virtual ARFloat arGetTransMat(ARMarkerInfo *marker_info, ARFloat center[2], ARFloat width, ARFloat conv[3][4])
calculates the transformation matrix between camera and the given marker
ARFloat evec[EVEC_MAX][PATTERN_HEIGHT *PATTERN_WIDTH *3]
Definition: TrackerImpl.h:563
int arParamObserv2Ideal_std(Camera *pCam, ARFloat ox, ARFloat oy, ARFloat *ix, ARFloat *iy)
int arMultiActivate(ARMultiMarkerInfoT *config)
ARFloat arModifyMatrix2(ARFloat rot[3][3], ARFloat trans[3], ARFloat cpara[3][4], ARFloat vertex[][3], ARFloat pos2d[][2], int num)
static int arParamSaveDouble(char *filename, int num, ARParamDouble *param,...)
virtual void setLoadUndistLUT(bool nSet)
Set to true to try loading camera undistortion table from a cache file.
Definition: TrackerImpl.h:137
ARFloat arGetTransMatSub(ARFloat rot[3][3], ARFloat ppos2d[][2], ARFloat pos3d[][3], int num, ARFloat conv[3][4], Camera *pCam)
int downsamplePattern(ARUint8 *data, unsigned char *imgPtr)
ARMarkerInfo marker_infoL[MAX_IMAGE_PATTERNS]
Definition: TrackerImpl.h:574
static int arParamObserv2Ideal(Camera *pCam, ARFloat ox, ARFloat oy, ARFloat *ix, ARFloat *iy)
ARMarkerInfo2 * marker_infoTWO
Definition: TrackerImpl.h:548
TrackerImpl implements the Tracker interface.
Definition: TrackerImpl.h:94
void convertTransformationMatrixToOpenGLStyle(ARFloat para[3][4], ARFloat gl_para[16])
int arGetContour_wy[AR_CHAIN_MAX]
Definition: TrackerImpl.h:552
ARFloat arGetTransMatContSub(ARMarkerInfo *marker_info, ARFloat prev_conv[3][4], ARFloat center[2], ARFloat width, ARFloat conv[3][4])
int arParamObserv2Ideal_LUT(Camera *pCam, ARFloat ox, ARFloat oy, ARFloat *ix, ARFloat *iy)
static size_t getDynamicMemoryRequirements()
virtual ARFloat executeMultiMarkerPoseEstimator(ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config)
Calls the pose estimator set with setPoseEstimator() for multi marker tracking.
float ARFloat
Definition: config.h:60
virtual ARFloat executeSingleMarkerPoseEstimator(ARMarkerInfo *marker_info, ARFloat center[2], ARFloat width, ARFloat conv[3][4])
Calls the pose estimator set with setPoseEstimator() for single marker tracking.
static int arParamDecomp(ARParam *source, ARParam *icpara, ARFloat trans[3][4])
virtual void setImageProcessingMode(IMAGE_PROC_MODE nMode)
Sets an image processing mode (half or full resolution)
Definition: TrackerImpl.h:267
#define AR_IMAGE_PROC_IN_HALF
Definition: config.h:137
virtual ARFloat arGetTransMatCont(ARMarkerInfo *marker_info, ARFloat prev_conv[3][4], ARFloat center[2], ARFloat width, ARFloat conv[3][4])
virtual int getNumLoadablePatterns() const
Returns the maximum number of patterns that can be loaded.
Definition: TrackerImpl.h:291
short ARInt16
Definition: ar.h:64
int arParamObserv2Ideal_none(Camera *pCam, ARFloat ox, ARFloat oy, ARFloat *ix, ARFloat *iy)
#define P_MAX
Definition: config.h:195
ARFloat patpowBW[MAX_LOAD_PATTERNS][4]
Definition: TrackerImpl.h:561
arPrevInfo prev_info[MAX_IMAGE_PATTERNS]
Definition: TrackerImpl.h:540
int arMultiDeactivate(ARMultiMarkerInfoT *config)
int pattern_match(ARUint8 *data, int *code, int *dir, ARFloat *cf)
virtual ARFloat rppGetTransMat(ARMarkerInfo *marker_info, ARFloat center[2], ARFloat width, ARFloat conv[3][4])
virtual bool loadCameraFile(const char *nCamParamFile, ARFloat nNearClip, ARFloat nFarClip)
Loads a camera calibration file and stores data internally.
virtual int arDetectMarkerLite(ARUint8 *dataPtr, int thresh, ARMarkerInfo **marker_info, int *marker_num)
marker detection without using tracking history
int arGetContour(ARInt16 *limage, int *label_ref, int label, int clip[4], ARMarkerInfo2 *marker_infoTWO)
struct ARToolKitPlus::TrackerImpl::AutoThreshold autoThreshold
int arGetAngle(ARFloat rot[3][3], ARFloat *wa, ARFloat *wb, ARFloat *wc)
ARInt16 * arLabeling_BGR(ARUint8 *image, int thresh, int *label_num, int **area, ARFloat **pos, int **clip, int **label_ref)
ARInt16 * arLabeling_RGB(ARUint8 *image, int thresh, int *label_num, int **area, ARFloat **pos, int **clip, int **label_ref)
ARToolKitPlus::Logger * logger
Definition: TrackerImpl.h:634
virtual ARFloat calcOpenGLMatrixFromMarker(ARMarkerInfo *nMarkerInfo, ARFloat nPatternCenter[2], ARFloat nPatternSize, ARFloat *nOpenGLMatrix)
Calculates the OpenGL transformation matrix for a specific marker info.
virtual const char * getDescription()
Returns a short description with compiled-in settings.
static bool calcCameraMatrix(const char *nCamParamFile, int nWidth, int nHeight, ARFloat nNear, ARFloat nFar, ARFloat *nMatrix)
Calculates the camera matrix from an ARToolKit camera file.
virtual bool setPoseEstimator(POSE_ESTIMATOR nMethod)
Changes the Pose Estimation Algorithm.


tuw_artoolkitplus
Author(s): Markus Bader
autogenerated on Sun Sep 4 2016 03:24:33