| ARX 1.0 The next-generation open source augmented reality toolkit.

Loading...
Searching...
No Matches
icp.h
Go to the documentation of this file.
1/*
2 * icp.h
3 * artoolkitX
4 *
5 * This file is part of artoolkitX.
6 *
7 * artoolkitX is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * artoolkitX is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with artoolkitX. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * As a special exception, the copyright holders of this library give you
21 * permission to link this library with independent modules to produce an
22 * executable, regardless of the license terms of these independent modules, and to
23 * copy and distribute the resulting executable under terms of your choice,
24 * provided that you also meet, for each linked independent module, the terms and
25 * conditions of the license of that module. An independent module is a module
26 * which is neither derived from nor based on this library. If you modify this
27 * library, you may extend this exception to your version of the library, but you
28 * are not obligated to do so. If you do not wish to do so, delete this exception
29 * statement from your version.
30 *
31 * Copyright 2018 Realmax, Inc.
32 * Copyright 2015 Daqri, LLC.
33 * Copyright 2004-2015 ARToolworks, Inc.
34 *
35 * Author(s): Hirokazu Kato
36 *
37 */
38
39#ifndef ICP_H
40#define ICP_H
41
42#include <stdio.h>
43#include <ARX/AR/icpCore.h>
44
45#ifdef __cplusplus
46 extern "C" {
47#endif
48
49#define ICP_TRANS_MAT_IDENTITY NULL
50
51
52/*
53 * Point Data
54 */
55 typedef struct {
56 ICP2DCoordT *screenCoord;
57 ICP3DCoordT *worldCoord;
58 int num;
59} ICPDataT;
60
61 typedef struct {
62 ICP2DCoordT *screenCoordL;
63 ICP3DCoordT *worldCoordL;
64 int numL;
65 ICP2DCoordT *screenCoordR;
66 ICP3DCoordT *worldCoordR;
67 int numR;
68} ICPStereoDataT;
69
70
71
72/*
73 * Handle
74 */
75 typedef struct {
76 ARdouble matXc2U[3][4];
77 int maxLoop;
78 ARdouble breakLoopErrorThresh;
79 ARdouble breakLoopErrorRatioThresh;
80 ARdouble breakLoopErrorThresh2;
81 ARdouble inlierProb;
82} ICPHandleT;
83
84 typedef struct {
85 ARdouble matXcl2Ul[3][4];
86 ARdouble matXcr2Ur[3][4];
87 ARdouble matC2L[3][4];
88 ARdouble matC2R[3][4];
89 int maxLoop;
90 ARdouble breakLoopErrorThresh;
91 ARdouble breakLoopErrorRatioThresh;
92 ARdouble breakLoopErrorThresh2;
93 ARdouble inlierProb;
94} ICPStereoHandleT;
95
96
97
98
99/*------------ icpUtil.c --------------*/
100 int icpGetInitXw2Xc_from_PlanarData( ARdouble matXc2U[3][4], ICP2DCoordT screenCoord[], ICP3DCoordT worldCoord[], int num, ARdouble initMatXw2Xc[3][4] );
101
102
103/*------------ icpPoint.c --------------*/
104 ICPHandleT *icpCreateHandle ( const ARdouble matXc2U[3][4] );
105 int icpDeleteHandle ( ICPHandleT **handle );
106 int icpSetMatXc2U ( ICPHandleT *handle, const ARdouble matXc2U[3][4] );
107 int icpGetMatXc2U ( ICPHandleT *handle, ARdouble matXc2U[3][4] );
108 int icpSetMaxLoop ( ICPHandleT *handle, int maxLoop );
109 int icpGetMaxLoop ( ICPHandleT *handle, int *maxLoop );
110 int icpSetBreakLoopErrorThresh ( ICPHandleT *handle, ARdouble breakLoopErrorThresh );
111 int icpGetBreakLoopErrorThresh ( ICPHandleT *handle, ARdouble *breakLoopErrorThresh );
112 int icpSetBreakLoopErrorRatioThresh ( ICPHandleT *handle, ARdouble breakLoopErrorThresh );
113 int icpGetBreakLoopErrorRatioThresh ( ICPHandleT *handle, ARdouble *breakLoopErrorThresh );
114 int icpSetBreakLoopErrorThresh2 ( ICPHandleT *handle, ARdouble breakLoopErrorThresh2 );
115 int icpGetBreakLoopErrorThresh2 ( ICPHandleT *handle, ARdouble *breakLoopErrorThresh2 );
116 int icpSetInlierProbability ( ICPHandleT *handle, ARdouble inlierProbability );
117 ICP_EXTERN int icpGetInlierProbability ( ICPHandleT *handle, ARdouble *inlierProbability );
118 int icpPoint ( ICPHandleT *handle, ICPDataT *data, ARdouble initMatXw2Xc[3][4], ARdouble matXw2Xc[3][4], ARdouble *err );
119 int icpPointRobust ( ICPHandleT *handle, ICPDataT *data, ARdouble initMatXw2Xc[3][4], ARdouble matXw2Xc[3][4], ARdouble *err );
120
121
122/*------------ icpPointStereo.c --------------*/
123 ICPStereoHandleT *icpStereoCreateHandle ( const ARdouble matXcl2Ul[3][4], const ARdouble matXcr2Ur[3][4], const ARdouble matC2L[3][4], const ARdouble matC2R[3][4] );
124 int icpStereoDeleteHandle ( ICPStereoHandleT **handle );
125 int icpStereoSetMatXcl2Ul ( ICPStereoHandleT *handle, ARdouble matXcl2Ul[3][4] );
126 int icpStereoSetMatXcr2Ur ( ICPStereoHandleT *handle, ARdouble matXcr2Ur[3][4] );
127 int icpStereoGetMatXcl2Ul ( ICPStereoHandleT *handle, ARdouble matXcl2Ul[3][4] );
128 int icpStereoGetMatXcr2Ur ( ICPStereoHandleT *handle, ARdouble matXcr2Ur[3][4] );
129 int icpStereoSetMatC2L ( ICPStereoHandleT *handle, ARdouble matC2L[3][4] );
130 int icpStereoSetMatC2R ( ICPStereoHandleT *handle, ARdouble matC2R[3][4] );
131 int icpStereoGetMatC2L ( ICPStereoHandleT *handle, ARdouble matC2L[3][4] );
132 int icpStereoGetMatC2R ( ICPStereoHandleT *handle, ARdouble matC2R[3][4] );
133 int icpStereoSetMaxLoop ( ICPStereoHandleT *handle, int maxLoop );
134 int icpStereoGetMaxLoop ( ICPStereoHandleT *handle, int *maxLoop );
135 int icpStereoSetBreakLoopErrorThresh ( ICPStereoHandleT *handle, ARdouble breakLoopErrorThresh );
136 int icpStereoGetBreakLoopErrorThresh ( ICPStereoHandleT *handle, ARdouble *breakLoopErrorThresh );
137 int icpStereoSetBreakLoopErrorRatioThresh ( ICPStereoHandleT *handle, ARdouble breakLoopErrorThresh );
138 int icpStereoGetBreakLoopErrorRatioThresh ( ICPStereoHandleT *handle, ARdouble *breakLoopErrorThresh );
139 int icpStereoSetBreakLoopErrorThresh2 ( ICPStereoHandleT *handle, ARdouble breakLoopErrorThresh2 );
140 int icpStereoGetBreakLoopErrorThresh2 ( ICPStereoHandleT *handle, ARdouble *breakLoopErrorThresh2 );
141 int icpStereoSetInlierProbability ( ICPStereoHandleT *handle, ARdouble inlierProbability );
142 int icpStereoGetInlierProbability ( ICPStereoHandleT *handle, ARdouble *inlierProbability );
143 int icpStereoPoint ( ICPStereoHandleT *handle, ICPStereoDataT *data, ARdouble initMatXw2Xc[3][4], ARdouble matXw2Xc[3][4], ARdouble *err );
144 int icpStereoPointRobust ( ICPStereoHandleT *handle, ICPStereoDataT *data, ARdouble initMatXw2Xc[3][4], ARdouble matXw2Xc[3][4], ARdouble *err );
145
146
147#if 0
148 int icpRobustGetXw2Xc( ICPHandleT *handle,
149 ICPDataT *data,
150 ARdouble initMatXw2Xc[3][4],
151 ARdouble matXw2Xc[3][4],
152 ARdouble *err );
153
154 int icpGetXw2XcFromLineAndPoint( ICPHandleT *handle,
155 ICPLinesDataT *linesData,
156 ICPDataT *pointData,
157 ARdouble initMatXw2Xc[3][4],
158 ARdouble matXw2Xc[3][4],
159 ARdouble *err );
160
161
162 int icpStereoCheckErr( ARdouble S[6], ARdouble matXcl2Ul[3][4], ARdouble matXcl2Ur[3][4], ICPStereoDataT *data, ARdouble *err );
163 int icpRobustCheckErr( ARdouble S[6], ARdouble matXc2U[3][4], ICPDataT *data, ARdouble *weight, ARdouble *err );
164 int icpRobustUpdateWeight( ARdouble S[6], ARdouble matXc2U[3][4], ICPDataT *data, ARdouble sd2, ARdouble *weight );
165
166
167 int icpGetJ_E_S( ARdouble J_E_S[6], ICP2DLineT *line, ICP2DLineSegT *lineSeg, ARdouble matXc2U[3][4], ARdouble q[7], ARdouble s[6],
168 ICP3DLineSegT *cameraCoord, ICP3DLineSegT *worldCoord, ICP2DCoordT *observedScreenCoord );
169 int icpGetJ_E_L( ARdouble J_E_L[3], ICP2DLineT *line, ICP2DCoordT *screenCoord );
170 int icpGetJ_L_X( ARdouble J_L_X[3][4], ICP2DLineSegT *lineSeg );
171 int icpGetLine( ICP2DLineT *line, ICP2DLineSegT *lineSeg );
172 int icpGetdE( ARdouble *dE, ICP2DLineT *line, ICP2DCoordT *screenCoord );
173 int icpLineCheckErr( ARdouble S[6], ARdouble matXc2U[3][4], ICPLinesDataT *data, ARdouble *err );
174#endif
175
176
177
178#ifdef __cplusplus
179}
180#endif
181#endif
ARdouble
double ARdouble
Definition: ar.h:99
icpStereoSetInlierProbability
int icpStereoSetInlierProbability(ICPStereoHandleT *handle, ARdouble inlierProbability)
Definition: icpStereoHandle.c:244
icpStereoGetMatXcl2Ul
int icpStereoGetMatXcl2Ul(ICPStereoHandleT *handle, ARdouble matXcl2Ul[3][4])
Definition: icpStereoHandle.c:168
icpStereoGetMatC2R
int icpStereoGetMatC2R(ICPStereoHandleT *handle, ARdouble matC2R[3][4])
Definition: icpStereoHandle.c:201
icpStereoSetMatC2R
int icpStereoSetMatC2R(ICPStereoHandleT *handle, ARdouble matC2R[3][4])
Definition: icpStereoHandle.c:133
icpStereoSetMatXcr2Ur
int icpStereoSetMatXcr2Ur(ICPStereoHandleT *handle, ARdouble matXcr2Ur[3][4])
Definition: icpStereoHandle.c:111
icpStereoGetBreakLoopErrorThresh
int icpStereoGetBreakLoopErrorThresh(ICPStereoHandleT *handle, ARdouble *breakLoopErrorThresh)
Definition: icpStereoHandle.c:220
icpStereoGetMaxLoop
int icpStereoGetMaxLoop(ICPStereoHandleT *handle, int *maxLoop)
Definition: icpStereoHandle.c:212
icpStereoGetMatXcr2Ur
int icpStereoGetMatXcr2Ur(ICPStereoHandleT *handle, ARdouble matXcr2Ur[3][4])
Definition: icpStereoHandle.c:179
icpPointRobust
int icpPointRobust(ICPHandleT *handle, ICPDataT *data, ARdouble initMatXw2Xc[3][4], ARdouble matXw2Xc[3][4], ARdouble *err)
Definition: icpPointRobust.c:54
icpPoint
int icpPoint(ICPHandleT *handle, ICPDataT *data, ARdouble initMatXw2Xc[3][4], ARdouble matXw2Xc[3][4], ARdouble *err)
Definition: icpPoint.c:49
icpStereoSetMaxLoop
int icpStereoSetMaxLoop(ICPStereoHandleT *handle, int maxLoop)
Definition: icpStereoHandle.c:144
icpGetBreakLoopErrorRatioThresh
int icpGetBreakLoopErrorRatioThresh(ICPHandleT *handle, ARdouble *breakLoopErrorThresh)
Definition: icpHandle.c:152
icpSetMaxLoop
int icpSetMaxLoop(ICPHandleT *handle, int maxLoop)
Definition: icpHandle.c:91
icpStereoPointRobust
int icpStereoPointRobust(ICPStereoHandleT *handle, ICPStereoDataT *data, ARdouble initMatXw2Xc[3][4], ARdouble matXw2Xc[3][4], ARdouble *err)
Definition: icpStereoPointRobust.c:50
icpDeleteHandle
int icpDeleteHandle(ICPHandleT **handle)
Definition: icpHandle.c:68
icpStereoCreateHandle
ICPStereoHandleT * icpStereoCreateHandle(const ARdouble matXcl2Ul[3][4], const ARdouble matXcr2Ur[3][4], const ARdouble matC2L[3][4], const ARdouble matC2R[3][4])
Definition: icpStereoHandle.c:46
icpSetBreakLoopErrorThresh2
int icpSetBreakLoopErrorThresh2(ICPHandleT *handle, ARdouble breakLoopErrorThresh2)
Definition: icpHandle.c:115
icpGetInlierProbability
ICP_EXTERN int icpGetInlierProbability(ICPHandleT *handle, ARdouble *inlierProbability)
Definition: icpHandle.c:179
icpStereoGetMatC2L
int icpStereoGetMatC2L(ICPStereoHandleT *handle, ARdouble matC2L[3][4])
Definition: icpStereoHandle.c:190
icpStereoSetMatXcl2Ul
int icpStereoSetMatXcl2Ul(ICPStereoHandleT *handle, ARdouble matXcl2Ul[3][4])
Definition: icpStereoHandle.c:100
icpSetMatXc2U
int icpSetMatXc2U(ICPHandleT *handle, const ARdouble matXc2U[3][4])
Definition: icpHandle.c:78
icpStereoGetInlierProbability
int icpStereoGetInlierProbability(ICPStereoHandleT *handle, ARdouble *inlierProbability)
Definition: icpStereoHandle.c:236
icpGetInitXw2Xc_from_PlanarData
int icpGetInitXw2Xc_from_PlanarData(ARdouble matXc2U[3][4], ICP2DCoordT screenCoord[], ICP3DCoordT worldCoord[], int num, ARdouble initMatXw2Xc[3][4])
Definition: icpUtil.c:72
icpSetBreakLoopErrorThresh
int icpSetBreakLoopErrorThresh(ICPHandleT *handle, ARdouble breakLoopErrorThresh)
Definition: icpHandle.c:99
icpStereoSetBreakLoopErrorThresh2
int icpStereoSetBreakLoopErrorThresh2(ICPStereoHandleT *handle, ARdouble breakLoopErrorThresh2)
icpSetInlierProbability
int icpSetInlierProbability(ICPHandleT *handle, ARdouble inlierProbability)
Definition: icpHandle.c:168
icpGetMatXc2U
int icpGetMatXc2U(ICPHandleT *handle, ARdouble matXc2U[3][4])
Definition: icpHandle.c:123
icpStereoSetBreakLoopErrorThresh
int icpStereoSetBreakLoopErrorThresh(ICPStereoHandleT *handle, ARdouble breakLoopErrorThresh)
Definition: icpStereoHandle.c:152
icpStereoGetBreakLoopErrorRatioThresh
int icpStereoGetBreakLoopErrorRatioThresh(ICPStereoHandleT *handle, ARdouble *breakLoopErrorThresh)
Definition: icpStereoHandle.c:228
icpGetMaxLoop
int icpGetMaxLoop(ICPHandleT *handle, int *maxLoop)
Definition: icpHandle.c:136
icpGetBreakLoopErrorThresh2
int icpGetBreakLoopErrorThresh2(ICPHandleT *handle, ARdouble *breakLoopErrorThresh2)
Definition: icpHandle.c:160
icpCreateHandle
ICPHandleT * icpCreateHandle(const ARdouble matXc2U[3][4])
Definition: icpHandle.c:46
icpSetBreakLoopErrorRatioThresh
int icpSetBreakLoopErrorRatioThresh(ICPHandleT *handle, ARdouble breakLoopErrorThresh)
Definition: icpHandle.c:107
icpStereoGetBreakLoopErrorThresh2
int icpStereoGetBreakLoopErrorThresh2(ICPStereoHandleT *handle, ARdouble *breakLoopErrorThresh2)
icpStereoDeleteHandle
int icpStereoDeleteHandle(ICPStereoHandleT **handle)
Definition: icpStereoHandle.c:89
icpStereoSetBreakLoopErrorRatioThresh
int icpStereoSetBreakLoopErrorRatioThresh(ICPStereoHandleT *handle, ARdouble breakLoopErrorThresh)
Definition: icpStereoHandle.c:160
icpStereoPoint
int icpStereoPoint(ICPStereoHandleT *handle, ICPStereoDataT *data, ARdouble initMatXw2Xc[3][4], ARdouble matXw2Xc[3][4], ARdouble *err)
Definition: icpStereoPoint.c:48
icpGetBreakLoopErrorThresh
int icpGetBreakLoopErrorThresh(ICPHandleT *handle, ARdouble *breakLoopErrorThresh)
Definition: icpHandle.c:144
icpStereoSetMatC2L
int icpStereoSetMatC2L(ICPStereoHandleT *handle, ARdouble matC2L[3][4])
Definition: icpStereoHandle.c:122
icpCore.h
ICP_EXTERN
#define ICP_EXTERN
Definition: icpCore.h:57
ICP2DCoordT
Definition: icpCore.h:71
ICP2DLineSegT
Definition: icpCore.h:88
ICP2DLineT
Definition: icpCore.h:82
ICP3DCoordT
Definition: icpCore.h:76
ICP3DLineSegT
Definition: icpCore.h:93
ICPDataT
Definition: icp.h:55
ICPDataT::screenCoord
ICP2DCoordT * screenCoord
Definition: icp.h:56
ICPDataT::worldCoord
ICP3DCoordT * worldCoord
Definition: icp.h:57
ICPDataT::num
int num
Definition: icp.h:58
ICPHandleT
Definition: icp.h:75
ICPHandleT::breakLoopErrorThresh
ARdouble breakLoopErrorThresh
Definition: icp.h:78
ICPHandleT::maxLoop
int maxLoop
Definition: icp.h:77
ICPHandleT::breakLoopErrorRatioThresh
ARdouble breakLoopErrorRatioThresh
Definition: icp.h:79
ICPHandleT::inlierProb
ARdouble inlierProb
Definition: icp.h:81
ICPHandleT::breakLoopErrorThresh2
ARdouble breakLoopErrorThresh2
Definition: icp.h:80
ICPStereoDataT
Definition: icp.h:61
ICPStereoDataT::screenCoordR
ICP2DCoordT * screenCoordR
Definition: icp.h:65
ICPStereoDataT::numR
int numR
Definition: icp.h:67
ICPStereoDataT::worldCoordR
ICP3DCoordT * worldCoordR
Definition: icp.h:66
ICPStereoDataT::screenCoordL
ICP2DCoordT * screenCoordL
Definition: icp.h:62
ICPStereoDataT::worldCoordL
ICP3DCoordT * worldCoordL
Definition: icp.h:63
ICPStereoDataT::numL
int numL
Definition: icp.h:64
ICPStereoHandleT
Definition: icp.h:84
ICPStereoHandleT::breakLoopErrorThresh
ARdouble breakLoopErrorThresh
Definition: icp.h:90
ICPStereoHandleT::inlierProb
ARdouble inlierProb
Definition: icp.h:93
ICPStereoHandleT::maxLoop
int maxLoop
Definition: icp.h:89
ICPStereoHandleT::breakLoopErrorThresh2
ARdouble breakLoopErrorThresh2
Definition: icp.h:92
ICPStereoHandleT::breakLoopErrorRatioThresh
ARdouble breakLoopErrorRatioThresh
Definition: icp.h:91