Mech-Eye API 2.5.0
API reference documentation for Mech-Eye 3D Laser Profiler
All Classes Functions Variables Typedefs Enumerations Enumerator Pages
ProfileData.h
1#pragma once
2#include "api_global.h"
3#include "BatchArray.h"
4#include "CommonTypes.h"
5#include "ErrorStatus.h"
6
7namespace mmind {
8namespace eye {
9
10class ProfileBatchImpl;
11
15struct Profile
16{
17 unsigned int profileIndex{0};
18 unsigned int encoder{0};
19 const unsigned char* intensity{nullptr};
20 const float* depth{nullptr};
22};
23
29{
30 float x{0};
31 float y{0};
32 float z{0};
33 unsigned char intensity{0};
34};
35
41class MMIND_API_EXPORT ProfileBatch
42{
43public:
47 enum class BatchFlag {
48 Success =
49 0,
50 Incomplete = 0x1,
52 };
53
54 using ProfileIndexArray = BatchArray<unsigned int>;
55 using EncoderArray = BatchArray<unsigned int>;
56 using IntensityImage = BatchArray<unsigned char>;
57 using DepthMap = BatchArray<float>;
58 using UntexturedPointCloud = BatchArray<PointXYZ>;
59 using PointCloud = UntexturedPointCloud;
60 using TexturedPointCloud = BatchArray<PointXYZI>;
61
65 ProfileBatch(size_t width);
66
70 ~ProfileBatch() = default;
71
75 size_t width() const;
76
80 size_t height() const;
81
86 size_t validHeight() const;
87
91 bool isEmpty() const;
92
96 void reserve(size_t height);
97
101 bool append(const ProfileBatch& batch);
102
106 void clear();
107
111 Profile getProfile(size_t profileIndex) const;
112
118
124
129
136
154 double xResolution, double yResolution, bool useEncoderValues, int triggerInterval,
155 CoordinateUnit coordinateUnit = CoordinateUnit::Millimeter) const;
156
174 double xResolution, double yResolution, bool useEncoderValues, int triggerInterval,
175 CoordinateUnit coordinateUnit = CoordinateUnit::Millimeter) const;
176
203 ErrorStatus saveUntexturedPointCloud(double xResolution, double yResolution,
204 bool useEncoderValues, int triggerInterval,
205 FileFormat fileFormat, const std::string& fileName,
206 CoordinateUnit coordinateUnit = CoordinateUnit::Millimeter,
207 bool isOrganized = false) const;
208
235 ErrorStatus saveTexturedPointCloud(double xResolution, double yResolution,
236 bool useEncoderValues, int triggerInterval,
237 FileFormat fileFormat, const std::string& fileName,
238 CoordinateUnit coordinateUnit = CoordinateUnit::Millimeter,
239 bool isOrganized = false) const;
240
261 const UntexturedPointCloud& pointCloud, FileFormat fileFormat, const std::string& fileName,
262 bool isOrganized = false, CoordinateUnit coordinateUnit = CoordinateUnit::Millimeter);
263
283 const TexturedPointCloud& pointCloud, FileFormat FileFormat, const std::string& fileName,
284 bool isOrganized = false, CoordinateUnit coordinateUnit = CoordinateUnit::Millimeter);
285
290
294 int getFlag() const;
295
299 bool checkFlag(BatchFlag flag) const;
300
301private:
302 std::shared_ptr<ProfileBatchImpl> _impl;
303 friend class ProfilerImpl;
304 friend class VirtualProfilerImpl;
305};
306} // namespace eye
307} // namespace mmind
Represents the data struct of the profile data.
Definition BatchArray.h:15
Represents a batch of profiles, which can be obtained by calling Profiler::retrieveBatchData()....
Definition ProfileData.h:42
bool isEmpty() const
Checks if the ProfileBatch object has no elements.
EncoderArray getEncoderArray() const
Gets an array of encoder values of all profiles in the batch. Each profile data corresponds to an enc...
IntensityImage getIntensityImage() const
Gets the intensity image data in the batch. The invalid data of intensity image is 0.
int getFlag() const
Gets the flags of the ProfileBatch object. See BatchFlag for details.
void reserve(size_t height)
Reserves the input height for the ProfileBatch object.
static ErrorStatus saveUntexturedPointCloud(const UntexturedPointCloud &pointCloud, FileFormat fileFormat, const std::string &fileName, bool isOrganized=false, CoordinateUnit coordinateUnit=CoordinateUnit::Millimeter)
Saves the untextured point cloud data in the batch. Each point in UntexturedPointCloud contains the X...
TexturedPointCloud getTexturedPointCloud(double xResolution, double yResolution, bool useEncoderValues, int triggerInterval, CoordinateUnit coordinateUnit=CoordinateUnit::Millimeter) const
Gets the textured point cloud data in the batch. Each point in TexturedPointCloud contains the X,...
UntexturedPointCloud getUntexturedPointCloud(double xResolution, double yResolution, bool useEncoderValues, int triggerInterval, CoordinateUnit coordinateUnit=CoordinateUnit::Millimeter) const
Gets the untextured point cloud data in the batch. Each point in UntexturedPointCloud contains the X,...
size_t validHeight() const
Returns the valid height of the ProfileBatch object (the number of profiles with valid intensity and ...
void clear()
Clears the data in the ProfileBatch object.
~ProfileBatch()=default
Default destructor.
bool checkFlag(BatchFlag flag) const
Checks if the BatchFlag value of the ProfileBatch object matches the input value.
ProfileBatch(size_t width)
Constructor.
ErrorStatus saveUntexturedPointCloud(double xResolution, double yResolution, bool useEncoderValues, int triggerInterval, FileFormat fileFormat, const std::string &fileName, CoordinateUnit coordinateUnit=CoordinateUnit::Millimeter, bool isOrganized=false) const
Saves the untextured point cloud data in the batch. Each point in UntexturedPointCloud contains the X...
ProfileIndexArray getProfileIndexArray() const
Gets an array of indices of all profiles in the batch. Each profile data corresponds to an index.
ErrorStatus saveTexturedPointCloud(double xResolution, double yResolution, bool useEncoderValues, int triggerInterval, FileFormat fileFormat, const std::string &fileName, CoordinateUnit coordinateUnit=CoordinateUnit::Millimeter, bool isOrganized=false) const
Saves the textured point cloud data in the batch. Each point in TexturedPointCloud contains the X,...
static ErrorStatus saveTexturedPointCloud(const TexturedPointCloud &pointCloud, FileFormat FileFormat, const std::string &fileName, bool isOrganized=false, CoordinateUnit coordinateUnit=CoordinateUnit::Millimeter)
Saves the textured point cloud data in the batch. Each point in TexturedPointCloud contains the X,...
size_t width() const
Returns the width of the ProfileBatch object (the number of data points per profile).
ErrorStatus getErrorStatus() const
Gets the error code and description of the function.
bool append(const ProfileBatch &batch)
Appends the data of one ProfileBatch object to another.
size_t height() const
Returns the height of the ProfileBatch object (the number of profiles in the batch).
BatchFlag
Describes the status of the ProfileBatch object.
Definition ProfileData.h:47
DepthMap getDepthMap() const
Gets the depth map data in the batch. Each point in DepthMap contains the Z information in the laser ...
Profile getProfile(size_t profileIndex) const
Gets a profile in the batch by inputting the index of the profile.
Describes the types of errors.
Definition ErrorStatus.h:12
Represents a point in ProfileBatch::TexturedPointCloud with the coordinate (x, y, z,...
Definition ProfileData.h:29
float z
Z channel, default unit: mm, invalid data: nan.
Definition ProfileData.h:32
float x
X channel, default unit: mm, invalid data: nan.
Definition ProfileData.h:30
unsigned char intensity
intensity channel.
Definition ProfileData.h:33
float y
Y channel, default unit: mm, invalid data: nan.
Definition ProfileData.h:31
Describes a single profile.
Definition ProfileData.h:16
const unsigned char * intensity
Pointer to the intensity values of the profile.
Definition ProfileData.h:19
unsigned int encoder
Corresponding encoder value of the profile.
Definition ProfileData.h:18
const float * depth
Definition ProfileData.h:20
unsigned int profileIndex
Index of the profile.
Definition ProfileData.h:17