Mech-Eye API 2.5.1
API reference documentation for Mech-Eye 3D Laser Profiler
Loading...
Searching...
No Matches
ProfileData.h
Go to the documentation of this file.
1/*******************************************************************************
2 *BSD 3-Clause License
3 *
4 *Copyright (c) 2016-2025, Mech-Mind Robotics Technologies Co., Ltd.
5 *All rights reserved.
6 *
7 *Redistribution and use in source and binary forms, with or without
8 *modification, are permitted provided that the following conditions are met:
9 *
10 *1. Redistributions of source code must retain the above copyright notice, this
11 * list of conditions and the following disclaimer.
12 *
13 *2. Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 *
17 *3. Neither the name of the copyright holder nor the names of its
18 * contributors may be used to endorse or promote products derived from
19 * this software without specific prior written permission.
20 *
21 *THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 *AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 *IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 *DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 *DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 *SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 *CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 *OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 *OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 ******************************************************************************/
32
33#pragma once
34#include "api_global.h"
35#include "BatchArray.h"
36#include "CommonTypes.h"
37#include "ErrorStatus.h"
38
39namespace mmind {
40namespace eye {
41
42class ProfileBatchImpl;
43
47struct Profile
48{
49 unsigned int profileIndex{0};
50 unsigned int encoder{0};
51 const unsigned char* intensity{nullptr};
52 const float* depth{nullptr};
54};
55
61{
62 float x{0};
63 float y{0};
64 float z{0};
65 unsigned char intensity{0};
66};
67
74{
75public:
79 enum class BatchFlag {
80 Success =
81 0,
82 Incomplete = 0x1,
84 };
85
93
97 ProfileBatch(size_t width);
98
102 ~ProfileBatch() = default;
103
107 size_t width() const;
108
112 size_t height() const;
113
118 size_t validHeight() const;
119
123 bool isEmpty() const;
124
128 void reserve(size_t height);
129
133 bool append(const ProfileBatch& batch);
134
138 void clear();
139
143 Profile getProfile(size_t profileIndex) const;
144
150
156
161
168
186 double xResolution, double yResolution, bool useEncoderValues, int triggerInterval,
187 CoordinateUnit coordinateUnit = CoordinateUnit::Millimeter) const;
188
206 double xResolution, double yResolution, bool useEncoderValues, int triggerInterval,
207 CoordinateUnit coordinateUnit = CoordinateUnit::Millimeter) const;
208
235 ErrorStatus saveUntexturedPointCloud(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
267 ErrorStatus saveTexturedPointCloud(double xResolution, double yResolution,
268 bool useEncoderValues, int triggerInterval,
269 FileFormat fileFormat, const std::string& fileName,
270 CoordinateUnit coordinateUnit = CoordinateUnit::Millimeter,
271 bool isOrganized = false) const;
272
293 const UntexturedPointCloud& pointCloud, FileFormat fileFormat, const std::string& fileName,
294 bool isOrganized = false, CoordinateUnit coordinateUnit = CoordinateUnit::Millimeter);
295
315 const TexturedPointCloud& pointCloud, FileFormat FileFormat, const std::string& fileName,
316 bool isOrganized = false, CoordinateUnit coordinateUnit = CoordinateUnit::Millimeter);
317
322
326 int getFlag() const;
327
331 bool checkFlag(BatchFlag flag) const;
332
333private:
334 std::shared_ptr<ProfileBatchImpl> _impl;
335 friend class ProfilerImpl;
336 friend class VirtualProfilerImpl;
337};
338} // namespace eye
339} // namespace mmind
#define MMIND_API_EXPORT
Definition api_global.h:48
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:74
void reserve(size_t height)
Reserves the input height for the ProfileBatch object.
ProfileIndexArray getProfileIndexArray() const
Gets an array of indices of all profiles in the batch. Each profile data corresponds to an index.
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,...
size_t validHeight() const
Returns the valid height of the ProfileBatch object (the number of profiles with valid intensity and ...
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,...
bool append(const ProfileBatch &batch)
Appends the data of one ProfileBatch object to another.
size_t width() const
Returns the width of the ProfileBatch object (the number of data points per profile).
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,...
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...
int getFlag() const
Gets the flags of the ProfileBatch object. See BatchFlag for details.
Profile getProfile(size_t profileIndex) const
Gets a profile in the batch by inputting the index of the profile.
~ProfileBatch()=default
Default destructor.
void clear()
Clears the data in the ProfileBatch object.
IntensityImage getIntensityImage() const
Gets the intensity image data in the batch. The invalid data of intensity image is 0.
BatchFlag
Describes the status of the ProfileBatch object.
Definition ProfileData.h:79
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...
EncoderArray getEncoderArray() const
Gets an array of encoder values of all profiles in the batch. Each profile data corresponds to an enc...
bool isEmpty() const
Checks if the ProfileBatch object has no elements.
DepthMap getDepthMap() const
Gets the depth map data in the batch. Each point in DepthMap contains the Z information in the laser ...
size_t height() const
Returns the height of the ProfileBatch object (the number of profiles in the batch).
ProfileBatch(size_t width)
Constructor.
ErrorStatus getErrorStatus() const
Gets the error code and description of the function.
bool checkFlag(BatchFlag flag) const
Checks if the BatchFlag value of the ProfileBatch object matches the input value.
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,...
FileFormat
Definition CommonTypes.h:18
CoordinateUnit
The unit of the coordinate data of the point cloud.
Definition CommonTypes.h:16
Definition Array2D.h:8
Describes the types of errors.
Definition ErrorStatus.h:12
Represents a point in ProfileBatch::TexturedPointCloud with the coordinate (x, y, z,...
Definition ProfileData.h:61
unsigned char intensity
intensity channel.
Definition ProfileData.h:65
float y
Y channel, default unit: mm, invalid data: nan.
Definition ProfileData.h:63
float x
X channel, default unit: mm, invalid data: nan.
Definition ProfileData.h:62
float z
Z channel, default unit: mm, invalid data: nan.
Definition ProfileData.h:64
Describes a single profile.
Definition ProfileData.h:48
unsigned int profileIndex
Index of the profile.
Definition ProfileData.h:49
const unsigned char * intensity
Pointer to the intensity values of the profile.
Definition ProfileData.h:51
const float * depth
Definition ProfileData.h:52
unsigned int encoder
Corresponding encoder value of the profile.
Definition ProfileData.h:50