optris::sdk::view::TrackVisualizationConfig
Controls how tracked blob trails and predictions are drawn.
Nothing in the SDK draws them. Like the rest of this header, the struct is a JSON schema: it is loaded, saved and handed back to you, and your own overlay code decides what to do with it. FrameProcessor never sees it. Read every field below as an instruction to the caller, not to the renderer.
The positions and velocities referred to here live in the space BlobDetector emits: x normalized by frame width, y by frame height, both in [0,1], origin top-left. That is the Roi convention, not the Region one -- Region normalizes both axes by the frame width.
Public attributes
show_trails
bool show_trails = true
Whether the caller should draw each track's motion trail.
Purely a drawing switch. BlobTracker fills TrackedDetection::history on every Update() whether this is set or not, so clearing it saves rasterizing, never tracking work.
trail_length
uint32_t trail_length = 30
How many trail points to draw, oldest first.
A rendering budget, not a tracker setting. Each Track keeps its own hard-coded 60-point history and nothing feeds this number into it, so a larger value quietly gets you whatever the tracker happens to hold. Take the last trail_length entries of TrackedDetection::history rather than assuming the two agree.
trail_fade_alpha
float trail_fade_alpha = 0.5F
Opacity floor for the oldest drawn trail point, in [0,1].
The tracker already fades: TrackHistoryPoint::alpha starts at 1.0 and is multiplied by 0.95 for every point appended after it, so at 60 points the oldest is below 0.05. Honouring that alpha and this one fades twice. Either clamp the per-point alpha up to trail_fade_alpha, or ignore it and interpolate 1.0 down to this value across trail_length.
show_velocity_vector
bool show_velocity_vector = true
Whether to draw a velocity arrow on each track.
velocity_scale
float velocity_scale = 5.0F
Length multiplier for that arrow.
TrackedDetection::velocity_x/y are in normalized units per Update() call -- per frame, not per second -- so the same physical motion yields a shorter vector at a higher frame rate. Rescale this if you drive the tracker well away from a camera's native rate.
Convert to pixels per axis: vx * velocity_scale * frame_width and vy * velocity_scale * frame_height. Because the two axes are normalized by different divisors, scaling the arrow once by the width points it in the wrong direction on any non-square frame.
show_predicted_position
bool show_predicted_position = false
Whether to draw the Kalman prediction beside the measurement.
Off by default, and worth leaving off: BlobTracker::Update assigns predicted = detection, so TrackedDetection::predicted is a copy of the filtered position and the marker lands exactly on the one you already drew. There is nothing to see until the tracker publishes a genuine pre-update prediction.
confirmed_color
std::array< float, 4 > confirmed_color = {0.0F, 1.0F, 0.0F, 1.0F}
Colour for tracks in TrackState::Confirmed, RGBA in [0,1].
Accepted from JSON as [r,g,b] or [r,g,b,a]; the three-element form gets alpha 1.0. Anything shorter, or not an array at all, is skipped and leaves the default standing -- no error is reported. Components are not clamped or rescaled either, so a file written with 0-255 colours arrives here unchanged and is yours to divide.
tentative_color
std::array< float, 4 > tentative_color = {1.0F, 1.0F, 0.0F, 0.7F}
Colour for tracks in TrackState::Tentative -- seen, but with fewer than TrackerConfig::min_hits matches, so they may still evaporate. Same form and parsing rules as confirmed_color. The default is deliberately dimmer than confirmed: alpha 0.7.
lost_color
std::array< float, 4 > lost_color = {1.0F, 0.5F, 0.0F, 0.5F}
Colour for tracks in TrackState::Lost -- unmatched recently and due for removal once the gap reaches TrackerConfig::max_age. Same form and parsing rules as confirmed_color. Faintest of the three by default, because it marks where something was.
Public static functions
FromJson
static TrackVisualizationConfig FromJson(const std::string &json)
Read these fields from a preset's track_visualization object.
Every key is optional and a missing one leaves its field at the default, so {} is valid and returns a default-constructed config. A malformed colour is skipped silently; a scalar of the wrong JSON type, or text that is not JSON at all, throws SdkException.
The document crosses as text rather than as a JSON library's own type, for the reason given at the JSON functions in optris/sdk/view/roi.h.
Public functions
ToJson
std::string ToJson() const
Write all nine fields, colours as four-element arrays.
Nothing is omitted for being at its default, so the result doubles as a complete example of the schema and round-trips exactly through FromJson.