ARX  1.0
The next-generation open source augmented reality toolkit.
Loading...
Searching...
No Matches
template.h
Go to the documentation of this file.
1/*
2 * AR2/template.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 */
38
39#ifndef AR2_TEMPLATE_H
40#define AR2_TEMPLATE_H
41#include <ARX/AR/ar.h>
42#include <ARX/AR2/config.h>
43#include <ARX/AR2/imageSet.h>
44#include <ARX/AR2/featureSet.h>
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
50
51#define AR2_TEMPLATE_NULL_PIXEL 0x1000
52
53
54typedef struct {
55 int xsize, ysize; /* template size */
56 int xts1, xts2; /* template size */
57 int yts1, yts2; /* template size */
58 ARUint16 *img1; /* template for mode 0 */
59 int vlen; /* length of vector *img */
60 int sum;
63
64#if AR2_CAPABLE_ADAPTIVE_TEMPLATE
65typedef struct {
66 int xsize, ysize; /* template size */
67 int xts1, xts2; /* template size */
68 int yts1, yts2; /* template size */
69 ARUint16 *img1[3]; /* template for mode 0 */
70 int vlen[3]; /* length of vector *img */
71 int sum[3];
72 int validNum;
73} AR2Template2T;
74#endif
75
76
77typedef struct {
78 int snum;
79 int level;
80 int num;
81 int flag; // Set to -1 to indicate that this candidate is the last candidate in the list/array (i.e. candidate count has reached AR2_TRACKING_CANDIDATE_MAX). 0 to indicate a valid candidate. Set to 1 to indicate that this template has been chosen as a candidate.
82 float sx, sy;
84
85
86
87#if AR2_CAPABLE_ADAPTIVE_TEMPLATE
88AR_EXTERN AR2TemplateT *ar2GenTemplate ( int ts1, int ts2 );
89AR_EXTERN AR2Template2T *ar2GenTemplate2 ( int ts1, int ts2 );
91AR_EXTERN int ar2FreeTemplate2( AR2Template2T *templ2 );
92
93AR_EXTERN int ar2SetTemplateSub ( const ARParamLT *cparamLT, const float trans[3][4], AR2ImageSetT *imageSet,
94 AR2FeaturePointsT *featurePoints, int num, int blurLevel,
95 AR2TemplateT *templ );
96AR_EXTERN int ar2SetTemplate2Sub( const ARParamLT *cparamLT, const float trans[3][4], AR2ImageSetT *imageSet,
97 AR2FeaturePointsT *featurePoints, int num, int blurLevel,
98 AR2Template2T *templ2 );
99#else
100AR_EXTERN AR2TemplateT *ar2GenTemplate ( int ts1, int ts2 );
102
103AR_EXTERN int ar2SetTemplateSub ( const ARParamLT *cparamLT, const float trans[3][4], AR2ImageSetT *imageSet,
104 AR2FeaturePointsT *featurePoints, int num,
105 AR2TemplateT *templ );
106#endif
107
108
109AR_EXTERN int ar2GetBestMatching ( ARUint8 *img, ARUint8 *mfImage, int xsize, int ysize, AR_PIXEL_FORMAT pixFormat,
110 AR2TemplateT *mtemp, int rx, int ry,
111 int search[3][2], int *bx, int *by, float *val);
112
113#if AR2_CAPABLE_ADAPTIVE_TEMPLATE
114AR_EXTERN int ar2GetBestMatching2( ARUint8 *img, ARUint8 *mfImage, int xsize, int ysize, AR_PIXEL_FORMAT pixFormat,
115 AR2Template2T *mtemp, int rx, int ry,
116 int search[3][2], int *bx, int *by, float *val, int *blurLevel);
117#else
119#endif
120
121AR_EXTERN int ar2GetResolution( const ARParamLT *cparamLT, const float trans[3][4], const float pos[2], float dpi[2] );
122AR_EXTERN int ar2GetResolution2( const ARParam *cparam, const float trans[3][4], const float pos[2], float dpi[2] );
123
124// Returns -1 if no template selected, otherwise returns the 0-based index of the selected template
125// and sets 'flag' of the template to 1.
126AR_EXTERN int ar2SelectTemplate( AR2TemplateCandidateT *candidate, AR2TemplateCandidateT *prevFeature, int num,
127 float pos[4][2], int xsize, int ysize );
128
129
130
131#ifdef __cplusplus
132}
133#endif
134#endif
artoolkitX core routines.
unsigned char ARUint8
Definition: ar.h:92
unsigned short ARUint16
Definition: ar.h:93
#define AR_EXTERN
Definition: ar.h:131
Definition: featureSet.h:64
Definition: imageSet.h:64
Definition: template.h:77
int level
Definition: template.h:79
int snum
Definition: template.h:78
int num
Definition: template.h:80
int flag
Definition: template.h:81
float sx
Definition: template.h:82
Definition: template.h:54
int validNum
Definition: template.h:61
ARUint16 * img1
Definition: template.h:58
int xsize
Definition: template.h:55
int sum
Definition: template.h:60
int vlen
Definition: template.h:59
int xts1
Definition: template.h:56
int yts1
Definition: template.h:57
Structure holding camera parameters, including image size, projection matrix and lens distortion para...
Definition: param.h:99
Structure holding camera parameters, in lookup table form.
Definition: param.h:151
AR_EXTERN int ar2SelectTemplate(AR2TemplateCandidateT *candidate, AR2TemplateCandidateT *prevFeature, int num, float pos[4][2], int xsize, int ysize)
Definition: selectTemplate.c:134
AR_EXTERN int ar2SetTemplateSub(const ARParamLT *cparamLT, const float trans[3][4], AR2ImageSetT *imageSet, AR2FeaturePointsT *featurePoints, int num, AR2TemplateT *templ)
Definition: template.c:115
AR_EXTERN int ar2GetResolution(const ARParamLT *cparamLT, const float trans[3][4], const float pos[2], float dpi[2])
Definition: selectTemplate.c:51
AR_EXTERN int ar2GetBestMatching2(void)
Definition: matching2.c:168
AR_EXTERN int ar2FreeTemplate(AR2TemplateT *templ)
Definition: template.c:90
AR_EXTERN AR2TemplateT * ar2GenTemplate(int ts1, int ts2)
Definition: template.c:53
AR_EXTERN int ar2GetResolution2(const ARParam *cparam, const float trans[3][4], const float pos[2], float dpi[2])
Definition: selectTemplate.c:61
AR_EXTERN int ar2GetBestMatching(ARUint8 *img, ARUint8 *mfImage, int xsize, int ysize, AR_PIXEL_FORMAT pixFormat, AR2TemplateT *mtemp, int rx, int ry, int search[3][2], int *bx, int *by, float *val)
Get best match for a candidate feature template.
Definition: matching.c:81