OptrisOptrisDocumentation

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

optris::sdk::ColorScaleDynamics

How fast the auto-scaled colour range is allowed to move.

Auto-scaling recomputes the range from each frame, and an unfiltered range makes the picture breathe: a soldering iron leaving the scene re-colours the wall behind it in one frame, and on a narrow scene the scale is the sensor noise, so a still wall shimmers. This is the shape of the damping that stops that.

In time, not in frames. The legacy ImageBuilder damped with a fixed per-frame blend factor, which is a different time constant on every camera: 0.96 per frame closes 90% of a step in 1.76 s at 32 Hz, 0.71 s at 80 Hz and 0.06 s on a PI 1M. The same saved layout then behaves differently depending on which camera opens it, and an operation-mode change silently retimes it. How long the picture may take to re-colour is a property of the operator, so it is expressed as a duration and the SDK re-derives the per-frame blend from the interval it measures between frames.

Two behaviours, not one. What is wanted of an auto-scaled picture is near-immobility while the scene is merely noisy and a quick move when the scene actually changes, and no single smoothing constant delivers both -- it is one speed for everything, so either noise moves the picture or a real change crawls. The response is therefore made to depend on the size of the change: deadband_k below which nothing moves at all, damped_fraction up to which it moves at close_time / open_time, immediate_fraction at which it simply adopts the scene, and a smooth ramp between the last two.

settle_band_k, max_lag_k and deadband_k are temperature differences in degrees of the SDK's temperature unit (kelvin-sized in Celsius, Fahrenheit-sized once SetTemperatureUnit() chose Fahrenheit). The figures below are kelvin. Their defaults, 0.2 and 0.5, are compile-time Celsius-sized numbers, so in Fahrenheit a default-constructed ColorScaleDynamics asks for 0.2 F and 0.5 F. Start from GetColorScaleDynamics() and change only what you mean to.

Public attributes

close_time

std::chrono::milliseconds close_time {1750}

How long the scale takes to close 90% of the way onto a scene that has cooled or narrowed.

Zero disables damping: the scale is whatever this frame implies, which is what a bit-exact fixture wants. The default reproduces the legacy 0.96-per-frame feel at 32 fps, which is the rate most operators have actually lived with.

open_time

std::chrono::milliseconds open_time {250}

How long the scale takes to open, when something hotter or colder than the current scale appears.

Shorter than close_time, and that asymmetry is load-bearing: opening late clips, which throws information out of the picture, while closing late only wastes palette on a band nothing occupies. Nothing is lost by taking a second over narrowing and a great deal is lost by taking a second over widening, so the two directions do not get the same number.

It is no longer zero. Through 12.0.0 it was, so every upward excursion was adopted on the frame it appeared whatever its size -- which is the single largest reason an auto-scaled picture looked twitchy. On a still scene the top of the scale is the sensor noise, and instant opening tracked each noise peak up and then crept back down over close_time, so the palette pumped once per peak. Making it non-zero is only affordable because of immediate_fraction below: a genuinely large excursion -- the one where clipping would actually cost something -- still opens on the frame it arrives, because the adaptive rate drives its time constant to zero. What this damps is the small stuff, which is exactly what should not move the picture.

Zero restores the pre-12.1 behaviour and, like close_time, means "undamped in this direction" -- no deadband, no adaptive rate, just this frame's range.

settle_band_k

float settle_band_k = 0.2F

Once the scale is within this of what the scene implies, adopt the scene and stop. A difference in degrees of the SDK's temperature unit.

An exponential tail never arrives. Without this the effective range keeps moving in its last digit for the rest of the session and a slider bound to it never settles. 0.2 K is two internal units, and below one palette step for any scale wider than 24 K, so it is invisible in the picture. Zero switches it off.

Subsumed by deadband_k whenever that is the larger of the two, which it is at the defaults -- 0.5 K against this 0.2 K. Both are floors that stop the filter fussing over a distance too small to see; they differ only in where they measure it. This one looks at what is left after a step and adopts the scene; deadband_k looks at the error before a step and does not move at all. The stricter floor is reached first, so with a non-zero deadband this band never fires and the scale stops a deadband short of the scene rather than arriving on it. It is kept, and kept at 0.2, because it is still the only tail-killer for a caller who sets deadband_k to zero -- which is what anyone reproducing a pre-12.1 capture does.

max_lag_k

float max_lag_k = 0.0F

A hard bound on how far the scale may sit from what the scene implies during a transient, as a difference in degrees of the SDK's temperature unit.

Zero -- the default -- means no bound. Non-zero snaps when it is hit, by construction, so it trades one visible step for a bounded lag. Leave it off unless a scene needs it.

deadband_k

float deadband_k = 0.5F

How far what the scene implies may sit from the scale in force before the scale moves at all, as a difference in degrees of the SDK's temperature unit.

Below this the scale does not move, at all, in either direction. Not slowly -- not at all. A one-pole filter on its own has no such floor: it answers a 0.01 K wobble with a 0.01 K move, so the range never stops twitching and neither does a slider or a readout bound to it. Noise should buy no motion whatever, and that is a different statement from "slow motion", which is what a smoothing constant alone can express.

Absolute, in degrees, deliberately -- not a fraction of the span. This threshold exists to sit above the sensor's own noise, and that noise is a property of the detector in kelvin; it does not shrink because the scene happens to be wide. A fraction-of-span deadband gets this backwards exactly where it matters: on a narrow scene -- a still wall, the case that visibly shimmers -- a few percent of a 1 K span is 0.02 K, well under the noise it is meant to reject, so the shimmer survives. The adaptive rate below is expressed as a fraction of span, because what counts as a big change is relative to the picture; what counts as noise is not.

The lag it buys is bounded by construction and does not accumulate: a scene that genuinely drifts raises the error past the deadband and the scale follows, trailing by at most this much. 0.5 K is comfortably above the frame-to-frame scatter of the min/max statistic on a 307200-pixel detector, and under one palette step of 256 for any scale wider than 128 K.

Ignored, not damped, and the difference is not pedantic. A change that stays under this threshold is not followed slowly -- it is not followed at all, for as long as it stays under it. That is right for sensor noise, which is what the threshold is for, but it applies just as much to a genuine slow shift of less than half a kelvin: the scale will never catch up with it, however long anybody waits. Anyone describing this as "damped" or "smoothed" is inviting a caller to wait for a move that is not coming. Pinned by AutoScaleDamping.AChangeSmallerThanTheDeadbandIsIgnoredForever, which holds a sustained 0.3 K shift for 2000 frames and asserts the scale has not budged.

What it costs, stated plainly: up to this much clipping, and it does not time out. In the closing direction a deadband only wastes a sliver of palette. In the opening direction it means a scene sitting under this much above the top of the scale is never made room for, so those pixels stay pinned at the end of the colour table for as long as they stay that close. They are still measured -- GetMinTemperature(), GetMaxTemperature() and every measuring area are produced before colouring and are untouched by any of this -- but they are not distinguishable in the picture.

That is accepted on purpose, and it is the narrower of the two evils. The alternative is no deadband while opening, which is what 12.0.0 did, and on a still scene the top of the scale is the sensor noise: every noise peak opened the scale and then the scale crept back down over close_time, so the palette pumped once per peak. That pumping is the reported complaint. Half a kelvin of indistinguishability at one edge of the palette is not.

Zero switches it off. It is also skipped outright in whichever direction has its time set to zero, so "undamped" keeps meaning undamped and a bit-exact fixture that zeroes close_time gets this frame's range and not a deadband-quantised one.

immediate_fraction

float immediate_fraction = 0.5F

The error, as a fraction of the scale in force, at or above which the scale stops being damped and simply adopts the scene.

This is the half of the design a single smoothing constant cannot express. One constant has to be either slow -- in which case a real scene change crawls into place and the operator waits, mis-coloured, for over a second -- or fast, in which case noise moves the picture. Neither is wanted. So the rate is a function of how wrong the scale currently is: below damped_fraction it is fully damped, at or above this it is immediate, and in between it eases smoothly from one to the other.

A fraction of the current span, not a temperature. Half a palette wrong is half a palette wrong whether the scale is 5 K or 500 K wide, so the same setting behaves the same on a hand in front of a wall and on a furnace, with no number in kelvin to re-tune per scene or per camera.

0.5 is half the palette: at that error the picture is not merely imperfect, most of it is off the end of the colour table, and there is nothing to be gained by easing. This is what makes a non-zero open_time affordable.

Zero, or any value not above damped_fraction, turns the adaptive rate off and leaves a plain one-pole filter at close_time / open_time.

damped_fraction

float damped_fraction = 0.05F

The error, as a fraction of the scale in force, below which the scale is damped at the full close_time / open_time.

The bottom of the ramp whose top is immediate_fraction. 0.05 is about thirteen steps of a 256-entry palette: a shift that is just about perceptible side by side and not worth hurrying, which is precisely the regime that should be sat on rather than chased.

Between the two fractions the speed-up follows a smoothstep rather than a straight line, so there is no kink in the response at either end -- a corner here is visible as a jerk part-way through a transition.

seed_first_frame

std::optional< bool > seed_first_frame

Whether the first frame eases out of the seed band instead of adopting what it sees. Unset -- the default -- means "whatever this source does", which is not the same answer everywhere.

A camera seeds. That is v11 behaviour and it is visible: the palette bottom climbs out of -20 C over about a second while an operator watches a slider, and reproducing those numbers is the whole reason ColorScaleFilter::kSeedLo exists.

A player and a still adopt. There is no v11 slider to stay compatible with on a file that is being replayed, and the seed is simply wrong there: the first picture of a 22..35 C recording was drawn about -18..35 C, so every replay, every thumbnail and every snapshot taken from a replay started washed out, unless the application knew to zero close_time before the first frame and restore it after.

Set it to override either default. It is an optional rather than a bool so that "I did not express a preference" and "I want the seed" are different statements: a caller that reads the dynamics back, changes close_time and writes them again must not silently re-seed a player, which is what a plain bool defaulting to true would have done.