Mech-Eye API 2.2.1
API reference documentation for Mech-Eye Industrial 3D Camera
All Classes Functions Variables Enumerations Enumerator Pages
Frame3D.h
1/*******************************************************************************
2 * BSD 3-Clause License
3 *
4 * Copyright (c) 2016-2023, Mech-Mind Robotics
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 * Info: https://www.mech-mind.com/
33 *
34 ******************************************************************************/
35
36#pragma once
37#include <memory>
38#include "api_global.h"
39#include "Array2D.h"
40#include "ErrorStatus.h"
41#include "CommonTypes.h"
42
43namespace mmind {
44
45namespace eye {
46
50struct PointZ
51{
52 float z{0};
53};
54
59{
60 float x{0};
61 float y{0};
62 float z{0};
63};
64
69{
70 float x{0};
71 float y{0};
72 float z{0};
73};
74
80{
81 PointXYZ point;
82 NormalVector normal;
83};
84
90
91enum struct FileFormat {
92 PLY,
93 PCD,
94 CSV,
95};
96
104class MMIND_API_EXPORT Frame3D
105{
106public:
111
116
120 Frame3D(const Frame3D& other) noexcept;
121
125 Frame3D& operator=(const Frame3D& other) noexcept;
126
131
135 bool isEmpty() const;
136
140 void clear();
141
149
159
168
181 DepthMap getOrthogonalDepthMap(double& xScale, double& yScale, double& xOffset,
182 double& yOffset) const;
183
198 ErrorStatus saveUntexturedPointCloud(FileFormat fileFormat, const std::string& fileName,
199 bool isOrganized = false) const;
200
216 const std::string& fileName,
217 bool isOrganized = false) const;
218
234 static ErrorStatus savePointCloud(const PointCloud& pointCloud, FileFormat fileFormat,
235 const std::string& fileName, bool isOrganized = false);
236
252 FileFormat fileFormat, const std::string& fileName,
253 bool isOrganized = false);
254
255private:
256 friend class CameraImpl;
257 friend class Frame2DAnd3D;
258
259 std::shared_ptr<class Frame3DImpl> _impl;
260 Frame3D(std::shared_ptr<Frame3DImpl>& frameImpl);
261};
262
263} // namespace eye
264
265} // namespace mmind
Represents a 2D container of data.
Definition Array2D.h:17
Represents the 2D and 3D scanning result, which can be obtained by calling Camera::capture2DAnd3D or ...
Represents the 3D scanning result, which can be obtained by calling Camera::capture3D or Camera::capt...
Definition Frame3D.h:105
ErrorStatus saveUntexturedPointCloudWithNormals(FileFormat fileFormat, const std::string &fileName, bool isOrganized=false) const
Saves the untextured point cloud to a file with input file format and input file name....
DepthMap getOrthogonalDepthMap(double &xScale, double &yScale, double &xOffset, double &yOffset) const
Obtains the 3D data map with the PointZ pixel data format. The 3D data is projected under the orthogr...
~Frame3D()
Destructor.
void clear()
Clears the data in Frame3D and releases the related resources.
Frame3D()
Constructor.
PointCloudWithNormals getUntexturedPointCloudWithNormals() const
Obtains the organized 3D data map with a PointXYZWithNormals pixel data format. Each point in PointCl...
bool isEmpty() const
Judges whether Frame3D is empty.
static ErrorStatus savePointCloudWithNormals(const PointCloudWithNormals &pointCloud, FileFormat fileFormat, const std::string &fileName, bool isOrganized=false)
Saves the untextured point cloud to a file with input file format and input file name....
Frame3D & operator=(const Frame3D &other) noexcept
Copy assignment.
Size imageSize() const
Gets the image size information of Frame3D.
Frame3D(const Frame3D &other) noexcept
Copy constructor.
ErrorStatus saveUntexturedPointCloud(FileFormat fileFormat, const std::string &fileName, bool isOrganized=false) const
Saves the untextured point cloud to a file with input file format and input file name....
static ErrorStatus savePointCloud(const PointCloud &pointCloud, FileFormat fileFormat, const std::string &fileName, bool isOrganized=false)
Saves the untextured point cloud to a file with input file format and input file name....
DepthMap getDepthMap() const
Obtains the organized 3D data map with a PointZ pixel data format. Each point in DepthMap contains th...
PointCloud getUntexturedPointCloud() const
Obtains the organized 3D data map with a PointXYZ pixel data format. Each point in PointCloud contain...
Describes the types of errors.
Definition ErrorStatus.h:12
The pixel element struct with normal vector X, Y, and Z information.
Definition Frame3D.h:69
float y
Normal vector Y coordinate, invalid data: nan.
Definition Frame3D.h:71
float z
Normal vector Z coordinate, invalid data: nan.
Definition Frame3D.h:72
float x
Normal vector X coordinate, invalid data: nan.
Definition Frame3D.h:70
The pixel element struct in UntexturedPointCloud with X, Y, and Z information.
Definition Frame3D.h:59
float z
Z channel, unit: mm, invalid data: nan.
Definition Frame3D.h:62
float y
Y channel, unit: mm, invalid data: nan.
Definition Frame3D.h:61
float x
X channel, unit: mm, invalid data: nan.
Definition Frame3D.h:60
The pixel element struct in UntexturedPointCloudWithNormals with X, Y, Z, normalX,...
Definition Frame3D.h:80
The pixel element struct in DepthMap with Z information.
Definition Frame3D.h:51
float z
Depth channel, unit: mm, invalid data: nan.
Definition Frame3D.h:52
Describes a size with a width and a height.
Definition CommonTypes.h:22