Ball Detection

From Control Systems Technology Group
Revision as of 15:49, 31 March 2016 by Nhernand (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Design Choice

Using a vision based ball detection approach is almost a given if we take into account the fact that we are searching for a non-tracking or invasive method. Nevertheless, several methods were researched and compared:

Methods ball detection.jpg

The final design choice was to use a color detection method and it was made based on the amount of previous experience, non-invasive, robustness and easy to implement criteria.


Color detection methods are based on removing pixels that do not pass a certain pre-defined color threshold. Thus, filtering will output an image with only the color based pixels we are looking for. From that point onwards, matching and selecting the object becomes the main concern. For selecting the ball candidate, a circular shape matching will be used taking into account that a ball will be seen as a circle from all perspectives, assuming there is no occlusion.

The whole detection process can be divided into two main parts:

  1. Color based filtering
  2. Circular shape matching

Color Thresholder App used for a Red Ball + Soccer Lines mask creation. Source: MATLAB

Color based filtering

In order to carry out the color filtering creating a mask is required. Thus, knowing the color we are going to filter in advanced is a must. In this project, the ‘Color Thresholder’ App from MATLAB was used to create the masking functions.

Circular shape matching

The Hough transform is used to detect the circular shape of the ball. Parameters like the sensitivity of the metric and the radius we are looking for should be defined beforehand for an effective matching. Assuming we are only going to have a certain circular shape with a pre-defined radius, based on the theta of the camera’s FOV and the height at which the frame was taken, only the sensitivity of the Hough Transform should be tuned to get the ball candidate with a relative low false positive rate.

Ball detection output

The Ball Detection sub-task outputs the coordinates in pixels of the center of the ball in the frame.

Use in refereeing

One condition to enable Refereeing Out of Pitch is to have detected a ball within the frame.