ARX  1.0
The next-generation open source augmented reality toolkit.
Loading...
Searching...
No Matches
ARTrackerSquare.h
Go to the documentation of this file.
1/*
2 * ARTrackerSquare.h
3 * artoolkitX
4 *
5 * A C++ class implementing the artoolkitX square fiducial marker tracker.
6 *
7 * This file is part of artoolkitX.
8 *
9 * artoolkitX is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * artoolkitX is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with artoolkitX. If not, see <http://www.gnu.org/licenses/>.
21 *
22 * As a special exception, the copyright holders of this library give you
23 * permission to link this library with independent modules to produce an
24 * executable, regardless of the license terms of these independent modules, and to
25 * copy and distribute the resulting executable under terms of your choice,
26 * provided that you also meet, for each linked independent module, the terms and
27 * conditions of the license of that module. An independent module is a module
28 * which is neither derived from nor based on this library. If you modify this
29 * library, you may extend this exception to your version of the library, but you
30 * are not obligated to do so. If you do not wish to do so, delete this exception
31 * statement from your version.
32 *
33 * Copyright 2018 Realmax, Inc.
34 * Copyright 2015 Daqri, LLC.
35 * Copyright 2010-2015 ARToolworks, Inc.
36 *
37 * Author(s): Philip Lamb, Julian Looser.
38 *
39 */
40
41
42#ifndef ARTRACKERSQUARE_H
43#define ARTRACKERSQUARE_H
44
47#include <ARX/ARTrackerVideo.h>
48#include <ARX/AR/ar.h>
49
51public:
54
55 ARTrackerType type() const override {
56 return ARTrackerType::SQUARE_FIDUCIAL;
57 }
58
59 std::vector<std::string> trackableConfigurations() const override {
60 std::vector<std::string> sv;
61 sv.push_back("single");
62 sv.push_back("single_barcode");
63 sv.push_back("single_buffer");
64 sv.push_back("multi");
65 return sv;
66 }
67
68 bool initialize() override;
69
77 void setDebugMode(bool debug);
78
84 bool debugMode() const;
85
86 void setImageProcMode(int mode);
87
88 int imageProcMode() const;
89
95 void setThreshold(int thresh);
96
102 int threshold() const;
103
110
117
123 void setLabelingMode(int mode);
124
130 int labelingMode() const;
131
132 void setPatternDetectionMode(int mode);
133
134 int patternDetectionMode() const;
135
136 void setPattRatio(float ratio);
137
138 float pattRatio() const;
139
141
143
144 void setPatternSize(int patternSize);
145
146 int patternSize() const;
147
149
150 int patternCountMax() const;
151
152 bool start(ARParamLT *paramLT, AR_PIXEL_FORMAT pixelFormat) override;
153 bool start(ARParamLT *paramLT0, AR_PIXEL_FORMAT pixelFormat0, ARParamLT *paramLT1, AR_PIXEL_FORMAT pixelFormat1, const ARdouble transL2R[3][4]) override;
154 bool isRunning() override;
155 bool update(AR2VideoBufferT *buff, std::vector<ARTrackable *>& trackables) override;
156 bool update(AR2VideoBufferT *buff0, AR2VideoBufferT *buff1, std::vector<ARTrackable *>& trackables) override;
157 bool stop() override;
158 void terminate() override;
159
160 ARTrackable *newTrackable(std::vector<std::string> config) override;
161 void deleteTrackable(ARTrackable **trackable_p) override;
162
163 bool updateDebugTextureRGBA32(const int videoSourceIndex, uint32_t* buffer);
164
165private:
166 int m_threshold;
167 AR_LABELING_THRESH_MODE m_thresholdMode;
168 int m_imageProcMode;
169 int m_labelingMode;
170 ARdouble m_pattRatio;
171 int m_patternDetectionMode;
172 AR_MATRIX_CODE_TYPE m_matrixCodeType;
173 bool m_debugMode;
174 int m_patternSize;
175 int m_patternCountMax;
176
177 ARHandle *m_arHandle0;
178 ARHandle *m_arHandle1;
179 ARPattHandle *m_arPattHandle;
180 AR3DHandle *m_ar3DHandle;
181 ARdouble m_transL2R[3][4];
182 AR3DStereoHandle *m_ar3DStereoHandle;
183};
184
185#endif // !ARTRACKERSQUARE_H
ARTrackerType
Definition: ARTracker.h:50
artoolkitX core routines.
AR_MATRIX_CODE_TYPE
Values specifying the type of matrix code in use.
Definition: ar.h:319
double ARdouble
Definition: ar.h:99
AR_LABELING_THRESH_MODE
Values controlling the labeling thresholding mode.
Definition: ar.h:160
Base class for supported trackable types.
Definition: ARTrackable.h:54
Definition: ARTrackerSquare.h:50
~ARTrackerSquare()
Definition: ARTrackerSquare.cpp:67
void setImageProcMode(int mode)
Definition: ARTrackerSquare.cpp:111
int imageProcMode() const
Definition: ARTrackerSquare.cpp:125
ARTrackerSquare()
Definition: ARTrackerSquare.cpp:47
std::vector< std::string > trackableConfigurations() const override
Definition: ARTrackerSquare.h:59
void setThresholdMode(AR_LABELING_THRESH_MODE mode)
Sets the thresholding mode to use.
Definition: ARTrackerSquare.cpp:149
void setDebugMode(bool debug)
Enables or disables debug mode in the tracker.
Definition: ARTrackerSquare.cpp:93
void setPatternSize(int patternSize)
Definition: ARTrackerSquare.cpp:240
void setLabelingMode(int mode)
Sets the labeling mode to use.
Definition: ARTrackerSquare.cpp:167
void terminate() override
Definition: ARTrackerSquare.cpp:445
ARTrackable * newTrackable(std::vector< std::string > config) override
ARTrackable factory method.
Definition: ARTrackerSquare.cpp:453
AR_MATRIX_CODE_TYPE matrixCodeType() const
Definition: ARTrackerSquare.cpp:235
bool debugMode() const
Returns whether debug mode is currently enabled.
Definition: ARTrackerSquare.cpp:106
void setMatrixCodeType(AR_MATRIX_CODE_TYPE type)
Definition: ARTrackerSquare.cpp:222
AR_LABELING_THRESH_MODE thresholdMode() const
Returns the current thresholding mode.
Definition: ARTrackerSquare.cpp:162
void setThreshold(int thresh)
Sets the threshold value used for image binarization.
Definition: ARTrackerSquare.cpp:130
bool initialize() override
Definition: ARTrackerSquare.cpp:72
int patternSize() const
Definition: ARTrackerSquare.cpp:256
void deleteTrackable(ARTrackable **trackable_p) override
Definition: ARTrackerSquare.cpp:621
float pattRatio() const
Definition: ARTrackerSquare.cpp:217
void setPatternDetectionMode(int mode)
Definition: ARTrackerSquare.cpp:185
void setPattRatio(float ratio)
Definition: ARTrackerSquare.cpp:203
bool isRunning() override
Definition: ARTrackerSquare.cpp:83
ARTrackerType type() const override
Definition: ARTrackerSquare.h:55
int labelingMode() const
Returns the current labeling mode.
Definition: ARTrackerSquare.cpp:180
int threshold() const
Returns the current threshold value used for image binarization.
Definition: ARTrackerSquare.cpp:144
void setPatternCountMax(int patternCountMax)
Definition: ARTrackerSquare.cpp:261
int patternCountMax() const
Definition: ARTrackerSquare.cpp:277
bool updateDebugTextureRGBA32(const int videoSourceIndex, uint32_t *buffer)
Definition: ARTrackerSquare.cpp:634
int patternDetectionMode() const
Definition: ARTrackerSquare.cpp:198
bool stop() override
Definition: ARTrackerSquare.cpp:421
Definition: ARTrackerVideo.h:47
A structure which carries information about a video frame retrieved by the video library.
Definition: ar.h:148
Structure holding state of an instance of the monocular pose estimator.
Definition: ar.h:384
Structure holding state of an instance of the stereo pose estimator.
Definition: ar.h:394
Structure holding state of an instance of the square marker tracker.
Definition: ar.h:341
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