15constexpr int kGridW = 40;
16constexpr int kGridH = 30;
17constexpr int kCells = kGridW * kGridH;
18constexpr int kMaxBlobs = 16;
30 bool empty()
const {
return x1 < x0 || y1 < y0; }
31 int width()
const {
return empty() ? 0 : x1 - x0 + 1; }
32 int height()
const {
return empty() ? 0 : y1 - y0 + 1; }
34 bool overlaps(
const Box& o)
const
36 return !empty() && !o.empty() && x0 <= o.x1 && o.x0 <= x1 && y0 <= o.y1 && o.y0 <= y1;
51 x0 = o.x0 < x0 ? o.x0 : x0;
52 y0 = o.y0 < y0 ? o.y0 : y0;
53 x1 = o.x1 > x1 ? o.x1 : x1;
54 y1 = o.y1 > y1 ? o.y1 : y1;
90 std::array<Blob, kMaxBlobs> blobs{};
93enum class TrackPhase : uint8_t { Idle = 0, Tentative = 1, Locked = 2, Coasting = 3 };
95inline const char*
to_string(TrackPhase phase)
99 case TrackPhase::Tentative:
101 case TrackPhase::Locked:
103 case TrackPhase::Coasting:
124 TrackPhase state = TrackPhase::Idle;
131 int frames_since_seen = 0;
One connected region of foreground cells.
Definition tracking_types.h:59
float cx
centroid, cells
Definition tracking_types.h:62
int area
foreground cells
Definition tracking_types.h:61
Inclusive cell rectangle. A default-constructed box is empty.
Definition tracking_types.h:24
void merge(const Box &o)
Grow to also cover o. Merging an empty box is a no-op; merging into an empty box copies o.
Definition tracking_types.h:40
What the detector found in one frame. Blobs are sorted by area, largest first.
Definition tracking_types.h:83
bool warming_up
background just (re)seeded; no blobs reported
Definition tracking_types.h:85
int dropped_components
components beyond the internal cap (not reported)
Definition tracking_types.h:88
bool label_overflow
ran out of provisional labels; no blobs reported
Definition tracking_types.h:86
int foreground_cells
raw foreground cell count (before blob filtering)
Definition tracking_types.h:87
bool scene_change
too much of the frame changed; background was reset
Definition tracking_types.h:84
Motion detector tunables. Defaults are tuned for an indoor scene 1-3 m away.
Definition tracking_types.h:67
int fg_shift
foreground cells learn 1/2^fg_shift (1/128): no trails, slow absorption
Definition tracking_types.h:70
int fg_age_limit
Definition tracking_types.h:71
int min_blob_cells
smaller blobs are dropped (rejects isolated noise cells)
Definition tracking_types.h:78
int bg_shift
background cells learn 1/2^bg_shift of the difference per frame (1/16)
Definition tracking_types.h:69
int diff_threshold
|gray - background| above this is foreground
Definition tracking_types.h:68
float scene_change_fraction
raw foreground above this fraction of the grid (+ mean shift)
Definition tracking_types.h:73
int scene_change_mean_shift
Definition tracking_types.h:74
int warmup_frames
Definition tracking_types.h:76
int max_blobs
keep at most this many, largest first (clamped to kMaxBlobs)
Definition tracking_types.h:79
The tracked target. Positions in cells, velocity in cells per frame. id 0 = no target.
Definition tracking_types.h:123
Tracker tunables (frame counts assume ~17 fps).
Definition tracking_types.h:111
int coast_gate_growth
extra gate cells per coasted frame
Definition tracking_types.h:119
float alpha
position gain of the alpha-beta filter
Definition tracking_types.h:114
float beta
velocity gain
Definition tracking_types.h:115
int confirm_frames
consecutive matched frames before a candidate is Locked
Definition tracking_types.h:112
float velocity_decay
velocity multiplier per coasted frame
Definition tracking_types.h:118
float gate_margin_frac
or this fraction of the target size, whichever is larger
Definition tracking_types.h:117
int gate_margin_min
cells added around the predicted box
Definition tracking_types.h:116
int coast_frames
misses tolerated before a lost target is dropped (~1 s)
Definition tracking_types.h:113
const char * to_string(ControlMode mode)
Converts a mode to its lowercase wire name.
Definition system_control_types.h:24
std::array< uint8_t, kCells > GrayFrame
One 40x30 luma frame, row-major (index = y * kGridW + x).
Definition tracking_types.h:21