Mech-Eye API 2.3.3
API reference documentation for Mech-Eye Industrial 3D Camera
Loading...
Searching...
No Matches
Frame2D.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 "CameraProperties.h"
40#include "Array2D.h"
41
42namespace mmind {
43
44namespace eye {
45
49struct Gray
50{
51 uint8_t gray{0};
52};
53
58{
59 uint8_t b{0};
60 uint8_t g{0};
61 uint8_t r{0};
62};
63
64using GrayScale2DImage = Array2D<Gray>;
65using Color2DImage = Array2D<ColorBGR>;
66
72class MMIND_API_EXPORT Frame2D
73{
74public:
79
84
88 Frame2D(const Frame2D& other) noexcept;
89
93 Frame2D& operator=(const Frame2D& other) noexcept;
94
98 Size imageSize() const;
99
103 bool isEmpty() const;
104
108 ColorTypeOf2DCamera colorType() const;
109
113 void clear();
114
124
134
135private:
136 friend class CameraImpl;
137 friend class Frame2DAnd3D;
138 friend class InternalInterfaces;
139
140 std::shared_ptr<class Frame2DImpl> _impl;
141 Frame2D(std::shared_ptr<Frame2DImpl>& frameImpl);
142};
143
144} // namespace eye
145} // 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....
Represents the 2D capture result, which can be obtained by calling Camera::capture2D....
Definition Frame2D.h:73
ColorTypeOf2DCamera colorType() const
Gets the color type of the 2D camera in the 3D camera.
Frame2D(const Frame2D &other) noexcept
Constructor.
Color2DImage getColorImage() const
Gets the image data of the Frame2D with the ColorBGR pixel format. If the 2D camera's color type (acc...
bool isEmpty() const
Judges whether Frame2D is empty.
Frame2D & operator=(const Frame2D &other) noexcept
Copy assignment.
void clear()
Clears the data in Frame2D and releases the associated resources.
GrayScale2DImage getGrayScaleImage() const
Gets image data of the Frame2D with the Gray pixel format. If the 2D camera's color type (according t...
Size imageSize() const
Gets the image size of Frame2D.
~Frame2D()
Destructor.
Frame2D()
Constructor.
Represents a pixel in Color2DImage with blue, green, and red channel information.
Definition Frame2D.h:58
uint8_t b
Blue channel.
Definition Frame2D.h:59
uint8_t r
Red channel.
Definition Frame2D.h:61
uint8_t g
Green channel.
Definition Frame2D.h:60
Represents a pixel in GrayScale2DImage with grayscale channel information.
Definition Frame2D.h:50
uint8_t gray
Grayscale channel.
Definition Frame2D.h:51
Describes a two-dimensional size with a width and a height.
Definition CommonTypes.h:22