Processing Images from the 2014 FRC Game

This is a quick sample using GRIP to process a single image from the FRC 2014 Aerial Assist. Keep in mind that this is just a single image (all that I could find in a hurry) so it is not necessarily a particularly robust algorithm. You should really take many pictures from different distances, angles, and lighting conditions to ensure that your algorithm will perform well in all those cases.

The sample image (I'll get more later)

The sample image (I'll get more later)

The original image is shown here and represents the hot goal being indicated by the retroreflective tape on the moveable board. When the goal is hot, the horizontal piece of tape is facing the robot. When it is not hot, the board that the tape is attached is flipped up so it doesn't reflect and that horizontal line would not be present.

The actual algorithm depicted in GRIP

This shows the pipeline as it was developed in GRIP. It took only a few minutes to do this and was the first attempt:

  1. The image was resized by 0.35 to make it fit better for this presenation.
  2. A HSV threshold operation is done to filter out everything but the blue-green lines that are shown in the initial image.
  3. An erosion operation was done to reduce a bunch of the small artifacts that the threshold was not able to filter. This also reduced the line thickness.
  4. A dilation is done to make the lines a little thicker in hopes of better detecting them, although this might not have been necessary.
  5. Then a line detection operation found 4 lines in this case, the few artifacts registered as lines as well as the actual lines.
  6. The smaller artifacts were filtered using the Filter Lines operation as shown in the final step. Filter lines allows the specification of the minimum line size so the extra mis-detected lines are removed from the list.

In the final release, the output of the filter lines operation can be sent to network tables to make it accessible to the robot program to decided whether or not to take the shot.

A simpler approach

It seemed like the erosion and dilation might not be necessary since there was very little noise showing up in the images. So for this image (again - in real life test this with more images), the same algorithm was attempted successfully without those extra steps. In this case the algorithm is shorter and would run more quickly, but might not be as robust as the one with the potentially better filtering. And again, it also found 2 lines representing the hot goal targets.