Motion Detection

Usage

motion.exe <feed_number> [settings_file]
motion.exe --help
ArgumentDescription
feed_numberWhich feed to monitor: 0, 1, or 2 (required)
settings_filePath to settings.txt (default: settings.txt)

Description

Each motion detection instance monitors one camera feed for jumper movement. When sustained motion is detected, it triggers video recording.

Detection Pipeline

For each new frame, the pipeline executes 10 steps:

StepOperationDescription
1Frame DiffCompute absolute pixel differences (Y, U, V) between current and previous frame
2HistogramsBuild per-plane histograms of difference values
3ThresholdDerive adaptive thresholds from histograms and settings
4Binary FrameApply thresholds to create binary motion map
5UV MergeMerge U/V detections into Y plane (2x2 expansion)
6Flood FillRecursive 8-neighbor connected component detection
7Blob CollectScan for blobs, compute centroids and bounding boxes
8Blob MergeMerge nearby blobs within fuzz tolerance, filter by size
9DistanceMatch blobs to previous frame, compute movement distance
10TriggerEvaluate sustained motion count, trigger recording

Motion Region

Only pixels within the configured motion region are analyzed. Set per-feed boundaries to exclude non-relevant areas:

motion_start_x[0]=100
motion_start_y[0]=50
motion_end_x[0]=1800
motion_end_y[0]=1000

Trigger Logic

Motion detection uses a sustained-count approach:

See Motion Detection Tuning for adjustment guidance.

Output

Results are written to the frame header in shared memory:

See Also