Thermal Camera SDK 11.3.0
SDK for Optris Thermal Cameras
Loading...
Searching...
No Matches
Image.h
Go to the documentation of this file.
1// Copyright (c) 2008-2026 Optris GmbH & Co. KG
2
10
11#pragma once
12
13#include <vector>
14
15#include "otcsdk/Api.h"
16#include "otcsdk/Exceptions.h"
17#include "otcsdk/common/Pixel.h"
19
20
21namespace optris
22{
23
36class Image
37{
38public:
47 OTC_SDK_API Image(ColorFormat colorFormat, WidthAlignment widthAlignment) noexcept;
48
49
59 OTC_SDK_API Pixel getPixel(int index) const;
60
71 OTC_SDK_API Pixel getPixel(int x, int y) const;
72
81 OTC_SDK_API void setPixel(int index, const Pixel& pixel);
82
92 OTC_SDK_API void setPixel(int x, int y, const Pixel& pixel);
93
99 OTC_SDK_API int getWidth() const noexcept;
100
108 OTC_SDK_API int getStride() const noexcept;
109
115 OTC_SDK_API int getHeight() const noexcept;
116
122 OTC_SDK_API int getSize() const noexcept;
123
131 OTC_SDK_API int getSizeInBytes() const noexcept;
132
138 OTC_SDK_API bool isEmpty() const noexcept;
139
142
149 OTC_SDK_API void resize(int width, int height);
150
156 OTC_SDK_API ColorFormat getColorFormat() const noexcept;
157
164
178 OTC_SDK_API void copyDataTo(unsigned char* destination, int size) const noexcept;
179
189 OTC_SDK_API const unsigned char* getData() const noexcept;
190
200 OTC_SDK_API unsigned char* getData() noexcept;
201
202
203private:
204 ImageInfo _info;
205
206 std::vector<unsigned char> _pixelValues;
207};
208
209
210// Inline implementations
211inline int Image::getWidth() const noexcept
212{
213 return _info.getWidth();
214}
215
216inline int Image::getStride() const noexcept
217{
218 return _info.getStride();
219}
220
221inline int Image::getHeight() const noexcept
222{
223 return _info.getHeight();
224}
225
226inline int Image::getSize() const noexcept
227{
228 return _info.getSize();
229}
230
231inline int Image::getSizeInBytes() const noexcept
232{
233 return static_cast<unsigned int>(_pixelValues.size());
234}
235
236inline bool Image::isEmpty() const noexcept
237{
238 return _pixelValues.empty();
239}
240
241inline ColorFormat Image::getColorFormat() const noexcept
242{
243 return _info.getColorFormat();
244}
245
247{
248 return _info.getWidthAlignment();
249}
250
251inline const unsigned char* Image::getData() const noexcept
252{
253 return _pixelValues.data();
254}
255
256inline unsigned char* Image::getData() noexcept
257{
258 return _pixelValues.data();
259}
260
261} // namespace optris
Contains defines controlling the Windows DLL export and import of symbols.
#define OTC_SDK_API
Only needed when working with Windows DLLs.
Definition Api.h:65
Contains the exceptions raised by the SDK.
Contains a class holding detail information about the properties of a false color image.
Contains a class encapsulating a pixel with three color channels and 8 bits of color depth.
Encapsulates all relevant information about a false color image.
Definition ImageInfo.h:57
OTC_SDK_API bool isEmpty() const noexcept
Returns whether the image is empty.
Definition Image.h:236
OTC_SDK_API void copyDataTo(unsigned char *destination, int size) const noexcept
Copies the internally stored pixel values to the given array.
OTC_SDK_API int getStride() const noexcept
Returns the stride of the image in bytes.
Definition Image.h:216
OTC_SDK_API int getHeight() const noexcept
Returns the height of the image in pixels.
Definition Image.h:221
OTC_SDK_API Pixel getPixel(int x, int y) const
Returns the pixel at the given coordinates.
OTC_SDK_API int getSizeInBytes() const noexcept
Returns the size of the internal storage in bytes.
Definition Image.h:231
OTC_SDK_API Pixel getPixel(int index) const
Returns the pixel at the given index.
OTC_SDK_API void clear()
Clears the image.
OTC_SDK_API Image(ColorFormat colorFormat, WidthAlignment widthAlignment) noexcept
Constructor.
OTC_SDK_API void setPixel(int x, int y, const Pixel &pixel)
Sets the pixel at the given coordinates.
OTC_SDK_API void resize(int width, int height)
Resizes the image to the given dimensions.
OTC_SDK_API WidthAlignment getWidthAlignment() const noexcept
Returns the width alignment.
Definition Image.h:246
OTC_SDK_API void setPixel(int index, const Pixel &pixel)
Sets the pixel at the given index.
OTC_SDK_API int getWidth() const noexcept
Returns the width of the image in pixels.
Definition Image.h:211
OTC_SDK_API int getSize() const noexcept
Returns the size of the image as total number of pixels.
Definition Image.h:226
OTC_SDK_API ColorFormat getColorFormat() const noexcept
Returns the color format.
Definition Image.h:241
OTC_SDK_API const unsigned char * getData() const noexcept
Returns a pointer to the first element of the internal array.
Definition Image.h:251
Represents a pixel with three color channels and 8 bits of color depth.
Definition Pixel.h:22
Main SDK namespace.
Definition AlarmChannel.h:21
ColorFormat
Represents the different available color formats.
Definition ImageInfo.h:32
WidthAlignment
Represents the different available width alignments.
Definition ImageInfo.h:47