Thermal Camera SDK 10.0.1
SDK for Optris Thermal Cameras
Loading...
Searching...
No Matches
Pixel.h
Go to the documentation of this file.
1// Copyright (c) 2025 Optris GmbH Co. KG
2
10
11#pragma once
12
13#include <string>
14#include <ostream>
15
16
17namespace optris
18{
19
21class Pixel
22{
23public:
25 Pixel() noexcept;
26
34 Pixel(unsigned char red, unsigned char green, unsigned char blue) noexcept;
35
36
42 unsigned char getRed() const noexcept;
43
49 unsigned char getGreen() const noexcept;
50
56 unsigned char getBlue() const noexcept;
57
58
60 bool operator==(const Pixel& rhs) const noexcept;
62 bool operator!=(const Pixel& rhs) const noexcept;
63
64
70 std::string toString() const noexcept;
71
72
73private:
74 unsigned char _red;
75 unsigned char _green;
76 unsigned char _blue;
77};
78
79
80// Utility functions
89std::ostream& operator<<(std::ostream& out, const Pixel& pixel) noexcept;
90
91
92// Inline implementations
93inline Pixel::Pixel() noexcept
94 : _red{0U}
95 , _green{0U}
96 , _blue{0U}
97{ }
98
99inline Pixel::Pixel(unsigned char red, unsigned char green, unsigned char blue) noexcept
100 : _red{red}
101 , _green{green}
102 , _blue{blue}
103{ }
104
105inline unsigned char Pixel::getRed() const noexcept
106{
107 return _red;
108}
109
110inline unsigned char Pixel::getGreen() const noexcept
111{
112 return _green;
113}
114
115inline unsigned char Pixel::getBlue() const noexcept
116{
117 return _blue;
118}
119
120inline bool Pixel::operator==(const Pixel& rhs) const noexcept
121{
122 return _red == rhs._red &&
123 _green == rhs._green &&
124 _blue == rhs._blue;
125}
126
127inline bool Pixel::operator!=(const Pixel& rhs) const noexcept
128{
129 return !operator==(rhs);
130}
131
132inline std::string Pixel::toString() const noexcept
133{
134 return "(" + std::to_string(_red) + ", " + std::to_string(_green) + ", " + std::to_string(_blue) + ")";
135}
136
137inline std::ostream& operator<<(std::ostream& out, const Pixel& pixel) noexcept
138{
139 out << pixel.toString();
140
141 return out;
142}
143
144} // namespace optris
Represents a pixel with three color channels and 8 bits of color depth.
Definition Pixel.h:22
bool operator==(const Pixel &rhs) const noexcept
Equal operator.
Definition Pixel.h:120
unsigned char getBlue() const noexcept
Returns the blue color value.
Definition Pixel.h:115
unsigned char getRed() const noexcept
Returns the red color value.
Definition Pixel.h:105
bool operator!=(const Pixel &rhs) const noexcept
Unequal operator.
Definition Pixel.h:127
Pixel() noexcept
Constructor.
Definition Pixel.h:93
std::string toString() const noexcept
Returns a string representation of the pixel (red, green, blue).
Definition Pixel.h:132
unsigned char getGreen() const noexcept
Returns the green color value.
Definition Pixel.h:110
Main SDK namespace.
Definition DeviceInfo.h:23
OTC_SDK_API std::ostream & operator<<(std::ostream &out, DeviceType deviceType) noexcept
Output stream operator for device types.