Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 204 | chris | 1 | /* -------------------------------------------------------------------------- |
| 2 | * Copyright (C) 2004 Hitlab NZ. |
||
| 3 | * The distribution policy is describe on the Copyright.txt furnish |
||
| 4 | * with this library. |
||
| 5 | * -------------------------------------------------------------------------*/ |
||
| 6 | /** |
||
| 7 | * \file arMulti.h |
||
| 8 | * \brief ARToolkit multi pattern subroutines. |
||
| 9 | * |
||
| 10 | * This file extend ar core routines for multi-pattern tracking. |
||
| 11 | * You can obtain position of a local coordinate |
||
| 12 | * system based on the estimation of multiple markers tracking (each in relative |
||
| 13 | * position) |
||
| 14 | * |
||
| 15 | * \remark more efficient with uniform planar configuration |
||
| 16 | * |
||
| 17 | * History : |
||
| 18 | * |
||
| 19 | * \author Hirokazu Kato kato@sys.im.hiroshima-cu.ac.jp |
||
| 20 | * \version 1.0 |
||
| 21 | * \date 01/09/05 |
||
| 22 | **/ |
||
| 23 | /* -------------------------------------------------------------------------- |
||
| 24 | * History : |
||
| 25 | * Rev Date Who Changes |
||
| 26 | * |
||
| 27 | *----------------------------------------------------------------------------*/ |
||
| 28 | |||
| 29 | #ifndef AR_MULTI_H |
||
| 30 | #define AR_MULTI_H |
||
| 31 | #ifdef __cplusplus |
||
| 32 | extern "C" { |
||
| 33 | #endif |
||
| 34 | |||
| 35 | // ============================================================================ |
||
| 36 | // Public includes. |
||
| 37 | // ============================================================================ |
||
| 38 | |||
| 39 | #include <stdio.h> |
||
| 40 | #include <AR/config.h> |
||
| 41 | #include <AR/param.h> |
||
| 42 | #include <AR/ar.h> |
||
| 43 | |||
| 44 | // ============================================================================ |
||
| 45 | // Public types and defines. |
||
| 46 | // ============================================================================ |
||
| 47 | |||
| 48 | /** \struct ARMultiEachMarkerInfoT |
||
| 49 | * \brief multi-marker structure |
||
| 50 | * |
||
| 51 | * Structure for multi-marker tracking |
||
| 52 | * really similar to ARMarkerInfo |
||
| 53 | * \param patt_id identification of the pattern |
||
| 54 | * \param width width of the pattern (in mm) |
||
| 55 | * \param center center of the pattern (in mm) |
||
| 56 | * \param trans estimated position of the pattern |
||
| 57 | * \param itrans relative position of the pattern |
||
| 58 | * \param pos3d final position of the pattern |
||
| 59 | * \param visible boolean flag for visibility |
||
| 60 | * \param visibleR last state visibility |
||
| 61 | */ |
||
| 62 | typedef struct { |
||
| 63 | int patt_id; |
||
| 64 | double width; |
||
| 65 | double center[2]; |
||
| 66 | double trans[3][4]; |
||
| 67 | double itrans[3][4]; |
||
| 68 | double pos3d[4][3]; |
||
| 69 | int visible; |
||
| 70 | /*---*/ |
||
| 71 | int visibleR; |
||
| 72 | } ARMultiEachMarkerInfoT; |
||
| 73 | |||
| 74 | /** \struct ARMultiMarkerInfoT |
||
| 75 | * \brief global multi-marker structure |
||
| 76 | * |
||
| 77 | * Main structure for multi-marker tracking. |
||
| 78 | * |
||
| 79 | * \param marker list of markers of the multi-marker pattern |
||
| 80 | * \param marker_num number of markers used |
||
| 81 | * \param trans position of the multi-marker pattern (more precisely, the camera position in the multi-marker CS) |
||
| 82 | * \param prevF boolean flag for visibility |
||
| 83 | * \param transR last position |
||
| 84 | */ |
||
| 85 | typedef struct { |
||
| 86 | ARMultiEachMarkerInfoT *marker; |
||
| 87 | int marker_num; |
||
| 88 | double trans[3][4]; |
||
| 89 | int prevF; |
||
| 90 | /*---*/ |
||
| 91 | double transR[3][4]; |
||
| 92 | } ARMultiMarkerInfoT; |
||
| 93 | |||
| 94 | // ============================================================================ |
||
| 95 | // Public globals. |
||
| 96 | // ============================================================================ |
||
| 97 | |||
| 98 | // ============================================================================ |
||
| 99 | // Public functions. |
||
| 100 | // ============================================================================ |
||
| 101 | |||
| 102 | /** |
||
| 103 | * \brief loading multi-markers description from a file |
||
| 104 | * |
||
| 105 | * Load a configuration file for multi-markers tracking. The configuration |
||
| 106 | * file furnishs pointer to each pattern description. |
||
| 107 | * |
||
| 108 | * \param filename name of the pattern file |
||
| 109 | * \return a pattern structure, NULL if error |
||
| 110 | */ |
||
| 111 | ARMultiMarkerInfoT *arMultiReadConfigFile( const char *filename ); |
||
| 112 | |||
| 113 | /** |
||
| 114 | * \brief compute camera position in function of the multi-marker patterns (based on detected markers) |
||
| 115 | * |
||
| 116 | * calculate the transformation between the multi-marker patterns and the real camera. Based on |
||
| 117 | * confident values of detected markers in the multi-markers patterns, a global position is return. |
||
| 118 | * |
||
| 119 | * \param marker_info list of detected markers (from arDetectMarker) |
||
| 120 | * \param marker_num number of detected markers |
||
| 121 | * \param config |
||
| 122 | * \return |
||
| 123 | */ |
||
| 124 | double arMultiGetTransMat(ARMarkerInfo *marker_info, int marker_num, |
||
| 125 | ARMultiMarkerInfoT *config); |
||
| 126 | |||
| 127 | /** |
||
| 128 | * \brief activate a multi-marker pattern on the recognition procedure. |
||
| 129 | * |
||
| 130 | * Activate a multi-marker for be checking during the template matching |
||
| 131 | * operation. |
||
| 132 | * \param config pointer to the multi-marker |
||
| 133 | * \return 0 if success, -1 if error |
||
| 134 | */ |
||
| 135 | int arMultiActivate( ARMultiMarkerInfoT *config ); |
||
| 136 | |||
| 137 | /** |
||
| 138 | * \brief Desactivate a multi-marker pattern on the recognition procedure. |
||
| 139 | * |
||
| 140 | * Desactivate a multi-marker for not be checking during the template matching |
||
| 141 | * operation. |
||
| 142 | * \param config pointer to the multi-marker |
||
| 143 | * \return 0 if success, -1 if error |
||
| 144 | */ |
||
| 145 | int arMultiDeactivate( ARMultiMarkerInfoT *config ); |
||
| 146 | |||
| 147 | /** |
||
| 148 | * \brief remove a multi-marker pattern from memory. |
||
| 149 | * |
||
| 150 | * desactivate a pattern and remove it from memory. Post-condition |
||
| 151 | * of this function is unavailability of the multi-marker pattern. |
||
| 152 | * \param config pointer to the multi-marker |
||
| 153 | * \return 0 if success, -1 if error |
||
| 154 | */ |
||
| 155 | int arMultiFreeConfig( ARMultiMarkerInfoT *config ); |
||
| 156 | |||
| 157 | /*------------------------------------*/ |
||
| 158 | double arsMultiGetTransMat(ARMarkerInfo *marker_infoL, int marker_numL, |
||
| 159 | ARMarkerInfo *marker_infoR, int marker_numR, |
||
| 160 | ARMultiMarkerInfoT *config); |
||
| 161 | |||
| 162 | |||
| 163 | #ifdef __cplusplus |
||
| 164 | } |
||
| 165 | #endif |
||
| 166 | #endif |