densespatialmap.hxx 6.4 KB
Newer Older
BlackAngle233's avatar
BlackAngle233 committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
//=============================================================================================================================
//
// EasyAR Sense 4.2.0.8700-7bcbc8b1c
// Copyright (c) 2015-2021 VisionStar Information Technology (Shanghai) Co., Ltd. All Rights Reserved.
// EasyAR is the registered trademark or trademark of VisionStar Information Technology (Shanghai) Co., Ltd in China
// and other countries for the augmented reality technology developed by VisionStar Information Technology (Shanghai) Co., Ltd.
//
//=============================================================================================================================

#ifndef __EASYAR_DENSESPATIALMAP_HXX__
#define __EASYAR_DENSESPATIALMAP_HXX__

#include "easyar/types.hxx"

namespace easyar {

/// <summary>
/// DenseSpatialMap is used to reconstruct the environment accurately and densely. The reconstructed model is represented by `triangle mesh`, which is denoted simply by `mesh`.
/// DenseSpatialMap occupies 1 buffers of camera.
/// </summary>
class DenseSpatialMap
{
protected:
    easyar_DenseSpatialMap * cdata_ ;
    void init_cdata(easyar_DenseSpatialMap * cdata);
    virtual DenseSpatialMap & operator=(const DenseSpatialMap & data) { return *this; } //deleted
public:
    DenseSpatialMap(easyar_DenseSpatialMap * cdata);
    virtual ~DenseSpatialMap();

    DenseSpatialMap(const DenseSpatialMap & data);
    const easyar_DenseSpatialMap * get_cdata() const;
    easyar_DenseSpatialMap * get_cdata();

    /// <summary>
    /// Returns True when the device supports dense reconstruction, otherwise returns False.
    /// </summary>
    static bool isAvailable();
    /// <summary>
    /// Input port for input frame. For DenseSpatialMap to work, the inputFrame must include image and it&#39;s camera parameters and spatial information (cameraTransform and trackingStatus). See also `InputFrameSink`_ .
    /// </summary>
    void inputFrameSink(/* OUT */ InputFrameSink * * Return);
    /// <summary>
    /// Camera buffers occupied in this component.
    /// </summary>
    int bufferRequirement();
    /// <summary>
    /// Create `DenseSpatialMap`_ object.
    /// </summary>
    static void create(/* OUT */ DenseSpatialMap * * Return);
    /// <summary>
    /// Start or continue runninng `DenseSpatialMap`_ algorithm.
    /// </summary>
    bool start();
    /// <summary>
    /// Pause the reconstruction algorithm. Call `start` to resume reconstruction.
    /// </summary>
    void stop();
    /// <summary>
    /// Close `DenseSpatialMap`_ algorithm.
    /// </summary>
    void close();
    /// <summary>
    /// Get the mesh management object of type `SceneMesh`_ . The contents will automatically update after calling the `DenseSpatialMap.updateSceneMesh`_ function.
    /// </summary>
    void getMesh(/* OUT */ SceneMesh * * Return);
    /// <summary>
    /// Get the lastest updated mesh and save it to the `SceneMesh`_ object obtained by `DenseSpatialMap.getMesh`_ .
    /// The parameter `updateMeshAll` indicates whether to perform a `full update` or an `incremental update`. When `updateMeshAll` is True, `full update` is performed. All meshes are saved to `SceneMesh`_ . When `updateMeshAll` is False, `incremental update` is performed, and only the most recently updated mesh is saved to `SceneMesh`_ .
    /// `Full update` will take extra time and memory space, causing performance degradation.
    /// </summary>
    bool updateSceneMesh(bool updateMeshAll);
};

}

#endif

#ifndef __IMPLEMENTATION_EASYAR_DENSESPATIALMAP_HXX__
#define __IMPLEMENTATION_EASYAR_DENSESPATIALMAP_HXX__

#include "easyar/densespatialmap.h"
#include "easyar/dataflow.hxx"
#include "easyar/frame.hxx"
#include "easyar/image.hxx"
#include "easyar/buffer.hxx"
#include "easyar/cameraparameters.hxx"
#include "easyar/vector.hxx"
#include "easyar/matrix.hxx"
#include "easyar/scenemesh.hxx"

namespace easyar {

inline DenseSpatialMap::DenseSpatialMap(easyar_DenseSpatialMap * cdata)
    :
    cdata_(NULL)
{
    init_cdata(cdata);
}
inline DenseSpatialMap::~DenseSpatialMap()
{
    if (cdata_) {
        easyar_DenseSpatialMap__dtor(cdata_);
        cdata_ = NULL;
    }
}

inline DenseSpatialMap::DenseSpatialMap(const DenseSpatialMap & data)
    :
    cdata_(NULL)
{
    easyar_DenseSpatialMap * cdata = NULL;
    easyar_DenseSpatialMap__retain(data.cdata_, &cdata);
    init_cdata(cdata);
}
inline const easyar_DenseSpatialMap * DenseSpatialMap::get_cdata() const
{
    return cdata_;
}
inline easyar_DenseSpatialMap * DenseSpatialMap::get_cdata()
{
    return cdata_;
}
inline void DenseSpatialMap::init_cdata(easyar_DenseSpatialMap * cdata)
{
    cdata_ = cdata;
}
inline bool DenseSpatialMap::isAvailable()
{
    bool _return_value_ = easyar_DenseSpatialMap_isAvailable();
    return _return_value_;
}
inline void DenseSpatialMap::inputFrameSink(/* OUT */ InputFrameSink * * Return)
{
    if (cdata_ == NULL) {
        *Return = NULL;
        return;
    }
    easyar_InputFrameSink * _return_value_ = NULL;
    easyar_DenseSpatialMap_inputFrameSink(cdata_, &_return_value_);
    *Return = new InputFrameSink(_return_value_);
}
inline int DenseSpatialMap::bufferRequirement()
{
    if (cdata_ == NULL) {
        return int();
    }
    int _return_value_ = easyar_DenseSpatialMap_bufferRequirement(cdata_);
    return _return_value_;
}
inline void DenseSpatialMap::create(/* OUT */ DenseSpatialMap * * Return)
{
    easyar_DenseSpatialMap * _return_value_ = NULL;
    easyar_DenseSpatialMap_create(&_return_value_);
    *Return = new DenseSpatialMap(_return_value_);
}
inline bool DenseSpatialMap::start()
{
    if (cdata_ == NULL) {
        return bool();
    }
    bool _return_value_ = easyar_DenseSpatialMap_start(cdata_);
    return _return_value_;
}
inline void DenseSpatialMap::stop()
{
    if (cdata_ == NULL) {
        return;
    }
    easyar_DenseSpatialMap_stop(cdata_);
}
inline void DenseSpatialMap::close()
{
    if (cdata_ == NULL) {
        return;
    }
    easyar_DenseSpatialMap_close(cdata_);
}
inline void DenseSpatialMap::getMesh(/* OUT */ SceneMesh * * Return)
{
    if (cdata_ == NULL) {
        *Return = NULL;
        return;
    }
    easyar_SceneMesh * _return_value_ = NULL;
    easyar_DenseSpatialMap_getMesh(cdata_, &_return_value_);
    *Return = new SceneMesh(_return_value_);
}
inline bool DenseSpatialMap::updateSceneMesh(bool arg0)
{
    if (cdata_ == NULL) {
        return bool();
    }
    bool _return_value_ = easyar_DenseSpatialMap_updateSceneMesh(cdata_, arg0);
    return _return_value_;
}

}

#endif