Field Horizon and Convex Hull - northern-bites/nbites GitHub Wiki

One of the most useful things we can do is to figure out where the field is. The field highly constrains everything else we do in vision. Lines, balls, and crosses can only be on the field. Goal posts rise up off the edges of the field as do robots. As of fall 2015 we are switching to a somewhat simpler methodology that should also yield better results. Basically we start with the camera horizon and scan down until we find evidence of the field. We do this for about an eighth of the columns in the image. Then we fit a line (or lines if there is a corner) to those points using Ransac.

Finding the points

The robot's pose (which includes the position of the camera) gives us a pretty good idea of where the horizon line is. However, the field is generally smaller than the real horizon and of course the pose can have some errors, so we try to improve that estimate.

Our algorithm is pretty simple. We scan vertically in every Nth scanline to find where the top edge of the field is in that scanline. Those points are then simply processed with Ransac. This field edge can then also be later used in localization as well as in constraining the location of field objects.