Thermal Camera SDK 10.0.1
SDK for Optris Thermal Cameras
Loading...
Searching...
No Matches
ImageBuilder.h
Go to the documentation of this file.
1// Copyright (c) 2025 Optris GmbH Co. KG
2
10
11#pragma once
12
13#include <memory>
14#include <array>
15
16#include "otcsdk/Api.h"
17
19#include "otcsdk/common/Image.h"
20
21
22namespace optris
23{
24
42{
45
54 TemperatureRegion(int x1, int y1, int x2, int y2) noexcept;
55
57 void reset() noexcept;
58
68 bool fitsInRectangle(int width, int height, int padding = 0) const noexcept;
69
70
73
75 int x1;
77 int y1;
78
80 int x2;
82 int y2;
83};
84
85
105
106
115
116
119{
120public:
122 using LookupTable = std::array<unsigned int, 65536>;
123
124
135
136
144 OTC_SDK_API void setThermalFrame(const ThermalFrame& thermalFrame);
145
151 const ThermalFrame& getThermalFrame() const noexcept;
152
158 int getWidth() const noexcept;
159
165 int getHeight() const noexcept;
166
176 OTC_SDK_API float getTemperature(int index) const;
177
191 OTC_SDK_API float getTemperature(int x, int y) const;
192
205
218 OTC_SDK_API bool getMinMaxRegions(int radius, TemperatureRegion& minRegion, TemperatureRegion& maxRegion);
219
220
221 // Image conversion
228 OTC_SDK_API void setManualTemperatureRange(float min, float max);
229
235 OTC_SDK_API float getIsothermalMin() const noexcept;
236
242 OTC_SDK_API float getIsothermalMax() const noexcept;
243
249 void setPaletteScalingMethod(PaletteScalingMethod method) noexcept;
250
257
263 void setPalette(ColoringPalette palette) noexcept;
264
270 OTC_SDK_API ColoringPalette getPalette() const noexcept;
271
277 const Image& getImage() noexcept;
278
284 int getImageSizeInBytes() const noexcept;
285
293 int getImageStride() const noexcept;
294
301 OTC_SDK_API void copyImageDataTo(unsigned char* destination, int size) const noexcept;
302
309
310
313
320
321
322private:
324 using PaletteTable = unsigned char (*)[3];
325
326
332 void getPaletteTable(PaletteTable& table) const noexcept;
333
334
336 void calculateIntegralImage();
337
339 void calcMinMaxScalingFactor();
340
346 void calcSigmaScalingFactor(float sigma);
347
348
350 ThermalFrame _thermalFrame;
352 TemperatureConverter _converter;
353
355 std::unique_ptr<unsigned long[]> _integral;
357 bool _integralIsDirty;
358
360 Image _image;
361
363 PaletteScalingMethod _scalingMethod;
364
366 unsigned short _min;
368 unsigned short _max;
369
371 ColoringPalette _palette;
372};
373
374
375// Inline implementations
376inline const ThermalFrame& ImageBuilder::getThermalFrame() const noexcept
377{
378 return _thermalFrame;
379}
380
381inline int ImageBuilder::getWidth() const noexcept
382{
383 return _thermalFrame.getWidth();
384}
385
386inline int ImageBuilder::getHeight() const noexcept
387{
388 return _thermalFrame.getHeight();
389}
390
392{
393 _scalingMethod = method;
394}
395
397{
398 return _scalingMethod;
399}
400
401inline void ImageBuilder::setPalette(ColoringPalette palette) noexcept
402{
403 _palette = palette;
404}
405
407{
408 return _palette;
409}
410
411inline const Image& ImageBuilder::getImage() noexcept
412{
413 return _image;
414}
415
416inline int ImageBuilder::getImageSizeInBytes() const noexcept
417{
418 return _image.getSizeInBytes();
419}
420
421inline int ImageBuilder::getImageStride() const noexcept
422{
423 return _image.getStride();
424}
425
426} // 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 a class that encapsulates false color images.
Contains a class encapsulating a thermal frame received from a device.
const Image & getImage() noexcept
Grants read access to the generated false color image.
Definition ImageBuilder.h:411
const ThermalFrame & getThermalFrame() const noexcept
Grants read access to the stored thermal frame.
Definition ImageBuilder.h:376
int getHeight() const noexcept
Returns the height in pixels of thermal frame.
Definition ImageBuilder.h:386
int getImageStride() const noexcept
Returns the image stride in bytes.
Definition ImageBuilder.h:421
OTC_SDK_API ColoringPalette getPalette() const noexcept
Returns the palette for the false color conversion.
Definition ImageBuilder.h:406
OTC_SDK_API float getIsothermalMax() const noexcept
Returns the maximum temperature used to scale the image.
void setPalette(ColoringPalette palette) noexcept
Sets the palette for the false color conversion.
Definition ImageBuilder.h:401
std::array< unsigned int, 65536 > LookupTable
Type for look up tables.
Definition ImageBuilder.h:122
int getImageSizeInBytes() const noexcept
Returns the image size in bytes including potential width padding.
Definition ImageBuilder.h:416
OTC_SDK_API bool getMeanTemperatureInRegion(TemperatureRegion &meanRegion)
Returns the mean temperature in °C of a rectangular region.
OTC_SDK_API void convertTemperatureToPaletteImage()
Triggers the image conversion.
OTC_SDK_API void setManualTemperatureRange(float min, float max)
Sets the temperature range for the manual scaling method.
OTC_SDK_API LookupTable createLookupTable()
Creates a lookup table for the false color conversion..
OTC_SDK_API void copyImageDataTo(unsigned char *destination, int size) const noexcept
Copies the false color image data to the given destination array.
int getWidth() const noexcept
Returns the width in pixels of the thermal frame.
Definition ImageBuilder.h:381
void setPaletteScalingMethod(PaletteScalingMethod method) noexcept
Sets the scaling method for the false color conversion.
Definition ImageBuilder.h:391
PaletteScalingMethod getPaletteScalingMethod() const noexcept
Returns the current scaling method for the false color conversion.
Definition ImageBuilder.h:396
OTC_SDK_API ImageBuilder(ColorFormat colorFormat, WidthAlignment widthAlignment)
Constructor.
OTC_SDK_API float getIsothermalMin() const noexcept
Returns the minimum temperature used to scale the image.
OTC_SDK_API bool getMinMaxRegions(int radius, TemperatureRegion &minRegion, TemperatureRegion &maxRegion)
Returns the region of minimum/maximum temperature in °C with the given radius.
OTC_SDK_API void setThermalFrame(const ThermalFrame &thermalFrame)
Sets a new thermal frame.
OTC_SDK_API float getTemperature(int index) const
Returns the temperature the from last acquired image at specified pixel index.
Encapsulates false color images with 8-bit color depth.
Definition Image.h:38
Converts temperatures in °C to and from their internal SDK representation.
Definition TemperatureConverter.h:23
Encapsulates thermal frame data received from a device.
Definition ThermalFrame.h:23
Main SDK namespace.
Definition DeviceInfo.h:23
ColorFormat
Represents the different available color formats.
Definition ImageInfo.h:32
ColoringPalette
Represents the available coloring palettes.
Definition ImageBuilder.h:92
@ Medical
Definition ImageBuilder.h:100
@ AlarmGreen
Definition ImageBuilder.h:97
@ GrayWB
Definition ImageBuilder.h:96
@ IronHi
Definition ImageBuilder.h:99
@ Rainbow
Definition ImageBuilder.h:101
@ AlarmBlue
Definition ImageBuilder.h:93
@ AlarmBlueHi
Definition ImageBuilder.h:94
@ GrayBW
Definition ImageBuilder.h:95
@ RainbowHi
Definition ImageBuilder.h:102
@ Iron
Definition ImageBuilder.h:98
@ AlarmRed
Definition ImageBuilder.h:103
PaletteScalingMethod
Represents the false color conversion strategies.
Definition ImageBuilder.h:109
@ Sigma3
Same as eSigma1, but with factor 3.
Definition ImageBuilder.h:113
@ MinMax
Dynamic determination of minimum and maximum temperature as upper and lower limit.
Definition ImageBuilder.h:111
@ Manual
User-defined upper and lower limit (fixed values).
Definition ImageBuilder.h:110
@ Sigma1
Dynamic determination of upper and lower limit from standard deviation of temperature image.
Definition ImageBuilder.h:112
WidthAlignment
Represents the different available width alignments.
Definition ImageInfo.h:47
Characterizes a rectangular region by the indexes of the upper left and the lower right corners along...
Definition ImageBuilder.h:42
bool fitsInRectangle(int width, int height, int padding=0) const noexcept
Returns whether the region fits within a rectangle of the given dimensions.
int y2
Y index of the lower right corner.
Definition ImageBuilder.h:82
int x2
X index of the lower right corner.
Definition ImageBuilder.h:80
TemperatureRegion() noexcept
Constructor.
float temperature
Associated temperature in °C.
Definition ImageBuilder.h:72
int y1
Y index of the upper left corner.
Definition ImageBuilder.h:77
void reset() noexcept
Resets the temperature and the coordinates of the corners.
int x1
X index of the upper left corner.
Definition ImageBuilder.h:75