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

Loading...
Searching...
No Matches
ARTrackable.h
Go to the documentation of this file.
1/*
2 * ARTrackable.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 2010-2015 ARToolworks, Inc.
34 *
35 * Author(s): Julian Looser, Philip Lamb
36 *
37 */
38
39#ifndef ARTRACKABLE_H
40#define ARTRACKABLE_H
41
42#include <ARX/AR/ar.h>
43#include <ARX/AR/arFilterTransMat.h>
44
45#include <vector>
46#include <utility>
47#include <atomic>
48
49#ifdef ARDOUBLE_IS_FLOAT
50# define _0_0 0.0f
51# define _1_0 1.0f
52#else
53# define _0_0 0.0
54# define _1_0 1.0
55#endif
56
57 class ARController; // Forward declaration of owner.
58
62 class ARTrackable {
63
64 private:
65 ARFilterTransMatInfo *m_ftmi;
66 ARdouble m_filterCutoffFrequency;
67 ARdouble m_filterSampleRate;
68
69 protected:
70 ARdouble trans[3][4];
71
72 ARdouble m_positionScaleFactor;
73
74 static std::atomic<int> nextUID;
75
76 public:
77
78 enum TrackableType {
79 SINGLE,
80 MULTI,
81 NFT,
82 TwoD,
83 MULTI_AUTO
84 };
85
86 int UID;
87 static const int NO_ID = -1;
88 TrackableType type;
89
90 // Inputs from subclasses.
91 bool visiblePrev;
92 bool visible;
93
94 // Output.
95 ARdouble transformationMatrix[16];
96 ARdouble transformationMatrixR[16];
97
101 ARTrackable(TrackableType type);
102
103 ARTrackable(const ARTrackable&) = delete;
104 ARTrackable& operator=(const ARTrackable&) = delete;
105
106 virtual ~ARTrackable();
107
108 void setPositionScalefactor(ARdouble scale);
109 ARdouble positionScalefactor();
110
118 virtual bool update(const ARdouble transL2R[3][4] = NULL);
119
120
121 virtual int getPatternCount() = 0;
122 virtual std::pair<float, float> getPatternSize(int patternIndex) = 0;
123 virtual std::pair<int, int> getPatternImageSize(int patternIndex, AR_MATRIX_CODE_TYPE matrixCodeType) = 0;
126 virtual bool getPatternTransform(int patternIndex, ARdouble T[16]) = 0;
127 virtual bool getPatternImage(int patternIndex, uint32_t *pattImageBuffer, AR_MATRIX_CODE_TYPE matrixCodeType) = 0;
128
129 // Filter control.
130 void setFiltered(bool flag);
131 bool isFiltered();
132 ARdouble filterSampleRate();
133 void setFilterSampleRate(ARdouble rate);
134 ARdouble filterCutoffFrequency();
135 void setFilterCutoffFrequency(ARdouble freq);
136
137};
138
139
140#endif // !ARTRACKABLE_H
ar.h
artoolkitX core routines.
AR_MATRIX_CODE_TYPE
AR_MATRIX_CODE_TYPE
Values specifying the type of matrix code in use.
Definition: ar.h:320
ARdouble
double ARdouble
Definition: ar.h:99
arFilterTransMat.h
Provides filtering of transformation matrices (pose estimates).
ARController
Wrapper for artoolkitX functionality.
Definition: ARController.h:80
ARTrackable
Base class for supported trackable types.
Definition: ARTrackable.h:62
ARTrackable::setFilterSampleRate
void setFilterSampleRate(ARdouble rate)
Definition: ARTrackable.cpp:157
ARTrackable::UID
int UID
Internal unique ID (note: not the same as artoolkitX pattern ID)
Definition: ARTrackable.h:86
ARTrackable::trans
ARdouble trans[3][4]
Transformation from camera to this trackable. If stereo, transform from left camera to this trackable...
Definition: ARTrackable.h:70
ARTrackable::getPatternSize
virtual std::pair< float, float > getPatternSize(int patternIndex)=0
ARTrackable::nextUID
static std::atomic< int > nextUID
Definition: ARTrackable.h:74
ARTrackable::setFiltered
void setFiltered(bool flag)
Definition: ARTrackable.cpp:137
ARTrackable::NO_ID
static const int NO_ID
Value of UID that indicates no ID.
Definition: ARTrackable.h:87
ARTrackable::type
TrackableType type
Type of trackable: single, multi, ...
Definition: ARTrackable.h:88
ARTrackable::visible
bool visible
Whether or not the trackable is visible at current time.
Definition: ARTrackable.h:92
ARTrackable::update
virtual bool update(const ARdouble transL2R[3][4]=NULL)
Completes an update begun in the parent class, performing filtering, generating OpenGL view matrix an...
Definition: ARTrackable.cpp:90
ARTrackable::positionScalefactor
ARdouble positionScalefactor()
Definition: ARTrackable.cpp:85
ARTrackable::operator=
ARTrackable & operator=(const ARTrackable &)=delete
Copy assignment is undefined.
ARTrackable::transformationMatrixR
ARdouble transformationMatrixR[16]
Transformation suitable for use in OpenGL.
Definition: ARTrackable.h:96
ARTrackable::isFiltered
bool isFiltered()
Definition: ARTrackable.cpp:147
ARTrackable::m_positionScaleFactor
ARdouble m_positionScaleFactor
Definition: ARTrackable.h:72
ARTrackable::getPatternCount
virtual int getPatternCount()=0
ARTrackable::getPatternImage
virtual bool getPatternImage(int patternIndex, uint32_t *pattImageBuffer, AR_MATRIX_CODE_TYPE matrixCodeType)=0
ARTrackable::getPatternTransform
virtual bool getPatternTransform(int patternIndex, ARdouble T[16])=0
Get the transform, relative to this trackable's origin, of this pattern.
ARTrackable::transformationMatrix
ARdouble transformationMatrix[16]
Transformation suitable for use in OpenGL.
Definition: ARTrackable.h:95
ARTrackable::filterSampleRate
ARdouble filterSampleRate()
Definition: ARTrackable.cpp:152
ARTrackable::setPositionScalefactor
void setPositionScalefactor(ARdouble scale)
Definition: ARTrackable.cpp:80
ARTrackable::getPatternImageSize
virtual std::pair< int, int > getPatternImageSize(int patternIndex, AR_MATRIX_CODE_TYPE matrixCodeType)=0
ARTrackable::ARTrackable
ARTrackable(const ARTrackable &)=delete
Copy construction is undefined.
ARTrackable::filterCutoffFrequency
ARdouble filterCutoffFrequency()
Definition: ARTrackable.cpp:163
ARTrackable::setFilterCutoffFrequency
void setFilterCutoffFrequency(ARdouble freq)
Definition: ARTrackable.cpp:168
ARTrackable::visiblePrev
bool visiblePrev
Whether or not the trackable was visible prior to last update.
Definition: ARTrackable.h:91
ARTrackable::~ARTrackable
virtual ~ARTrackable()
Definition: ARTrackable.cpp:75
ARTrackable::TrackableType
TrackableType
Definition: ARTrackable.h:78
ARTrackable::TwoD
@ TwoD
A 2D textured marker backed by an image.
Definition: ARTrackable.h:82
ARTrackable::SINGLE
@ SINGLE
A standard single square marker.
Definition: ARTrackable.h:79
ARTrackable::NFT
@ NFT
A rectangular textured marker backed by an NFT data set.
Definition: ARTrackable.h:81
ARTrackable::MULTI
@ MULTI
A composite marker made up of multiple square markers.
Definition: ARTrackable.h:80
ARTrackable::MULTI_AUTO
@ MULTI_AUTO
An automatically mapped composite marker made up of multiple square matrix (2D barcode) markers.
Definition: ARTrackable.h:83
_ARFilterTransMatInfo
Definition: arFilterTransMat.c:41