Mech-Eye API 2.4.0
API reference documentation for Mech-Eye Industrial 3D Camera
Loading...
Searching...
No Matches
Frame2DAnd3D.h
1/*******************************************************************************
2 * BSD 3-Clause License
3 *
4 * Copyright (c) 2016-2024, 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 "Frame2D.h"
40#include "Frame3D.h"
41
42namespace mmind {
43
44namespace eye {
45
52{
53 PointXYZBGR() : PointXYZBGR(0, 0, 0, 255) {}
54 PointXYZBGR(float x, float y, float z) : PointXYZBGR(x, y, z, 0, 0, 0, 255) {}
55 PointXYZBGR(uint8_t b, uint8_t g, uint8_t r, uint8_t a) : PointXYZBGR(0, 0, 0, b, g, r, a) {}
56 PointXYZBGR(float x, float y, float z, uint8_t b, uint8_t g, uint8_t r, uint8_t a = 255)
57 : x(x), y(y), z(z), r(r), g(g), b(b), a(a)
58 {
59 }
60 PointXYZBGR(const PointXYZBGR& p) : PointXYZBGR(p.x, p.y, p.z, p.b, p.g, p.r, p.a) {}
61
62public:
63 float x;
64 float y;
65 float z;
66
67 union {
68 struct
69 {
74 };
75 float rgb;
76 };
77};
78
85{
86 PointXYZBGR colorPoint;
87 NormalVector normal;
88};
89
92
100class MMIND_API_EXPORT Frame2DAnd3D
101{
102public:
107
112
117
122
127
132
136 void clear();
137
147
159
179 bool isOrganized = false) const;
180
200 const std::string& fileName,
201 bool isOrganized = false) const;
202
224 const std::string& fileName, bool isOrganized = false,
225 CoordinateUnit pointCloudUnit = CoordinateUnit::Millimeter);
226
249 const std::string& fileName, bool isOrganized = false,
250 CoordinateUnit pointCloudUnit = CoordinateUnit::Millimeter);
251
252private:
253 std::shared_ptr<class Frame2DAnd3DImpl> _impl;
254 friend class CameraImpl;
255 friend class InternalInterfaces;
257};
258
259} // namespace eye
260
261} // namespace mmind
Represents a 2D container of data.
Definition Array2D.h:17
Represents the 2D and 3D capture results, which can be obtained by calling Camera::capture2DAnd3D....
TexturedPointCloudWithNormals getTexturedPointCloudWithNormals() const
Gets the pixel-aligned 2D and 3D data with the PointXYZBGRWithNormals pixel data format....
~Frame2DAnd3D()
Destructor.
ErrorStatus saveTexturedPointCloudWithNormals(FileFormat fileFormat, const std::string &fileName, bool isOrganized=false) const
Saves the textured point cloud to a file of the input file format and filename. Each point contains x...
Frame2D frame2D() const
Gets the Frame2D data part.
ErrorStatus saveTexturedPointCloud(FileFormat fileFormat, const std::string &fileName, bool isOrganized=false) const
Saves the textured point cloud to a file of the input file format and filename. Each point contains x...
static ErrorStatus savePointCloud(const TexturedPointCloud &pointCloud, FileFormat fileFormat, const std::string &fileName, bool isOrganized=false, CoordinateUnit pointCloudUnit=CoordinateUnit::Millimeter)
Saves the textured point cloud to a file of the input file format and filename. Each point contains x...
Frame2DAnd3D()
Constructor.
Frame2DAnd3D(const Frame2DAnd3D &other) noexcept
Copy constructor.
static ErrorStatus savePointCloudWithNormals(const TexturedPointCloudWithNormals &pointCloud, FileFormat fileFormat, const std::string &fileName, bool isOrganized=false, CoordinateUnit pointCloudUnit=CoordinateUnit::Millimeter)
Saves the textured point cloud to a file of the input file format and filename. Each point contains x...
Frame2DAnd3D & operator=(const Frame2DAnd3D &other) noexcept
Copy assignment.
Frame3D frame3D() const
Gets the Frame3D data part.
TexturedPointCloud getTexturedPointCloud() const
Gets the 2D and 3D data aligned pixel-to-pixel with the PointXYZBGR data format. Each point in Textur...
void clear()
Clears the data in Frame2DAnd3D and releases the associated resources.
Represents the 2D capture result, which can be obtained by calling Camera::capture2D....
Definition Frame2D.h:73
Represents the 3D capture result, which can be obtained by calling Camera::capture3D....
Definition Frame3D.h:112
Describes the types of errors.
Definition ErrorStatus.h:12
The pixel element struct with the normal vector coordinate (x, y, z) information.
Definition Frame3D.h:74
Represents a point in TexturedPointCloud with the coordinate (x, y, z) and texture (blue,...
float z
Z channel, default unit: mm, invalid data: nan.
float y
Y channel, default unit: mm, invalid data: nan.
uint8_t r
Red channel.
uint8_t b
Blue channel.
uint8_t a
Transparency channel.
uint8_t g
Green channel.
float x
X channel, default unit: mm, invalid data: nan.
The pixel element struct in TexturedPointCloudWithNormals with the coordinate (x, y,...