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

Loading...
Searching...
No Matches
arMulti.h
Go to the documentation of this file.
1/*
2 * arMulti.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 2002-2015 ARToolworks, Inc.
34 *
35 * Author(s): Hirokazu Kato, Philip Lamb
36 *
37 */
38/*******************************************************
39 *
40 * Author: Hirokazu Kato
41 *
42 * kato@sys.im.hiroshima-cu.ac.jp
43 *
44 * Revision: 1.0
45 * Date: 01/09/05
46 *
47 *******************************************************/
48
49#ifndef AR_MULTI_H
50#define AR_MULTI_H
51
52#include <ARX/AR/ar.h>
53
54
55#ifdef __cplusplus
56 extern "C" {
57#endif
58
59#define AR_MULTI_PATTERN_TYPE_TEMPLATE 0
60#define AR_MULTI_PATTERN_TYPE_MATRIX 1
61
62#define AR_MULTI_PATTERN_DETECTION_MODE_NONE -1
63#define AR_MULTI_PATTERN_DETECTION_MODE_TEMPLATE 0
64#define AR_MULTI_PATTERN_DETECTION_MODE_MATRIX 1
65#define AR_MULTI_PATTERN_DETECTION_MODE_TEMPLATE_AND_MATRIX 2
66
67#define AR_MULTI_CONFIDENCE_PATTERN_CUTOFF_DEFAULT 0.5
68#define AR_MULTI_CONFIDENCE_MATRIX_CUTOFF_DEFAULT 0.5
69#define AR_MULTI_POSE_ERROR_CUTOFF_EACH_DEFAULT 4.0 // Maximum allowable pose estimation error for each marker.
70#define AR_MULTI_POSE_ERROR_CUTOFF_COMBINED_DEFAULT 20.0 // Maximum allowable pose estimation error for combined marker set.
71
72
73 typedef struct {
74 int patt_id; // ID of the template pattern or matrix barcode.
75 int patt_type; // Type of this pattern. Either AR_MULTI_PATTERN_TYPE_TEMPLATE or AR_MULTI_PATTERN_TYPE_MATRIX.
76 ARdouble width;
77 ARdouble trans[3][4]; // Pose of this marker, expressed in multimarker coordinate system.
78 ARdouble itrans[3][4]; // Inverse of trans, i.e. pose of the multimarker, expressed in this marker's coordinate system.
79 ARdouble pos3d[4][3]; // Position of each corner (in order: upper-left, upper-right, lower-right, lower right), expressed in multimarker coordinate system.
80 int visible; // Used internally in arGetTransMatMultiSquare2/arGetTransMatMultiSquareStereo2. Set to index into ARMarkerInfo array of the matched marker, or -1 if no match.
81 int visibleR; // Used internally in arGetTransMatMultiSquareStereo2. Set to index into ARMarkerInfo array for the right camera of the matched marker, or -1 if no match.
82 uint64_t globalID; // If patt_type == AR_MULTI_PATTERN_TYPE_MATRIX, the globalID of the matrix or 0 if not a global ID.
83} ARMultiEachMarkerInfoT;
84
85 typedef struct {
86 ARMultiEachMarkerInfoT *marker; // Array of markers in this set.
87 int marker_num; // Number of markers present in this set (i.e. length of marker array).
88 ARdouble trans[3][4]; // Transform (i.e. pose) of this multimarker set, expressed in camera coordinate system.
89 int prevF; // 1 if the most recent call to arGetTransMatMulti estimated a valid pose. 0 otherwise.
90 int patt_type; // Aggregate type of patterns present in this set. Either AR_MULTI_PATTERN_DETECTION_MODE_TEMPLATE or AR_MULTI_PATTERN_DETECTION_MODE_MATRIX or AR_MULTI_PATTERN_DETECTION_MODE_TEMPLATE_AND_MATRIX.
91 ARdouble cfPattCutoff; // Minimum matching confidence required for any pattern markers in order to consider them when calculating the multimarker pose. Default value is AR_MULTI_CONFIDENCE_PATTERN_CUTOFF_DEFAULT.
92 ARdouble cfMatrixCutoff; // Minimum matching confidence required for any matrix markers in order to consider them when calculating the multimarker pose. Default value is AR_MULTI_CONFIDENCE_MATRIX_CUTOFF_DEFAULT.
93 int min_submarker; // Minimum number of markers in this set that must be detected in order to consider it a valid multimarker detection.
94 ARdouble minInlierProb; // Minimum allowable inlier probability when performing robust multimarker pose estimation.
95} ARMultiMarkerInfoT;
96
101 AR_EXTERN ARMultiMarkerInfoT *arMultiAllocConfig(void);
102
107 AR_EXTERN ARMultiMarkerInfoT *arMultiCopyConfig(const ARMultiMarkerInfoT *marker_info);
108
113 AR_EXTERN ARMultiMarkerInfoT *arMultiReadConfigFile( const char *filename, ARPattHandle *pattHandle );
114
115 AR_EXTERN int arMultiAddOrUpdateSubmarker(ARMultiMarkerInfoT *marker_info, int patt_id, int patt_type, ARdouble width, const ARdouble trans[3][4], uint64_t globalID);
116
117 AR_EXTERN void arMultiUpdateSubmarkerPose(ARMultiEachMarkerInfoT *submarker, const ARdouble trans[3][4]);
118
119 AR_EXTERN int arMultiRemoveSubmarker(ARMultiMarkerInfoT *marker_info, int patt_id, int patt_type, uint64_t globalID);
120
124 AR_EXTERN int arMultiFreeConfig( ARMultiMarkerInfoT *config );
125
126 AR_EXTERN ARdouble arGetTransMatMultiSquare(AR3DHandle *handle, ARMarkerInfo *marker_info, int marker_num,
127 ARMultiMarkerInfoT *config);
128
129 AR_EXTERN ARdouble arGetTransMatMultiSquareRobust(AR3DHandle *handle, ARMarkerInfo *marker_info, int marker_num,
130 ARMultiMarkerInfoT *config);
131
132 AR_EXTERN ARdouble arGetTransMatMultiSquareStereo(AR3DStereoHandle *handle,
133 ARMarkerInfo *marker_infoL, int marker_numL,
134 ARMarkerInfo *marker_infoR, int marker_numR,
135 ARMultiMarkerInfoT *config);
136
137 AR_EXTERN ARdouble arGetTransMatMultiSquareStereoRobust(AR3DStereoHandle *handle,
138 ARMarkerInfo *marker_infoL, int marker_numL,
139 ARMarkerInfo *marker_infoR, int marker_numR,
140 ARMultiMarkerInfoT *config);
141
142
143#ifdef __cplusplus
144}
145#endif
146#endif
ar.h
artoolkitX core routines.
ARdouble
double ARdouble
Definition: ar.h:99
AR_EXTERN
#define AR_EXTERN
Definition: ar.h:131
arMultiReadConfigFile
AR_EXTERN ARMultiMarkerInfoT * arMultiReadConfigFile(const char *filename, ARPattHandle *pattHandle)
Creates a new multi-marker configuration and fills it with the config from the multi-marker config fi...
Definition: arMultiReadConfigFile.c:60
arGetTransMatMultiSquareStereo
AR_EXTERN ARdouble arGetTransMatMultiSquareStereo(AR3DStereoHandle *handle, ARMarkerInfo *marker_infoL, int marker_numL, ARMarkerInfo *marker_infoR, int marker_numR, ARMultiMarkerInfoT *config)
Definition: arMultiGetTransMatStereo.c:61
arMultiAddOrUpdateSubmarker
AR_EXTERN int arMultiAddOrUpdateSubmarker(ARMultiMarkerInfoT *marker_info, int patt_id, int patt_type, ARdouble width, const ARdouble trans[3][4], uint64_t globalID)
Definition: arMultiEditConfig.c:95
arMultiCopyConfig
AR_EXTERN ARMultiMarkerInfoT * arMultiCopyConfig(const ARMultiMarkerInfoT *marker_info)
Takes a deep copy of the multi-marker configuration passed in.
Definition: arMultiEditConfig.c:63
arGetTransMatMultiSquare
AR_EXTERN ARdouble arGetTransMatMultiSquare(AR3DHandle *handle, ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config)
Definition: arMultiGetTransMat.c:58
arMultiRemoveSubmarker
AR_EXTERN int arMultiRemoveSubmarker(ARMultiMarkerInfoT *marker_info, int patt_id, int patt_type, uint64_t globalID)
Definition: arMultiEditConfig.c:182
arMultiAllocConfig
AR_EXTERN ARMultiMarkerInfoT * arMultiAllocConfig(void)
Creates a new empty multi-marker configuration.
Definition: arMultiEditConfig.c:43
arMultiUpdateSubmarkerPose
AR_EXTERN void arMultiUpdateSubmarkerPose(ARMultiEachMarkerInfoT *submarker, const ARdouble trans[3][4])
Definition: arMultiEditConfig.c:148
arGetTransMatMultiSquareStereoRobust
AR_EXTERN ARdouble arGetTransMatMultiSquareStereoRobust(AR3DStereoHandle *handle, ARMarkerInfo *marker_infoL, int marker_numL, ARMarkerInfo *marker_infoR, int marker_numR, ARMultiMarkerInfoT *config)
Definition: arMultiGetTransMatStereo.c:70
arMultiFreeConfig
AR_EXTERN int arMultiFreeConfig(ARMultiMarkerInfoT *config)
Frees the multi-marker configuration passed in.
Definition: arMultiFreeConfig.c:55
arGetTransMatMultiSquareRobust
AR_EXTERN ARdouble arGetTransMatMultiSquareRobust(AR3DHandle *handle, ARMarkerInfo *marker_info, int marker_num, ARMultiMarkerInfoT *config)
Definition: arMultiGetTransMat.c:64
AR3DHandle
Structure holding state of an instance of the monocular pose estimator.
Definition: ar.h:385
AR3DStereoHandle
Structure holding state of an instance of the stereo pose estimator.
Definition: ar.h:395
ARMarkerInfo
Describes a detected trapezoidal area (a candidate for a marker match).
Definition: ar.h:213
ARMultiEachMarkerInfoT
Definition: arMulti.h:73
ARMultiEachMarkerInfoT::width
ARdouble width
Definition: arMulti.h:76
ARMultiEachMarkerInfoT::patt_type
int patt_type
Definition: arMulti.h:75
ARMultiEachMarkerInfoT::visible
int visible
Definition: arMulti.h:80
ARMultiEachMarkerInfoT::patt_id
int patt_id
Definition: arMulti.h:74
ARMultiEachMarkerInfoT::globalID
uint64_t globalID
Definition: arMulti.h:82
ARMultiEachMarkerInfoT::visibleR
int visibleR
Definition: arMulti.h:81
ARMultiMarkerInfoT
Definition: arMulti.h:85
ARMultiMarkerInfoT::cfMatrixCutoff
ARdouble cfMatrixCutoff
Definition: arMulti.h:92
ARMultiMarkerInfoT::marker
ARMultiEachMarkerInfoT * marker
Definition: arMulti.h:86
ARMultiMarkerInfoT::minInlierProb
ARdouble minInlierProb
Definition: arMulti.h:94
ARMultiMarkerInfoT::patt_type
int patt_type
Definition: arMulti.h:90
ARMultiMarkerInfoT::min_submarker
int min_submarker
Definition: arMulti.h:93
ARMultiMarkerInfoT::prevF
int prevF
Definition: arMulti.h:89
ARMultiMarkerInfoT::cfPattCutoff
ARdouble cfPattCutoff
Definition: arMulti.h:91
ARMultiMarkerInfoT::marker_num
int marker_num
Definition: arMulti.h:87
ARPattHandle
A structure which holds descriptions of trained patterns for template matching.
Definition: ar.h:268