ColorScaleDynamics
pub struct ColorScaleDynamics
How quickly an automatically scaled colour range follows the scene.
ColorScaleDynamics::new reads the SDK's own defaults out of
optris_sdk_color_scale_dynamics_init.
The settle band, the maximum lag and the dead band (the _k
methods) are temperature differences in degrees of the SDK's
temperature unit, despite the names: kelvin-sized in Celsius,
Fahrenheit-sized once crate::set_temperature_unit has chosen
Fahrenheit. A difference is never offset by 32.
Why a range needs dynamics at all
A range recomputed from scratch on every frame flickers: one hot pixel appearing and disappearing takes the whole picture's contrast with it. These are the constants that make it settle instead, asymmetric on purpose, because widening to admit something hot must be faster than narrowing after it leaves.
ColorScaleDynamics — methods
pub fn new() -> Self
The SDK's defaults, the three bands read in the SDK's temperature unit at the time of this call.
pub fn close_time_ms(&self) -> u32
How long the range takes to narrow, in milliseconds.
pub fn open_time_ms(&self) -> u32
How long it takes to widen, in milliseconds.
Shorter than the close time by design: something hot entering the scene must be visible at once, and something leaving it can fade out.
pub fn settle_band_k(&self) -> f32
How close to the target the range counts as settled, in degrees of the SDK's temperature unit.
pub fn max_lag_k(&self) -> f32
The most the range may lag behind the scene, in degrees of the SDK's temperature unit.
pub fn first_frame_seed(&self) -> FirstFrameSeed
Whether the first frame seeds the range.
pub fn deadband_k(&self) -> f32
Changes smaller than this are ignored, in degrees of the SDK's temperature unit.
pub fn immediate_above(&self) -> f32
The error, as a fraction of the scale in force, at or above which the scale stops being damped and adopts the scene outright. The top of the ramp.
This is the half of the behaviour a single smoothing constant cannot express: one constant is either slow, so a real scene change crawls, or fast, so noise moves the picture. The rate is instead a function of how wrong the scale currently is.
A fraction of the span rather than a temperature, so the same
setting behaves the same on a hand in front of a wall and on a
furnace. Zero, or any value not above
ColorScaleDynamics::damped_below, turns the adaptive rate
off and leaves a plain one-pole filter.
pub fn damped_below(&self) -> f32
The error, as a fraction of the scale in force, below which the scale is damped at the full close/open times. The bottom of the ramp.
Between the two the speed-up follows a smoothstep rather than a straight line, so there is no kink at either end.
pub fn with_times_ms(mut self, close_ms: u32, open_ms: u32) -> Self
Set the narrowing and widening times.
pub fn with_bands_k(mut self, settle_band_k: f32, max_lag_k: f32) -> Self
Set the settle band and the maximum lag, in degrees of the SDK's temperature unit.
pub fn with_first_frame_seed(mut self, seed: FirstFrameSeed) -> Self
Set whether the first frame seeds the range.
pub fn with_deadband_k(mut self, deadband_k: f32) -> Self
Set the dead band, in degrees of the SDK's temperature unit.
pub fn with_error_ramp(mut self, damped_below: f32, immediate_above: f32) -> Self
Set the two ends of the error ramp.
damped_below must not exceed immediate_above -- it is
the bottom of a ramp whose top is the other, and the SDK
clamps rather than refusing (its own words: "out-of-range
values are clamped rather than refused -- this decides a
picture, and a refusal would leave the caller with whatever
was there"). Measured: asking for (immediate 0.3, damped 0.7) reads back as (0.3, 0.3), and (0.0, 1.0) as
(0.0, 0.0).
The argument order is bottom-then-top so the constraint reads
off the call site. An earlier spelling of this method was
with_fractions(immediate, damped), named as though the two
were shares of a change rather than thresholds on an error,
which invited exactly the inverted call the clamp then
silently absorbed.