Thermal Camera SDK 11.3.0
SDK for Optris Thermal Cameras
Loading...
Searching...
No Matches
optris::ImageBuilder Class Reference

Creates false color images from thermal frames. More...

#include <ImageBuilder.h>

Collaboration diagram for optris::ImageBuilder:
Collaboration graph

Public Types

using LookupTable = std::array<unsigned int, 65536>
 Type for look up tables.
 

Public Member Functions

OTC_SDK_API ImageBuilder (ColorFormat colorFormat, WidthAlignment widthAlignment)
 Constructor.
 
OTC_SDK_API void setThermalFrame (const ThermalFrame &thermalFrame)
 Sets a new thermal frame.
 
const ThermalFramegetThermalFrame () const noexcept
 Grants read access to the stored thermal frame.
 
int getWidth () const noexcept
 Returns the width in pixels of the thermal frame.
 
int getHeight () const noexcept
 Returns the height in pixels of thermal frame.
 
OTC_SDK_API float getTemperature (int index) const
 Returns the temperature the from last acquired image at specified pixel index.
 
OTC_SDK_API float getTemperature (int x, int y) const
 Returns the temperature from last acquired image at specified pixel coordinates.
 
OTC_SDK_API bool getMeanTemperatureInRegion (TemperatureRegion &meanRegion)
 Returns the mean temperature in °C of a rectangular region.
 
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 setTemperatureScaling (float min, float max)
 Sets the temperature range for the manual scaling mode.
 
OTC_SDK_API float getTemperatureScalingMin () const noexcept
 Returns the minimum temperature used to scale the image.
 
OTC_SDK_API float getTemperatureScalingMax () const noexcept
 Returns the maximum temperature used to scale the image.
 
OTC_SDK_API float getTemperatureScalingMinFiltered () const noexcept
 Returns the filtered minimum temperature actually used by the most recent frame's palette rendering.
 
OTC_SDK_API float getTemperatureScalingMaxFiltered () const noexcept
 Returns the filtered maximum temperature actually used by the most recent frame's palette rendering. See getTemperatureScalingMinFiltered().
 
OTC_SDK_API void setTemperatureScalingFilterFactor (float filterFactor)
 Sets the low pass filter factor for the temperature scaling for smooth transitions.
 
OTC_SDK_API float getTemperatureScalingFilterFactor () const noexcept
 Returns the low pass filter factor for the temperature scaling method.
 
void setTemperatureScalingMode (TemperatureScalingMode mode) noexcept
 Sets the temperature scaling mode for the false color conversion.
 
TemperatureScalingMode getTemperatureScalingMode () const noexcept
 Returns the current temperate scaling mode for the false color conversion.
 
OTC_SDK_API void setPalette (const std::string &name)
 Sets the palette for the false color conversion by name.
 
OTC_SDK_API std::string getPaletteName () const noexcept
 Returns the name of the currently active palette.
 
const ImagegetImage () noexcept
 Grants read access to the generated false color image.
 
int getImageSizeInBytes () const noexcept
 Returns the image size in bytes including potential width padding.
 
int getImageStride () const noexcept
 Returns the image stride in bytes.
 
OTC_SDK_API void copyImageDataTo (unsigned char *destination, int size) const noexcept
 Copies the false color image data to the given destination array.
 
OTC_SDK_API LookupTable createLookupTable ()
 Creates a lookup table for the false color conversion.
 
OTC_SDK_API void convertTemperatureToPaletteImage ()
 Triggers the image conversion.
 
OTC_SDK_API void convertTemperatureToPaletteImage (const LookupTable &lut)
 Image conversion to RBG with lookup table. This method is efficient, but works only with fixed temperature ranges (manual mode).
 
OTC_SDK_API void convertTemperatureToPaletteImage (void *destination, int size)
 Converts thermal data to a false color image, writing output to an external buffer.
 

Detailed Description

Creates false color images from thermal frames.

Constructor & Destructor Documentation

◆ ImageBuilder()

OTC_SDK_API optris::ImageBuilder::ImageBuilder ( ColorFormat colorFormat,
WidthAlignment widthAlignment )

Constructor.

Be mindful of which color format and width alignment you choose. Please refer to the documentation of the enums for more details.

Parameters
[in]colorFormatfor the generated false color image.
[in]widthAlignmentfor the generated false color image.

Member Function Documentation

◆ convertTemperatureToPaletteImage() [1/2]

OTC_SDK_API void optris::ImageBuilder::convertTemperatureToPaletteImage ( const LookupTable & lut)

Image conversion to RBG with lookup table. This method is efficient, but works only with fixed temperature ranges (manual mode).

Parameters
[in]lutlookup table.

◆ convertTemperatureToPaletteImage() [2/2]

OTC_SDK_API void optris::ImageBuilder::convertTemperatureToPaletteImage ( void * destination,
int size )

Converts thermal data to a false color image, writing output to an external buffer.

The external buffer must be at least getImageSizeInBytes() bytes and have the same stride as getImageStride(). The internal Image member is NOT updated or allocated.

Parameters
[out]destinationpointer to the output buffer.
[in]sizebuffer size in bytes (must be >= getImageSizeInBytes()).

◆ copyImageDataTo()

OTC_SDK_API void optris::ImageBuilder::copyImageDataTo ( unsigned char * destination,
int size ) const
noexcept

Copies the false color image data to the given destination array.

Parameters
[out]destinationarray to copy the false color image data to.
[in]sizein bytes. The specified size is limited to [0, image size in bytes].

◆ createLookupTable()

OTC_SDK_API LookupTable optris::ImageBuilder::createLookupTable ( )

Creates a lookup table for the false color conversion.

Returns
lookup table.

◆ getHeight()

int optris::ImageBuilder::getHeight ( ) const
inlinenoexcept

Returns the height in pixels of thermal frame.

Returns
height in pixels of thermal frame.

◆ getImage()

const Image & optris::ImageBuilder::getImage ( )
inlinenoexcept

Grants read access to the generated false color image.

Returns
const reference to the generated false color image.

◆ getImageSizeInBytes()

int optris::ImageBuilder::getImageSizeInBytes ( ) const
inlinenoexcept

Returns the image size in bytes including potential width padding.

Returns
image size in bytes including potential width padding.

◆ getImageStride()

int optris::ImageBuilder::getImageStride ( ) const
inlinenoexcept

Returns the image stride in bytes.

The stride is the image width in bytes including potential padding.

Returns
image stride in bytes.

◆ getMeanTemperatureInRegion()

OTC_SDK_API bool optris::ImageBuilder::getMeanTemperatureInRegion ( TemperatureRegion & meanRegion)

Returns the mean temperature in °C of a rectangular region.

Before providing the region to this method you have to define the rectangular area it covers by specifying its upper left and lower right corners.

Parameters
[out]meanRegionin which to calculate the mean temperature.
Returns
true if a mean temperature could be calculated. False if no thermal data is available or if the region coordinates are inconstent or if the region is too large for the frame.

◆ getMinMaxRegions()

OTC_SDK_API bool optris::ImageBuilder::getMinMaxRegions ( int radius,
TemperatureRegion & minRegion,
TemperatureRegion & maxRegion )

Returns the region of minimum/maximum temperature in °C with the given radius.

The method will fill in all the data for the min and max temperature region.

Parameters
[in]radiusradius of the region.
[out]minRegionregion of minimum mean temperature.
[out]maxRegionregion of maximum mean temperature.
Returns
true if minimum/maximum temperature could be calculated. False if no thermal data is available or if the radius is to large for the frame.

◆ getPaletteName()

std::string optris::ImageBuilder::getPaletteName ( ) const
inlinenoexcept

Returns the name of the currently active palette.

Returns
palette name string.

◆ getTemperature() [1/2]

OTC_SDK_API float optris::ImageBuilder::getTemperature ( int index) const

Returns the temperature the from last acquired image at specified pixel index.

Parameters
[in]indexpixel index.
Returns
temperature in °C.
Exceptions
SDKExceptionif index is out of range.

◆ getTemperature() [2/2]

OTC_SDK_API float optris::ImageBuilder::getTemperature ( int x,
int y ) const

Returns the temperature from last acquired image at specified pixel coordinates.

The origin of coordinates is located in the upper left corner with the x-axis pointing right and the y-axis pointing downwards.

Parameters
[in]xcoordinates.
[in]ycoordinates.
Returns
temperature in °C.
Exceptions
SDKExceptionif coordinates are out of range.

◆ getTemperatureScalingFilterFactor()

OTC_SDK_API float optris::ImageBuilder::getTemperatureScalingFilterFactor ( ) const
noexcept

Returns the low pass filter factor for the temperature scaling method.

Returns
low pass filter factor.

◆ getTemperatureScalingMax()

OTC_SDK_API float optris::ImageBuilder::getTemperatureScalingMax ( ) const
noexcept

Returns the maximum temperature used to scale the image.

Returns
temperature in °C.

◆ getTemperatureScalingMaxFiltered()

OTC_SDK_API float optris::ImageBuilder::getTemperatureScalingMaxFiltered ( ) const
noexcept

Returns the filtered maximum temperature actually used by the most recent frame's palette rendering. See getTemperatureScalingMinFiltered().

Returns
temperature in °C.

◆ getTemperatureScalingMin()

OTC_SDK_API float optris::ImageBuilder::getTemperatureScalingMin ( ) const
noexcept

Returns the minimum temperature used to scale the image.

Returns
temperature in °C.

◆ getTemperatureScalingMinFiltered()

OTC_SDK_API float optris::ImageBuilder::getTemperatureScalingMinFiltered ( ) const
noexcept

Returns the filtered minimum temperature actually used by the most recent frame's palette rendering.

For the auto-scaling modes this lags getTemperatureScalingMin() by the hysteresis filter (see setTemperatureScalingFilterFactor); in Manual mode both return the same value because setTemperatureScaling resets the filter.

Returns
temperature in °C.

◆ getTemperatureScalingMode()

TemperatureScalingMode optris::ImageBuilder::getTemperatureScalingMode ( ) const
inlinenoexcept

Returns the current temperate scaling mode for the false color conversion.

Returns
temperature scaling mode.

◆ getThermalFrame()

const ThermalFrame & optris::ImageBuilder::getThermalFrame ( ) const
inlinenoexcept

Grants read access to the stored thermal frame.

Returns
const reference to the stored thermal frame.

◆ getWidth()

int optris::ImageBuilder::getWidth ( ) const
inlinenoexcept

Returns the width in pixels of the thermal frame.

Returns
width in pixels of the thermal frame.

◆ setPalette()

OTC_SDK_API void optris::ImageBuilder::setPalette ( const std::string & name)

Sets the palette for the false color conversion by name.

If palettes have not been loaded yet, this triggers Sdk::loadPalettes() automatically. The palette data is copied into the ImageBuilder — subsequent registry changes do not affect an already constructed ImageBuilder.

Parameters
[in]namepalette name (case-sensitive, e.g. "Iron").
Exceptions
SDKExceptionif the named palette cannot be found even after auto-loading.

◆ setTemperatureScaling()

OTC_SDK_API void optris::ImageBuilder::setTemperatureScaling ( float min,
float max )

Sets the temperature range for the manual scaling mode.

Attention
If the scaling mode is not set to manual the set values will be overriden once the next image conversion is triggered.
Parameters
[in]minlower limit in °C.
[in]maxupper limit in °C.
Exceptions
SDKExceptionif the provided temperatures are invalid or if max is not at least 1°C higher than min.

◆ setTemperatureScalingFilterFactor()

OTC_SDK_API void optris::ImageBuilder::setTemperatureScalingFilterFactor ( float filterFactor)

Sets the low pass filter factor for the temperature scaling for smooth transitions.

Attention
The filtering only affects decreasing maximum values and increasing minimum values. Increasing maximum values and decreasing minimum values are instantly updated to prevent saturation.
Parameters
[in]filterFactorlow pass filter factor in the interval [0.0, 1.0]. The default value is 0.96 and the value 0.0 disables the filter.
Exceptions
SDKExceptionif the provided filter factor is out of bounds.

◆ setTemperatureScalingMode()

void optris::ImageBuilder::setTemperatureScalingMode ( TemperatureScalingMode mode)
inlinenoexcept

Sets the temperature scaling mode for the false color conversion.

Parameters
[in]modetemperature scaling mode.

◆ setThermalFrame()

OTC_SDK_API void optris::ImageBuilder::setThermalFrame ( const ThermalFrame & thermalFrame)

Sets a new thermal frame.

The provide frame will be copied to an internal buffer.

Parameters
[in]thermalFramedata.

The documentation for this class was generated from the following file: