ARX  1.0
The next-generation open source augmented reality toolkit.
Loading...
Searching...
No Matches
tracking.h
Go to the documentation of this file.
1/*
2 * AR2/tracking.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 2006-2015 ARToolworks, Inc.
34 *
35 * Author(s): Hirokazu Kato, Philip Lamb
36 *
37 */
48#ifndef AR2_TRACKING_H
49#define AR2_TRACKING_H
51#include <ARX/AR/ar.h>
52#include <ARX/AR/icp.h>
53#include <ARX/AR2/config.h>
54#include <ARX/AR2/featureSet.h>
55#include <ARX/AR2/template.h>
56#include <ARX/AR2/marker.h>
57
58#define AR2_TRACKING_6DOF 1
59#define AR2_TRACKING_HOMOGRAPHY 2
60
61#define AR2_TRACKING_DEFAULT_THREAD_NUM -1
62
63#ifdef __cplusplus
64extern "C" {
65#endif
66
67typedef struct {
71 float trans[3][4];
72 float itrans[3][4];
73 char *jpegName;
75
76typedef struct {
78 int num;
79 float trans1[3][4];
80 float trans2[3][4];
81 float trans3[3][4];
85
86typedef struct {
87 float sim;
88 float pos2d[2];
89 float pos3d[3];
90#if AR2_CAPABLE_ADAPTIVE_TEMPLATE
91 int blurLevel;
92#endif
94
95
96typedef struct _AR2HandleT AR2HandleT;
98
99// Structure to pass parameters to threads spawned to run ar2Tracking2d().
101 struct _AR2HandleT *ar2Handle; // Reference to parent AR2HandleT.
104 ARUint8 *dataPtr; // Input image.
105 ARUint8 *mfImage; // (Internally allocated buffer same size as input image).
107#if AR2_CAPABLE_ADAPTIVE_TEMPLATE
108 AR2Template2T *templ2;
109#endif
111 int ret;
112};
113
116 int xsize;
117 int ysize;
120 AR_PIXEL_FORMAT pixFormat;
121#if AR2_CAPABLE_ADAPTIVE_TEMPLATE
122 int blurMethod;
123 int blurLevel;
124#endif
131 /*--------------------------------*/
144};
145
146
171 ARUint8 *dataPtr, float trans[3][4], float *err );
172void *ar2Tracking2d ( THREAD_HANDLE_T *threadHandle );
173/*
174int ar2Tracking2d ( AR2HandleT *ar2Handle, AR2SurfaceSetT *surfaceSet,
175 AR2TemplateCandidateT *candidate,
176 ARUint8 *dataPtr, AR2Tracking2DResultT *result );
177*/
178
192AR2SurfaceSetT *ar2ReadSurfaceSet ( const char *filename, const char *ext, ARPattHandle *pattHandle );
193
204
217int ar2SetInitTrans ( AR2SurfaceSetT *surfaceSet, float trans[3][4] );
218
237AR2HandleT *ar2CreateHandle ( ARParamLT *cparamLT, AR_PIXEL_FORMAT pixFormat, int threadNum );
238
255AR2HandleT *ar2CreateHandleHomography ( int xsize, int ysize, AR_PIXEL_FORMAT pixFormat, int threadNum );
256
268
269#if AR2_CAPABLE_ADAPTIVE_TEMPLATE
270int ar2SetBlurMethod ( AR2HandleT *ar2Handle, int blurMethod );
271int ar2GetBlurMethod ( AR2HandleT *ar2Handle, int *blurMethod );
272int ar2SetBlurLevel ( AR2HandleT *ar2Handle, int blurLevel );
273int ar2GetBlurLevel ( AR2HandleT *ar2Handle, int *blurLevel );
274#endif
275
294int ar2SetSearchSize ( AR2HandleT *ar2Handle, int searchSize );
295
306int ar2GetSearchSize ( AR2HandleT *ar2Handle, int *searchSize );
307
314int ar2SetTemplateSize1 ( AR2HandleT *ar2Handle, int templateSize1 );
315
322int ar2GetTemplateSize1 ( AR2HandleT *ar2Handle, int *templateSize1 );
323
330int ar2SetTemplateSize2 ( AR2HandleT *ar2Handle, int templateSize2 );
331
338int ar2GetTemplateSize2 ( AR2HandleT *ar2Handle, int *templateSize2 );
339
346int ar2SetSearchFeatureNum ( AR2HandleT *ar2Handle, int searchTemplateMax );
347
354int ar2GetSearchFeatureNum ( AR2HandleT *ar2Handle, int *searchTemplateMax );
355
362int ar2SetSimThresh ( AR2HandleT *ar2Handle, float simThresh );
363
370int ar2GetSimThresh ( AR2HandleT *ar2Handle, float *simThresh );
371
389int ar2SetTrackingThresh ( AR2HandleT *ar2Handle, float trackingThresh );
390
401int ar2GetTrackingThresh ( AR2HandleT *ar2Handle, float *trackingThresh );
402
415int ar2SetTrackingMode ( AR2HandleT *ar2Handle, int trackingMode );
416
426int ar2GetTrackingMode ( AR2HandleT *ar2Handle, int *trackingMode );
427
428#ifdef __cplusplus
429}
430#endif
431#endif
artoolkitX core routines.
unsigned char ARUint8
Definition: ar.h:92
#define AR2_SEARCH_FEATURE_MAX
Definition: config.h:130
#define AR2_TRACKING_CANDIDATE_MAX
Definition: config.h:126
#define AR2_THREAD_MAX
Definition: config.h:109
#define AR2_TRACKING_SURFACE_MAX
Definition: config.h:125
Definition: tracking.h:114
float pos[AR2_SEARCH_FEATURE_MAX+AR2_THREAD_MAX][2]
Definition: tracking.h:135
float trackingThresh
Definition: tracking.h:130
int trackingMode
Definition: tracking.h:115
int templateSize1
Definition: tracking.h:126
AR_PIXEL_FORMAT pixFormat
Definition: tracking.h:120
float pos2d[AR2_SEARCH_FEATURE_MAX][2]
Definition: tracking.h:136
int ysize
Definition: tracking.h:117
ICPHandleT * icpHandle
Definition: tracking.h:119
int searchSize
Definition: tracking.h:125
int templateSize2
Definition: tracking.h:127
THREAD_HANDLE_T * threadHandle[AR2_THREAD_MAX]
Definition: tracking.h:143
float wtrans2[AR2_TRACKING_SURFACE_MAX][3][4]
Definition: tracking.h:133
float wtrans1[AR2_TRACKING_SURFACE_MAX][3][4]
Definition: tracking.h:132
ARParamLT * cparamLT
Definition: tracking.h:118
float simThresh
Definition: tracking.h:129
struct _AR2Tracking2DParamT arg[AR2_THREAD_MAX]
Definition: tracking.h:142
int threadNum
Definition: tracking.h:141
int xsize
Definition: tracking.h:116
AR2TemplateCandidateT candidate[AR2_TRACKING_CANDIDATE_MAX+1]
Definition: tracking.h:138
AR2TemplateCandidateT usedFeature[AR2_SEARCH_FEATURE_MAX]
Definition: tracking.h:140
float wtrans3[AR2_TRACKING_SURFACE_MAX][3][4]
Definition: tracking.h:134
AR2TemplateCandidateT candidate2[AR2_TRACKING_CANDIDATE_MAX+1]
Definition: tracking.h:139
int searchFeatureNum
Definition: tracking.h:128
float pos3d[AR2_SEARCH_FEATURE_MAX][3]
Definition: tracking.h:137
Definition: tracking.h:100
int ret
Definition: tracking.h:111
AR2Tracking2DResultT result
Definition: tracking.h:110
AR2TemplateT * templ
Definition: tracking.h:106
AR2TemplateCandidateT * candidate
Definition: tracking.h:103
struct _AR2HandleT * ar2Handle
Definition: tracking.h:101
ARUint8 * dataPtr
Definition: tracking.h:104
AR2SurfaceSetT * surfaceSet
Definition: tracking.h:102
ARUint8 * mfImage
Definition: tracking.h:105
Definition: thread_sub.c:78
Definition: featureSet.h:73
Definition: imageSet.h:64
Definition: marker.h:54
Definition: tracking.h:76
int num
Definition: tracking.h:78
AR2SurfaceT * surface
Definition: tracking.h:77
int contNum
Definition: tracking.h:82
Definition: tracking.h:67
AR2FeatureSetT * featureSet
Definition: tracking.h:69
AR2MarkerSetT * markerSet
Definition: tracking.h:70
AR2ImageSetT * imageSet
Definition: tracking.h:68
char * jpegName
Definition: tracking.h:73
Definition: template.h:77
Definition: template.h:54
Definition: tracking.h:86
float sim
Definition: tracking.h:87
Structure holding camera parameters, in lookup table form.
Definition: param.h:151
A structure which holds descriptions of trained patterns for template matching.
Definition: ar.h:267
Definition: icp.h:75
AR2SurfaceSetT * ar2ReadSurfaceSet(const char *filename, const char *ext, ARPattHandle *pattHandle)
Definition: surface.c:51
int ar2GetTemplateSize2(AR2HandleT *ar2Handle, int *templateSize2)
Definition: handle.c:277
int ar2GetTemplateSize1(AR2HandleT *ar2Handle, int *templateSize1)
Definition: handle.c:263
int ar2SetSearchFeatureNum(AR2HandleT *ar2Handle, int searchTemplateMax)
Definition: handle.c:236
int ar2Tracking(AR2HandleT *ar2Handle, AR2SurfaceSetT *surfaceSet, ARUint8 *dataPtr, float trans[3][4], float *err)
Definition: tracking.c:68
int ar2GetSearchFeatureNum(AR2HandleT *ar2Handle, int *searchTemplateMax)
Definition: handle.c:249
int ar2SetTemplateSize1(AR2HandleT *ar2Handle, int templateSize1)
Definition: handle.c:256
int ar2SetTemplateSize2(AR2HandleT *ar2Handle, int templateSize2)
Definition: handle.c:270
int ar2DeleteHandle(AR2HandleT **ar2Handle)
Definition: handle.c:125
int ar2GetTrackingThresh(AR2HandleT *ar2Handle, float *trackingThresh)
Definition: handle.c:215
int ar2SetSearchSize(AR2HandleT *ar2Handle, int searchSize)
Definition: handle.c:222
int ar2SetSimThresh(AR2HandleT *ar2Handle, float simThresh)
Definition: handle.c:194
void * ar2Tracking2d(THREAD_HANDLE_T *threadHandle)
Definition: tracking2d.c:59
int ar2SetTrackingMode(AR2HandleT *ar2Handle, int trackingMode)
Definition: handle.c:149
AR2HandleT * ar2CreateHandleHomography(int xsize, int ysize, AR_PIXEL_FORMAT pixFormat, int threadNum)
Definition: handle.c:64
AR2HandleT * ar2CreateHandle(ARParamLT *cparamLT, AR_PIXEL_FORMAT pixFormat, int threadNum)
Definition: handle.c:50
int ar2GetTrackingMode(AR2HandleT *ar2Handle, int *trackingMode)
Definition: handle.c:157
int ar2SetTrackingThresh(AR2HandleT *ar2Handle, float trackingThresh)
Definition: handle.c:208
int ar2FreeSurfaceSet(AR2SurfaceSetT **surfaceSet)
Definition: surface.c:212
int ar2SetInitTrans(AR2SurfaceSetT *surfaceSet, float trans[3][4])
Definition: surface.c:234
int ar2GetSearchSize(AR2HandleT *ar2Handle, int *searchSize)
Definition: handle.c:229
int ar2GetSimThresh(AR2HandleT *ar2Handle, float *simThresh)
Definition: handle.c:201