Tuning a Retroreflective Pipeline
A retroreflective pipeline finds targets in two sequential stages: an HSV color threshold turns the image into a binary mask, then contour filtering/sorting picks which blob(s) in that mask are the real target. Tune them in that order, since filtering a noisy mask is much harder than filtering a clean one.
Stage 1: HSV color threshold
Switch the web UI's video feed to threshold view so you can see the binary mask update live while you tune.
Hue
The "pure" color, independent of brightness (0 = red, ~59 = green). Tune this first, since it's the most discriminating channel.
Saturation
Color purity: how washed-out (low) vs. pure (high) the color is.
Value
Brightness: how much black is mixed in.
Workflow:
Use the eyedropper tool on the target in the raw camera feed to center the HSV range on it automatically.
Refine with the add/subtract wands rather than dragging sliders blindly.
Raise the minimum Value off of zero. Leaving it at
0passes black pixels through the mask, which is almost never what you want.Keep every range as small as possible: the tighter the range, the more portable the pipeline is to other fields/lighting rigs.
If tracking a red target, enable hue inversion (red wraps around both ends of the hue range).
Stage 2: Contour filtering and sorting
Once the mask is clean, filter which contours in it count as "the target," in this order:
Target Area: eliminates obviously-wrong-size blobs first (stadium lights, scoreboard displays). The area slider is quartically scaled, giving finer control at the low end where real FRC targets usually sit.
Target Aspect Ratio: width ÷ height of the bounding rectangle; discriminates target shape (tall vs. wide). Also nonlinearly scaled.
Target Fullness: percentage of active pixels inside the bounding rectangle; solid targets approach
1.0, hollow/U-shaped targets read lower. Use this to reject partial detections that passed area/aspect-ratio by coincidence.Sort Mode: how to pick among multiple contours that still pass every filter above.
closestpicks the one nearest the (calibrated) crosshair, usually what you want for aiming.Target Grouping: enable dual/tri mode if your real target is made of multiple retroreflective shapes that should be tracked as one.
Smart Speckle Rejection: apply last, to reject small, close-range artifacts (e.g. LEDs). This is an outlier filter, not a primary one.
See Also
Target & Pipeline Types:
RetroreflectiveTape, the typed result this pipeline feeds intoLimelightResults.Crosshair Calibration: needed before "closest" sort mode means what you expect.
Last updated
Was this helpful?