Center Circle - northern-bites/nbites GitHub Wiki

Center Circle Detection

This is a conceptual overview of the center circle detector in the vision system post overhaul (since Summer 2015). For the code, see man/vision/VisionModule.cpp, Hough.cpp, and Homography.cpp. Debugging code is in nbcross/vision_deffs.cpp and nbtool/src/nbtool/gui/images/LineView.java.

The center circle detector is a transformation and clustering on “orphan” or “rejected” edges as a means to find circles of a known diameter in the image. The following five steps outline the general algorithm.

1. Find Rejected Edges

Edges, as defined by the vision system, are image pixels of peak gradient in the Y image that also have expected gradient direction in the green image (for information on the Y image and green image see Front End. These edges are used as input to the Hough transform to detect lines. A “reject edge” is defined to be an edge that is not in a field line after the transform.

2. Map Rejected Edges to World Coordinates

Edges store their magnitude and direction (the strength and angle of the gradient at the point in the image). Because the CC detector uses the known shape of a circle as essential information, it must map all the rejected edges to world coordinates using helper methods defined in Homography.cpp. As a part of this process, if there are more than a certain number rejected edges of the same angle, many are discarded, because it is likely that they belong to a line in the image which was not detected as a hough line.

3. Find Potentials

A “potential” is a potential center circle center. The output of this detector is where we think the center of the circle is, in robot-relative world coordinates. To find a potential center, it calculates two points from each mapped rejected edge. One is 75cm (center circle radius) in the direction of the gradient of the mapped edge, and the other is the same distance in the opposite direction. The idea is that, if the CC is in the image, all the edges in it will make a circle of radius 75 once mapped to world coordinates. If the directions of the edges are accurate, each edge will provide on potential right in the middle of the circle and one way outside of the circle. Because of the curve of circles, the ones outside the circle should be sparse while the ones projected in the “right” direction, towards the middle, should be very condensed.

4. Cluster Potentials

Clustering on potentials is done by accumulating points in bins. If a bin has a high enough ratio of all potentials, the center of the center circle is predicted to be at its center.

5. Check Midline

There needs to be a field line (the midline) near the center found from binning. For this reason, the CC detector doesn’t even run if there aren’t any field lines in the image. If there is a midline near the predicted center, the prediction is moved to the closest point on that line for increased accuracy, and that line is labeled as the midline for the loc system. Additionally, field lines that are found near our new center circle prediction are discarded if they are short and nearby. This reduces false field lines found in the center circle itself.

Thresholds

There are a lot of thresholds in this system, and they likely need to be tuned to the environment. The most important are

  • Max rejected edges of the same angle
  • Min rejected edges
  • Bin width and count
  • Clustering confidence (how many potential points must be in the highest rated bin)

Future Work

  • Implement confidence values of center circles
  • Change some hard thresholds to fuzzy thresholds
  • This doesn't really have to do with this module but increased homographies will GREATLY improve this detector (and the line detector...)

[email protected] if you have any questions!