38#include "api_global.h"
39#include "MechEyeDataType.h"
44template <
typename ElementType>
88typedef Frame<ElementColor> ColorMap;
90typedef Frame<ElementDepth> DepthMap;
92typedef Frame<ElementPointXYZ> PointXYZMap;
94typedef Frame<ElementPointXYZBGR> PointXYZBGRMap;
99template <
typename ElementType>
106 Frame() : _width(0), _height(0), _pData(nullptr) {}
115 inline uint32_t
width()
const {
return _width; }
120 inline uint32_t
height()
const {
return _height; }
125 inline bool empty()
const {
return !_pData; }
130 inline const ElementType*
data()
const {
return _pData.get(); }
147 if (n >= _height * _width || !_pData)
148 throw std::out_of_range(
"invalid subscript");
149 ElementType*
data = _pData.get();
170 const ElementType&
at(uint32_t row, uint32_t col)
const
172 if (row >= _height || col >= _width || !_pData)
173 throw std::out_of_range(
"invalid subscript");
174 ElementType*
data = _pData.get();
175 return data[row * _width + col];
185 ElementType&
at(uint32_t row, uint32_t col)
203 _pData.reset(
new ElementType[_width * _height], [](ElementType* p) {
delete[] p; });
219 std::shared_ptr<ElementType> _pData;
225 LineBatch() : _lineCount(0), _columnCount(0) {}
240 void setLineCount(uint32_t lineCount) { _lineCount = lineCount; }
241 uint32_t lineCount()
const {
return _lineCount; }
242 uint32_t columnCount()
const {
return _columnCount; }
244 float depthAt(uint32_t row, uint32_t col)
const {
return _depth.
at(row, col); }
245 unsigned char intensityAt(uint32_t row, uint32_t col)
const {
return _intensity.
at(row, col); }
246 unsigned int encoderAt(uint32_t row, uint32_t col)
const {
return _encoder.
at(row, col); }
247 long long frameIdAt(uint32_t row, uint32_t col)
const {
return _frameId.
at(row, col); }
249 void resize(uint32_t width, uint32_t height)
251 _columnCount = width;
253 _depth.
resize(_columnCount, _lineCount);
254 _intensity.
resize(_columnCount, _lineCount);
255 _encoder.
resize(1, _lineCount);
256 _frameId.
resize(1, _lineCount);
265 uint32_t _columnCount;
Definition of data structure in device capturing image.
const ElementType & operator[](std::size_t n) const
void resize(uint32_t width, uint32_t height)
ElementType & at(uint32_t row, uint32_t col)
const ElementType & at(uint32_t row, uint32_t col) const
const ElementType * data() const
ElementType & operator[](std::size_t n)
float d
Depth channel, unit: mm.
Element in PointXYZBGRMap.
float y
Y channel, unit: mm.
float x
X channel, unit: mm.
float z
Z channel, unit: mm.
float x
X channel, unit: mm.
float z
Z channel, unit: mm.
float y
Y channel, unit: mm.