OptrisOptrisDocumentation

Documentation/OTC SDK/Overviewv12.0

Colour Range

Which temperatures the palette spans, and how the SDK picks them when it chooses. The auto-scaled range is a filter with a settling band and a lag bound, not a per-frame minimum and maximum.

In Fahrenheit: with the SDK switched to Fahrenheit (SetTemperatureUnit() and its counterparts, see Temperatures in Fahrenheit), every temperature on this page is read and written in Fahrenheit, and every difference in Fahrenheit degrees; the samples are unchanged.

The palette chapter is four pages, each answering one question:

Page Question
Colour Palettes Which palettes are there, how do I set one, and how do I read its colours?
Colour Range Which temperatures do the colours span, and how is that chosen for me?
Custom Palettes How do I supply a palette of my own?
The Palette Library Where does the SDK look for palette files on this machine?

On this page

Color Range

By default the SDK auto-scales the color range to each frame. You can lock the range to fixed values:

// Lock to 20-80 C.
imager->SetColorRange(20.0f, 80.0f);

// Lock only the minimum, auto-scale the maximum.
imager->SetColorRange(20.0f, std::nullopt);

// Return to full auto-scaling.
imager->SetColorRange(std::nullopt, std::nullopt);

Temperatures below the minimum map to the coldest palette color. Temperatures above the maximum map to the hottest palette color.

How the auto-scaled range is chosen

While no fixed range is set, the range comes from the scene itself, and there are four ways to take it:

// The default: the 1st and 99th percentile of the scene.
imager->SetAutoScaleMode(AutoScaleMode::kPercentile);

// The coldest and hottest pixel in the scene.
imager->SetAutoScaleMode(AutoScaleMode::kAbsolute);

// The scene's mean plus and minus one, or three, standard deviations.
imager->SetAutoScaleMode(AutoScaleMode::kSigma1);
imager->SetAutoScaleMode(AutoScaleMode::kSigma3);

kPercentile is the default because an ordinary scene has outliers in it. A window, a lamp, a reflection off metal, or a single dead pixel is enough to stretch an absolute min/max scale across a band nothing occupies: a room living in 26-30 C reported as 2.8-36.2 C renders everything you care about inside the top fifth of the palette, as one flat wash of color. Ignoring the outermost one percent at each end puts the palette where the scene actually is.

The trade is real and it is only about the picture. Under kPercentile the outlying pixels are clipped to the ends of the palette, so the image no longer shows how far past the band they go. Under kAbsolute nothing is clipped, at the cost of one pixel being able to flatten the rest. Choose kAbsolute when the extremes are the subject (a hot spot search, a thermal shock) and leave the default alone otherwise. kSigma1 and kSigma3 are the other answer to outliers, and the ones operators coming from OptrisConnect expect: a band around the mean, roughly the middle 68% or 99.7% of the scene, with invalid pixels excluded.

In every auto mode the scale is damped over time, so the picture does not breathe from frame to frame. A fixed range is never damped.

How fast it moves depends on how big the change is

An auto-scaled picture should be near-immobile while the scene is merely noisy and quick when the scene actually changes, and no single smoothing constant delivers both: one constant has one speed, so it is either fast, and sensor noise moves the picture, or slow, and a real scene change crawls into place while you look at a wrongly coloured image. Three regimes:

  • Below deadband_k, 0.5 K by default, the error is ignored, not damped. Not followed slowly; not followed. A detector's readings scatter a few tenths of a kelvin frame to frame, and on a narrow scene that scatter is the whole span, so without a floor the scale never stops twitching and neither does a slider bound to it. The threshold is absolute in kelvin rather than a fraction of the span, because it exists to sit above the detector's own noise and that noise does not shrink because the scene happens to be wide. The threshold cannot tell noise from signal, so a genuine sustained shift of under 0.5 K is never followed either, however long it is held. The scale is not creeping towards it; it is stationary. AutoScaleDamping.AChangeSmallerThanTheDeadbandIsIgnoredForever holds a real 0.3 K shift for 2000 frames and asserts nothing moved. Do not describe this to a user as "smoothing": they will wait for a move that never arrives. Set deadband_k to zero if following arbitrarily small changes matters more than a still picture.
  • At or above immediate_fraction of the current span, 0.5 by default, the scene is adopted outright, on the frame it arrives. At half a palette of error most of the picture is off the end of the colour table and there is nothing to be gained by easing in.
  • Between damped_fraction and immediate_fraction the scale speeds up smoothly with the size of the error, following a smoothstep rather than a straight line so there is no jolt at either end of the transition.

By default it narrows over about 1.75 s (close_time) and widens over about 0.25 s (open_time). Widening is much the faster of the two, deliberately: opening late clips, which throws information out of the picture, while closing late only wastes palette on a band nothing occupies. Measured on a 20 K span at 37.6 Hz, a 4 K widening settles in 160 ms and the same narrowing in 1064 ms.

The times are durations, not frame counts, so a camera at 9 Hz and one at 60 Hz take the same number of seconds to re-colour. Measured across 9, 37.6, 50 and 60 Hz the same change settles within 62 ms of the same wall-clock time, which is under one frame of the slowest.

SetColorScaleDynamics() changes all of it (close_time, open_time, deadband_k, immediate_fraction, damped_fraction, settle_band_k, max_lag_k, seed_first_frame). Setting close_time or open_time to zero turns that direction off entirely, deadband and adaptive rate included, so "undamped" means undamped.

Two caveats

Because a change under deadband_k moves nothing, a scene sitting up to 0.5 K above the top of the scale is never made room for and those pixels stay pinned at the end of the palette. They are still measured, and the alternative was a palette that pumped once per noise peak. And settle_band_k is subsumed by deadband_k whenever that is the larger, which it is by default: both are floors on the same fussing, and the stricter is reached first, so the settle band matters only if you set deadband_k to zero.

For an entirely undamped response, which is what you want when comparing two captures frame by frame, ask for it by name with UnadaptedColorScaleDynamics() rather than reconstructing it from defaults.

The first frame is a case of its own. Every source adopts the range its first usable frame implies (a camera, a Player and a StillSource alike), so the scale starts at the scene instead of arriving at it. ColorScaleDynamics::seed_first_frame overrides that: leave it unset for the source's own behaviour, set it true to ease out of a fixed -20 C .. +20 C band over about a second (the v11 response, which UnadaptedColorScaleDynamics() includes), or false to adopt.

"Usable" is not decoration

Right after an open, and again after an operation-mode switch, a camera has no dark reference, and a frame converted without one runs off the end of the calibration curve and clamps: a PI 4x0 read a flat 125.0 C and an Xi 410 66.7 .. 125.0 C, in a room at about 25 C. Those frames are drawn, by their own range, and nothing is committed to the scale until a frame with a dark reference arrives, so the scale cannot be left anchored to a clamp, which no later frame could widen out of. GetEffectiveColorRange() is empty for exactly that time. It is an optional rather than a flag so that reading the dynamics back, changing close_time and writing them again cannot silently re-seed a player. Because the scale is filtered, the range a frame was actually drawn with cannot be worked out from the frame: read it with GetEffectiveColorRange() to label a slider or legend. It is empty before the first frame and just after a change of mode.

No measured temperature changes either way. The scale decides colors and nothing else. GetMinTemperature(), GetMaxTemperature(), every measuring area, every alarm and everything written to a recording are produced before colorization and report the same values under both modes, clipped pixels included.

The setting applies to both pipelines, so a picture does not change when a machine switches between the graphics-card and processor paths, and it applies to Player as well as to Imager, so a recording plays back looking like the camera it came from.