Motion detection used to be one big function. Now it's a MotionDetector trait with five interchangeable implementations:
- Census (default): illumination-invariant 3x3 census transform foreground.
Best general-purpose detector for outdoor scenes.
- Frame Diff: classic frame differencing. Cheapest. Good for indoor.
- MOG2: Mixture-of-Gaussians background model. Better at slow scenes.
- Optical Flow: flow-based foreground. Better for low-contrast motion.
- Ensemble: weighted combination of the above. The "I'll try everything"
mode.
Plus a sixth option: use Frigate as the motion source. If Frigate is already doing detection for a camera, Crumb can subscribe to those events instead of running its own pass.
Why pluggable
Different cameras, different scenes, different problems. Outdoor in California sun is a completely different motion problem than indoor under fluorescent flicker. One algorithm doesn't win them all. Per-camera selection means each camera gets the right one.
Reproducible benchmarks
A golden-replay test ships with the recorder. It plays a known clip through each detector and asserts the detection result hasn't regressed. Adding a new detector means proving it against the golden set first. Adding a new clip to the golden set means thinking carefully about what "correct" detection actually means for that scene.
Detection icons on the timeline still come from Frigate; the trait change is about how Crumb itself decides where to cut motion segments.