Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tags/Version Original/ARToolkit/include/AR/arMulti.h
blob: e5a03085295f9fdb4baff61d9f9826a883b7bfc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*  --------------------------------------------------------------------------
*   Copyright (C) 2004 Hitlab NZ.
*   The distribution policy is describe on the Copyright.txt furnish 
*    with this library.
*   -------------------------------------------------------------------------*/
/**
*  \file arMulti.h
*  \brief ARToolkit multi pattern subroutines. 
*
*  This file extend ar core routines  for multi-pattern tracking. 
*  You can obtain position of a local coordinate 
*  system based on the estimation of multiple markers tracking (each in relative
*  position)
*
*   \remark more efficient with uniform planar configuration
*
*   History :
*
*  \author Hirokazu Kato kato@sys.im.hiroshima-cu.ac.jp
*  \version 1.0
*  \date 01/09/05
**/
/*  --------------------------------------------------------------------------
*   History : 
*   Rev		Date		Who		Changes
*
*----------------------------------------------------------------------------*/

#ifndef AR_MULTI_H
#define AR_MULTI_H
#ifdef __cplusplus
extern "C" {
#endif

// ============================================================================
//	Public includes.
// ============================================================================

#include <stdio.h>
#include <AR/config.h>
#include <AR/param.h>
#include <AR/ar.h>

// ============================================================================
//	Public types and defines.
// ============================================================================

	/** \struct ARMultiEachMarkerInfoT
* \brief multi-marker structure
*
* Structure for multi-marker tracking
* really similar to ARMarkerInfo
* \param patt_id identification of the pattern
* \param width width of the pattern (in mm)
* \param center center of the pattern (in mm)
* \param trans estimated position of the pattern
* \param itrans relative position of the pattern
* \param pos3d final position of the pattern
* \param visible boolean flag for visibility
* \param visibleR last state visibility
*/
typedef struct {
    int     patt_id;
    double  width;
    double  center[2];
    double  trans[3][4];
    double  itrans[3][4];
    double  pos3d[4][3];
    int     visible;
/*---*/
    int     visibleR;
} ARMultiEachMarkerInfoT;

/** \struct ARMultiMarkerInfoT
* \brief global multi-marker structure
*
* Main structure for multi-marker tracking.
* 
* \param marker list of markers of the multi-marker pattern
* \param marker_num number of markers used
* \param trans position of the multi-marker pattern (more precisely, the camera position in the multi-marker CS)
* \param prevF boolean flag for visibility
* \param transR last position
*/
typedef struct {
    ARMultiEachMarkerInfoT  *marker;
    int                     marker_num;
    double                  trans[3][4];
    int                     prevF;
/*---*/
    double                  transR[3][4];
} ARMultiMarkerInfoT;

// ============================================================================
//	Public globals.
// ============================================================================

// ============================================================================
//	Public functions.
// ============================================================================

/**
* \brief loading multi-markers description from a file
*
* Load a configuration file for multi-markers tracking. The configuration
* file furnishs pointer to each pattern description.
*
* \param filename name of the pattern file
* \return a pattern structure, NULL if error
*/
ARMultiMarkerInfoT *arMultiReadConfigFile( const char *filename );

/**
* \brief compute camera position in function of the multi-marker patterns (based on detected markers)
* 
* calculate the transformation between the multi-marker patterns and the real camera. Based on 
* confident values of detected markers in the multi-markers patterns, a global position is return.
*
* \param marker_info list of detected markers (from arDetectMarker)
* \param marker_num number of detected markers
* \param config 
* \return 
*/
double  arMultiGetTransMat(ARMarkerInfo *marker_info, int marker_num,
                           ARMultiMarkerInfoT *config);

/**
* \brief activate a multi-marker pattern on the recognition procedure.
*
* Activate a multi-marker for be checking during the template matching
* operation.
* \param config pointer to the multi-marker
* \return 0 if success, -1 if error
*/
int arMultiActivate( ARMultiMarkerInfoT *config );

/**
* \brief Desactivate a multi-marker pattern on the recognition procedure.
*
* Desactivate a multi-marker for not be checking during the template matching
* operation.
* \param config pointer to the multi-marker
* \return 0 if success, -1 if error
*/
int arMultiDeactivate( ARMultiMarkerInfoT *config );

/**
* \brief remove a multi-marker pattern from memory.
*
* desactivate a pattern and remove it from memory. Post-condition
* of this function is unavailability of the multi-marker pattern.
* \param config pointer to the multi-marker
* \return 0 if success, -1 if error
*/
int arMultiFreeConfig( ARMultiMarkerInfoT *config );

/*------------------------------------*/
double arsMultiGetTransMat(ARMarkerInfo *marker_infoL, int marker_numL,
                           ARMarkerInfo *marker_infoR, int marker_numR,
                           ARMultiMarkerInfoT *config);


#ifdef __cplusplus
}
#endif
#endif