OptrisOptrisDocumentation

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

optris::sdk::view

CPU rasteriser for the overlay primitive stream.

The same PrimInstance stream the GPU draws, evaluated on the CPU with the same signed-distance functions and the same anti-aliasing, so an overlay looks the same whichever path drew it.

Why this exists: Why this exists Overlay rendering used to be reachable only through the GPU backend, which meant it was unreachable in three ordinary cases: a simulated camera (which is not an IRImagerNative and so has no processing adapter at all), a machine with no usable GPU, and any frame below OTC_GPU_MIN_PIXELS where the pipeline deliberately chooses the CPU backend. In all three the regions were measured correctly and drawn nowhere, with no error to say so, the most visible symptom being that an application which runs on the simulated imager, as every test and demo does, could never show a measuring area at all.

Scaling a colorized picture up for display, by a named algorithm.

The CPU answer and the GPU answer are the same answer: The CPU answer and the GPU answer are the same answer The algorithms and the geometry here follow the GPU implementation: the same Catmull-Rom weights, the same floor-the-scale rule for Integer, the same 1:1-centred rule for Original. A picture scaled on either path is the same picture.

This is display, not measurement: This is display, not measurement Everything here resamples colour. No temperature is ever interpolated, the same rule the canvas follows. Measure from the thermal frame; scale the picture.

View consumes the SDK's canonical Roi type and provides JSON serialization, animation, and rendering helpers on top.

Enumerations

TrackState

enum TrackState

Lifecycle state of a tracked blob.

Value Initialiser Description
Tentative Seen but not yet confirmed (< min_hits).
Confirmed Stable track.
Lost No match for recent frames, pending removal.

Palette

enum Palette

16 built-in false-color palettes for thermal-to-RGBA mapping.

Value Initialiser Description
Iron
IronHi
Rainbow
RainbowHi
GrayscaleBW
GrayscaleWB
Medical
AlarmBlue
AlarmBlueHi
AlarmGreen
AlarmRed
Jet
Hot
Plasma
Arctic
Lava

ScalingMode

enum ScalingMode

How the colorization temperature range is determined each frame.

Value Initialiser Description
Manual Fixed user-supplied min/max.
Auto Track frame min/max with smoothing.
Percentile Use 1st/99th percentile to ignore outliers.
Histogram Histogram equalization for maximum contrast.

InterpolationMode

enum InterpolationMode

Spatial upscaling method for the colorized RGBA output.

Value Initialiser Description
Nearest = 0
Bilinear = 1
Bicubic = 2
Integer = 3 Nearest-neighbor at integer scale factors only.
Original = 4 No scaling, output matches thermal resolution.

FilterMode

enum FilterMode

Post-processing filter applied to thermal data before colorization.

Value Initialiser Description
None = 0
Median3x3 = 1
Gaussian3x3 = 2
Bilateral = 3
Sharpen = 4
Temporal = 5 IIR low-pass across consecutive frames.
BoxBlur5x5 = 6
Gaussian5x5 = 7
EdgeDetect = 8
UnsharpMask = 9
Median5x5 = 10
NonLocalMeans = 11 Slow but strong denoiser, not real-time.

Typedefs

Roi

optris::sdk::Roi Roi

RoiType

optris::sdk::RoiType RoiType

RoiStats

optris::sdk::RoiStats RoiStats

RoiWaypoint

optris::sdk::RoiWaypoint RoiWaypoint

RoiMotionPath

optris::sdk::RoiMotionPath RoiMotionPath

MarkerStyle

optris::sdk::MarkerStyle MarkerStyle

LabelAnchor

optris::sdk::LabelAnchor LabelAnchor

BlobRenderMode

optris::sdk::BlobRenderMode BlobRenderMode

Easing

optris::sdk::Easing Easing

LoopMode

optris::sdk::LoopMode LoopMode

MeasuringField

Roi MeasuringField

MeasuringFieldType

RoiType MeasuringFieldType

Waypoint

RoiWaypoint Waypoint

MotionPath

RoiMotionPath MotionPath

Functions

Colorize

OTC_SDK_API void Colorize(const float *data, uint32_t w, uint32_t h, float temp_min, float temp_max, Palette palette, uint8_t *bgra_out)

CPU-only palette colorization (no GPU required).

Colorize

OTC_SDK_API void Colorize(const float *data, uint32_t w, uint32_t h, float temp_min, float temp_max, Span< const ::optris::sdk::Rgb24 > colors, uint8_t *bgra_out)

The same against a supplied table rather than a built-in palette.

ColorizeSelective

OTC_SDK_API void ColorizeSelective(const float *data, uint32_t w, uint32_t h, float temp_min, float temp_max, const std::map< uint32_t, ::optris::sdk::ColorWindow > &windows, const uint8_t *motion_mask, uint8_t *bgra_out)

Grayscale base with color windows painted over.

Parameters

Name Description
windows Color windows ordered by ID (painter's order).
motion_mask Per-pixel boolean; nullptr if no motion detection active. When non-null, windows with motion_only skip pixels where motion_mask[i] is false.

ColorizeSelective

OTC_SDK_API void ColorizeSelective(const float *data, const float *band_data, uint32_t w, uint32_t h, float temp_min, float temp_max, const std::map< uint32_t, ::optris::sdk::ColorWindow > &windows, const uint8_t *motion_mask, uint8_t *bgra_out)

The same, with the band test taken from a second array.

data draws the grey base, and band_data decides which pixels a band covers and where inside it they sit. They are the same array in the ordinary case; they differ when a display-only enhancement is running, where data is the enhanced pixels and band_data is the measured temperatures.

A band is a statement about temperature, and enhancement moves display values rather than temperatures -- so testing the enhanced value would make a band's edges follow the enhancement gains. This is the same split optris::pipeline::colorize_rgba_selective() makes between its display and raw spans, and it is here so the two paths draw a band in the same place.

RasterizeOverlays

OTC_SDK_API void RasterizeOverlays(Span< const PrimInstance > prims, uint8_t *bgra, uint32_t width, uint32_t height, float aa=kOverlayAaAmount)

Composite prims over a BGRA8 buffer, blending by the primitive's alpha times its anti-aliased coverage.

The buffer is not cleared: primitives are drawn over whatever is there, so this works both on a transparent layer and directly on a colorized frame.

Primitive coordinates are in pixels of the target, so the caller chooses the resolution; passing a supersampled buffer gives overlays that stay crisp when the thermal image is magnified.

Parameters

Name Description
prims the instance stream, as built by FrameProcessor::BuildRegionPrimitives()
bgra target buffer, w * h * 4 bytes, B-G-R-A per pixel

PaletteToString

OTC_SDK_API std::string PaletteToString(Palette p)

PaletteFromString

OTC_SDK_API Palette PaletteFromString(const std::string &s)

ScalingModeToString

OTC_SDK_API std::string ScalingModeToString(ScalingMode m)

ScalingModeFromString

OTC_SDK_API ScalingMode ScalingModeFromString(const std::string &s)

InterpolationModeToString

OTC_SDK_API std::string InterpolationModeToString(InterpolationMode m)

FilterModeToString

OTC_SDK_API std::string FilterModeToString(FilterMode m)

ScaledExtentFor

OTC_SDK_API auto ScaledExtentFor(uint32_t src_w, uint32_t src_h, uint32_t dst_w, uint32_t dst_h, InterpolationMode mode) -> ScaledExtent

The rectangle mode puts the picture in.

  • Original keeps 1:1 pixels and centres them, so a 382x288 sensor is a small sharp image in the middle of a large target rather than a stretched one. That is the mode for "what the sensor actually gives you".
  • Integer scales by floor(min(dst_w/src_w, dst_h/src_h)), at least 1, and centres. Every source pixel becomes the same whole number of target pixels, so there is no uneven blockiness.
  • The rest letterbox to fill, preserving aspect.

Resample

OTC_SDK_API void Resample(const uint8_t *src, uint32_t src_w, uint32_t src_h, uint8_t *dst, uint32_t dst_w, uint32_t dst_h, InterpolationMode mode)

Resample a 4-bytes-per-pixel image into another of a different size.

src is src_w * src_h * 4 bytes and dst is dst_w * dst_h * 4. The channel order is whatever the caller uses; this is arithmetic on four independent channels, so BGRA in gives BGRA out.

Integer and Original sample as Nearest does: their difference is the size they are drawn at, which is what ScaledExtentFor() is for, not the filter used to get there. Asking for a size those modes would not have chosen is honoured rather than second-guessed.

A zero dimension, or a null pointer, is a no-op rather than an error: a display path must not throw on a frame that has not arrived yet.

RoiContains

OTC_SDK_API bool RoiContains(const Roi &roi, float x, float y)

Hit-test a point against the ROI geometry (normalized coords).

ComputeRoiStats

OTC_SDK_API void ComputeRoiStats(Roi &roi, const int16_t *data, uint32_t w, uint32_t h)

Compute min/max/avg stats for pixels inside the ROI (int16 format).

ComputeRoiStats

OTC_SDK_API void ComputeRoiStats(Roi &roi, const float *data, uint32_t w, uint32_t h)

Compute min/max/avg stats for pixels inside the ROI (float celsius).

UpdateRoiAnimation

OTC_SDK_API void UpdateRoiAnimation(Roi &roi, float dt)

Advance the ROI's motion-path animation by dt seconds.

ParseRoi

OTC_SDK_API Roi ParseRoi(const std::string &json)

Deserialize a single ROI from a JSON document.

Parameters

Name Description
json One ROI object, as text.

Exceptions

Name Description
SdkException if the document is not valid JSON.

SerializeRoi

OTC_SDK_API std::string SerializeRoi(const Roi &roi)

Serialize a single ROI to a JSON document.

Variables

kOverlayAaAmount

constexpr float kOverlayAaAmount = 0.75F

Anti-aliasing softness in pixels. Matches the GPU uniform so the two renderers agree on edge appearance.