OptrisOptrisDocumentation

Documentation/OTC SDK/OTC SDK — C++ API referencev12.0

optris::sdk::view::FrameProcessor

Converts thermal data to false-color BGRA frames on the CPU.

This is the CPU palette path and nothing else. It is not a GPU wrapper and has no GPU fallback -- there is no GPU code behind it to fall back from -- and it draws no overlays. The previous wording here ("wraps the GPU Visualizer ... with ROI overlays") described an intent that was never implemented; IsGpuEnabled() was removed along with it.

Overlays come from elsewhere: BuildOverlayPrimitives() plus view::RasterizeOverlays() for the delivered frame, and Imager::CompositeOverlays() for the GPU surface. Both cover regions as well as the deprecated ROIs, and both anti-alias.

ROIs set through SetRois() are still measured and tracked here; they are simply not painted.

This header is not part of the sdk.h single-include header: include it as well, beside sdk.h or without it (see extra_includes).

Note the view:: qualification on Palette. optris::sdk::view:: Paletteandoptris::sdk::Palette are different enums with different members (Ironhere,kIronBowthere) and are not interchangeable; unqualifiedPalette` is ambiguous.

#include "optris/sdk/view/frame_processor.h"

using optris::sdk::view::FrameProcessor;
using optris::sdk::view::Palette;

FrameProcessor proc({.palette = Palette::Iron});
imager->SetThermalCallback([&](const optris::sdk::ThermalFrame &f) {
  auto rgba = proc.Process(f);
  // rgba is ready for display or network streaming
});

Public static functions

BuildRegionPrimitives

static std::vector< PrimInstance > BuildRegionPrimitives(const std::vector< optris::sdk::Region > &regions, uint32_t w, uint32_t h, uint32_t frame_width=0)

Build SDF primitive instances for a region set.

One primitive per shape leaf, walked in tree order, with leaves reached through an odd number of subtract right-branches drawn dashed.

A region whose root is an operator is drawn as its silhouette instead: each operand's own outline, trimmed to the parts still on the boundary of the whole. So a ring is an annulus, not two circles, and what is drawn is the shape that is measured. This used to draw the operands, and said so here -- which meant the overlay disagreed with the readings beside it, because the measurement has always used the real tree.

w and h are the target surface size, which must preserve the frame's aspect ratio: region coordinates divide both axes by the frame width, so both map through w.

frame_width is the width in pixels of the frame the regions were measured against, and is needed only by RegionStyle::show_aperture -- which draws Region::samples, and those index frame pixels rather than region coordinates. Zero, the default, means the caller cannot say: the overlay is being built without a frame in hand, or the regions are authored on a Canvas and so are not in the frame's space at all. Nothing is drawn for that flag then, rather than boxes placed by a guessed scale. Every other primitive is unaffected.

BuildRegionPrimitives

static std::vector< PrimInstance > BuildRegionPrimitives(const std::vector< optris::sdk::Region > &regions, uint32_t w, uint32_t h, uint32_t frame_width, optris::sdk::TemperatureUnit label_unit)

The same primitives, with the reading in each region label (RegionStyle::show_label) shown in label_unit.

The overload above is this one with TemperatureUnit::kCelsius, and draws exactly what it always drew. In Fahrenheit the reading is converted and rounded once by Temperatures::Format() to one decimal and followed by F, so a label reads "INLET 70.3F" where it read "INLET 21.3C". Only the text changes: outlines, markers and where the label is anchored do not.

Imager::SetDisplayTemperatureUnit() chooses this for the overlays the SDK draws itself. Call it directly when you draw the overlays yourself.

Exceptions

Name Description
InvalidArgumentException for a label_unit that is neither kCelsius nor kFahrenheit.

HasCustomRegionEmissivity

static bool HasCustomRegionEmissivity(const std::vector< optris::sdk::Region > &regions)

True if any region (including children) carries a per-region emissivity override; i.e. an emissivity map is needed.

BuildRegionEmissivityMap

static std::vector< float > BuildRegionEmissivityMap(const std::vector< optris::sdk::Region > &regions, uint32_t w, uint32_t h)

Rasterize regions into a per-pixel emissivity map of size w x h. Pixels inside a region carrying its own emissivity get that value; all others are 0, meaning "use the global emissivity". Children override their parent where they overlap.

As with BuildRegionPrimitives(), region coordinates divide both axes by the frame width, so both map through w.

Public functions

FrameProcessor

FrameProcessor()

FrameProcessor

FrameProcessor(const Config &config)

~FrameProcessor

~FrameProcessor()

FrameProcessor

FrameProcessor(FrameProcessor &&) noexcept

operator=

FrameProcessor & operator=(FrameProcessor &&) noexcept

FrameProcessor

FrameProcessor(const FrameProcessor &)=delete

operator=

FrameProcessor & operator=(const FrameProcessor &)=delete

Process

optris::sdk::BgraFrame Process(const optris::sdk::ThermalFrame &frame)

Process a ThermalFrame into a false-color BgraFrame.

Process

optris::sdk::BgraFrame Process(const float *data, uint32_t w, uint32_t h)

Process raw float celsius data.

Process

optris::sdk::BgraFrame Process(const float *display, const float *measured, uint32_t w, uint32_t h)

The same, colorizing one array and measuring another.

display is what gets coloured. measured is the frame's real temperatures, and it drives everything that is a statement about temperature rather than about appearance: ROI tracking, spot locations, and which pixels a colour window covers.

Pass the same pointer twice and this is exactly the overload above. They differ only when a display-only enhancement is running -- detail enhancement redistributes local contrast, so its output is for looking at and must not reach a measurement. Letting it would move a tracked hot spot and shift a band's edges as the gains change.

UpdateTracking

void UpdateTracking(const float *data, uint32_t w, uint32_t h)

Run ROI tracking only (stats, blobs, points). No colorization; use when GPU provides RGBA.

UpdateTracking

void UpdateTracking(const int16_t *data, uint32_t w, uint32_t h)

SetPalette

void SetPalette(Palette palette)

SetCustomPalette

void SetCustomPalette(Span< const ::optris::sdk::Rgb24 > colors)

Colorize with a supplied table instead of palette.

kPaletteColorCount entries, coldest first. An empty span clears the override and goes back to the selected palette.

SetTemperatureRange

void SetTemperatureRange(float min_c, float max_c)

SetRois

void SetRois(std::vector< Roi > rois)

Replace and read the ROI list.

ROIs here are measured and tracked, not drawn: Process() paints no outlines. See the class comment for what does.

GetRois

const std::vector< Roi > & GetRois() const

SetInterpolationMode

void SetInterpolationMode(InterpolationMode mode)

SetFilterMode

void SetFilterMode(FilterMode mode)

SetGlobalEmissivity

void SetGlobalEmissivity(float e)

SetColorWindows

void SetColorWindows(const std::map< uint32_t, ::optris::sdk::ColorWindow > &windows)

SetMotionMask

void SetMotionMask(const uint8_t *mask)

BuildRoiPrimitives

std::vector< PrimInstance > BuildRoiPrimitives(uint32_t w, uint32_t h) const

Build SDF primitive instances for the current ROI set. Returns overlay geometry in pixel coordinates for a frame of size w x h. The caller passes these to the GPU Colorizer for anti-aliased rendering.

HasCustomEmissivity

bool HasCustomEmissivity() const

True if any ROI (including children) carries a per-ROI emissivity override (>= 0.1); i.e. an emissivity map is needed.

BuildEmissivityMap

std::vector< float > BuildEmissivityMap(uint32_t w, uint32_t h) const

Rasterize the current ROIs into a per-pixel emissivity map of size w x h. Pixels inside an ROI with a per-ROI emissivity get that value; all others are 0 (meaning "use the global emissivity"). Area ROIs (rectangle, oval, circle, polygon) fill their region; children override their parent where they overlap.