OptrisOptrisDocumentation

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

optris::sdk::Display

How the picture is drawn: colour bands over the palette, region overlays, and the GPU surface it can render straight onto.

A handle, not an owner. It refers to one source's rendering and is valid while that source is. Reached through Imager::Display() or Player::Display().

The palette and the colour scale are not here: they belong to FrameSource, because a recording is coloured too.

The colour windows below are not "the part only a live camera's GPU pipeline can do". A band is drawn from temperatures by whichever path produces the picture, and a recording holds temperatures, so a replay draws one too. A Player reaches the same Display over the same state, and the bands composite in the same order under the same ids.

What is still a camera's alone is the direct GPU rendering at the bottom: a recording has no GPU backend, so GetGpuInstance() answers nullptr and ConfigureSurface() answers false there, exactly as they do on a camera without one.

Public functions

Display

Display(ClientBridge *bridge)

Wraps the imager's shared state. Constructed by the SDK; get one from Imager::Display() rather than building it yourself.

SetColorWindow

void SetColorWindow(uint32_t id, const ColorWindow &window)

A temperature band rendered in colour over a greyscale base, so one range stands out and the rest recedes -- an isotherm. Up to kMaxColorWindows can be active at once, each with its own id, and they composite in ascending id order.

Drawn by whichever path produces the picture: the GPU colorizer, the CPU micro pipeline, or the view path -- which serves both a simulated source and a recording being replayed. In an earlier v12 build only the view path drew them, so a band on a real camera was accepted and never reached a pixel.

Exceptions

Name Description
std::invalid_argument if the band is empty or inverted, the opacity is outside [0, 1], or a supplied colour table is longer than kPaletteColorCount.
FeatureNotSupportedException if this would be the kMaxColorWindows + 1st window. Refused rather than dropped: a band that is accepted and not drawn is the defect this call was fixed for.
FeatureNotSupportedException on a picture recording -- one written as colorized video, whose palette went into the pixels before the file was written and whose temperatures are gone. There is no temperature for a band to select. Ask Player::IsPicture(), or AreColorWindowsSupported() below.
FeatureNotSupportedException if window.motion_only is set on a recording. Motion zones are Imager::Motion()'s and a replay runs no differencing pass, so a motion-gated band there would skip every pixel for ever. Only that flag is refused.

RemoveColorWindow

void RemoveColorWindow(uint32_t id)

Drop the band with this id. Unknown ids are ignored.

Selective colorization is all-or-nothing: while any band exists the whole picture is drawn greyscale with the bands painted over it, so removing the last one is a visible change to every pixel, not just to that band's -- the frame goes back to the ordinary full palette. Takes effect on the next frame.

ClearColorWindows

void ClearColorWindows()

Drop every band, returning the picture to the ordinary palette in one call. Same effect as removing them one at a time.

GetColorWindows

auto GetColorWindows() const -> std::map< uint32_t, ColorWindow >

The windows in force, by id.

There was no reader at all before v12, so an application could neither show the bands it had set nor verify that a write landed -- and since the write did nothing on a real camera, nothing could have told it so.

AreColorWindowsSupported

auto AreColorWindowsSupported() const -> bool

Whether this source can draw colour windows at all.

True on a camera and on a radiometric recording; false on a picture recording, which carries no temperature for a band to select. Ask the source rather than switching on its kind: "is this a replay" is not the question, and answering it instead is how an application hides a feature that works.

This is the one call in the family that answers for a recording rather than refusing, and it did not always: routed through the camera-only path it threw on a playback handle, so the only way to learn that a replay could not draw a band was to set one and catch the refusal -- exactly what having a question to ask exists to spare a caller.

PushPrimitives

void PushPrimitives()

Rebuild the GPU's overlay geometry from the current regions. Called for you when regions change; call it yourself only after reconfiguring the surface.

SetOverlayCompositing

void SetOverlayCompositing(bool enabled)

Whether region and blob overlays are composited into the RGBA frame delivered to the frame callback.

Where the picture is made decides the default. A camera with a GPU backend draws the outlines into the delivered frame unless this is called with false, and leaves them out while an orientation is set. A camera on the CPU pipeline, the simulated camera and a Player draw them only after this has been called with true. Either way they are drawn at the frame's own resolution; switch it off and call CompositeOverlays() instead to draw them at display resolution, which stays crisp when the image is magnified.

The CPU path defaults off rather than on because until the CPU rasteriser landed it drew nothing regardless of the flag, so every caller without a GPU has been receiving frames without outlines; switching it on by default would change what all of them see.

Note: One call, two fields. It writes both ClientBridge::overlay_compositing -- the recorded intent, which GetOverlayCompositing() and the snapshot metadata answer from, and which starts true -- and ClientBridge::composite_delivered_frame, the CPU path that actually draws, which starts false. The two defaults differ deliberately, so on a fresh imager without a GPU backend GetOverlayCompositing() returns true while nothing is being drawn into the delivered frame. Call this with true to make the two agree.

GetOverlayCompositing

auto GetOverlayCompositing() const -> bool

Whether overlay compositing has been asked for, as SetOverlayCompositing() last left it. Defaults to true, on every backend.

Warning: This reports intent, not whether anything is being drawn. It returns true on a fresh imager without a GPU backend, which composites nothing into the delivered frame until SetOverlayCompositing(true) -- see the note there. Do not use it to decide whether the picture already has outlines in it; a snapshot's SnapshotRendering::overlays says that.

There was no reader before v12: the setting was write-only, so an application could not show its own state, and a snapshot could not record whether the boxes in the picture were painted on. It answers from the SDK's own state rather than the GPU's, so it is still truthful on an imager with no GPU backend. Note that SetOverlayCompositing() is not inert without a GPU: it sets the CPU path's field too, and that path honours it on any backend.

CompositeOverlays

auto CompositeOverlays(uint8_t *rgba, uint32_t w, uint32_t h) -> bool

Composite the current regions' overlays -- outlines, markers, blob contours -- onto a caller-provided BGRA8 buffer at any resolution. Primitives are built to fill the given size, so a display-resolution buffer yields crisp overlays independent of the thermal frame size.

Uses the GPU when there is a GPU backend and a CPU rasteriser when there is not, so this works on a simulated camera and on a machine with no GPU -- neither of which it did before.

Returns: false only if there is nothing to draw.

GetGpuInstance

auto GetGpuInstance() -> void *

The WebGPU instance handle, for creating a surface. Returns nullptr if there is no GPU backend.

ConfigureSurface

auto ConfigureSurface(void *surface, uint32_t w, uint32_t h) -> bool

Render straight onto a surface you own. Pass a WGPUSurface handle cast to void* and the display size; from then on each processed frame renders colorized output and overlays directly to it, at display resolution.

Returns: false if there is no GPU backend.

HasSurface

auto HasSurface() const -> bool

Whether frames are currently going to a surface set up by ConfigureSurface().

False before the first successful call, and false whenever there is no GPU backend -- so it answers "is direct rendering actually happening", which is the question, rather than "did someone ask for it". It does not tell you the surface is still valid: a window destroyed underneath the SDK leaves this true.