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

Loading...
Searching...
No Matches
ARTrackerNFT.h
Go to the documentation of this file.
1/*
2 * ARTrackerNFT.h
3 * artoolkitX
4 *
5 * A C++ class implementing the artoolkitX NFT 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 ARTRACKERNFT_H
43#define ARTRACKERNFT_H
44
45#include <ARX/AR/config.h>
46#if HAVE_NFT
47
48#include <ARX/ARTrackableNFT.h>
49#include <ARX/ARTrackerVideo.h>
50#include <ARX/AR2/tracking.h>
51#include <ARX/KPM/kpm.h>
52
53#define PAGES_MAX 64
54
55 class ARTrackerNFT : public ARTrackerVideo {
56 public:
57 ARTrackerNFT();
58 ~ARTrackerNFT();
59
60 ARTrackerType type() const override {
61 return ARTrackerType::TEXTURE2D_FIDUCIAL;
62 }
63
64 std::vector<std::string> trackableConfigurations() const override {
65 std::vector<std::string> sv;
66 sv.push_back("nft");
67 return sv;
68 }
69
70 bool initialize() override;
71
72 void setNFTMultiMode(bool on);
73 bool NFTMultiMode() const;
74
75 bool start(ARParamLT *paramLT, AR_PIXEL_FORMAT pixelFormat) override;
76 bool start(ARParamLT *paramLT0, AR_PIXEL_FORMAT pixelFormat0, ARParamLT *paramLT1, AR_PIXEL_FORMAT pixelFormat1, const ARdouble transL2R[3][4]) override;
77 bool isRunning() override;
78 bool wantsUpdate() override;
79 bool update(AR2VideoBufferT *buff) override;
80 bool update(AR2VideoBufferT *buff0, AR2VideoBufferT *buff1) override;
81 bool stop() override;
82 void terminate() override;
83
84 int newTrackable(std::vector<std::string> config) override;
85 unsigned int countTrackables() override;
86 std::shared_ptr<ARTrackable> getTrackable(int UID) override;
87 std::vector<std::shared_ptr<ARTrackable>> getAllTrackables() override;
88 bool deleteTrackable(int UID) override;
89 void deleteAllTrackables() override;
90
91 private:
92 std::vector<std::shared_ptr<ARTrackable>> m_trackables;
93 bool m_videoSourceIsStereo;
94 bool m_nftMultiMode;
95 bool m_kpmRequired;
96 bool m_kpmBusy;
97 // NFT data.
98 THREAD_HANDLE_T *trackingThreadHandle;
99 AR2HandleT *m_ar2Handle;
100 KpmHandle *m_kpmHandle;
101 AR2SurfaceSetT *m_surfaceSet[PAGES_MAX]; // Weak-reference. Strong reference is now in ARTrackableNFT class.
102 ARdouble m_transL2R[3][4];
103
104 bool unloadNFTData();
105 bool loadNFTData();
106 int m_pageCount;
107};
108
109#endif // HAVE_NFT
110#endif // !ARTRACKERNFT_H
ARTrackableNFT.h
ARTrackerType
ARTrackerType
Definition: ARTracker.h:51
ARTrackerVideo.h
ARdouble
double ARdouble
Definition: ar.h:99
ARTracker::wantsUpdate
virtual bool wantsUpdate()=0
ARTracker::newTrackable
virtual int newTrackable(std::vector< std::string > config)=0
ARTrackable factory method.
ARTracker::isRunning
virtual bool isRunning()=0
ARTracker::deleteAllTrackables
virtual void deleteAllTrackables()=0
ARTracker::trackableConfigurations
virtual std::vector< std::string > trackableConfigurations() const =0
ARTracker::getAllTrackables
virtual std::vector< std::shared_ptr< ARTrackable > > getAllTrackables()=0
ARTracker::stop
virtual bool stop()=0
ARTracker::deleteTrackable
virtual bool deleteTrackable(int UID)=0
Removes the trackable with UID uid, if held by this tracker.
ARTracker::getTrackable
virtual std::shared_ptr< ARTrackable > getTrackable(int UID)=0
ARTracker::terminate
virtual void terminate()=0
ARTracker::countTrackables
virtual unsigned int countTrackables()=0
ARTracker::type
virtual ARTrackerType type() const =0
ARTracker::initialize
virtual bool initialize()=0
ARTrackerVideo
Definition: ARTrackerVideo.h:49
kpm.h
_AR2HandleT
Definition: tracking.h:114
_KpmHandle
Definition: kpmPrivate.h:60
_THREAD_HANDLE_T
Definition: thread_sub.c:78
AR2SurfaceSetT
Definition: tracking.h:76
AR2VideoBufferT
A structure which carries information about a video frame retrieved by the video library.
Definition: ar.h:148
ARParamLT
Structure holding camera parameters, in lookup table form.
Definition: param.h:151
tracking.h