Automatic Recognition of “offside” Situation in Soccer Game

"Offside" in soccer is a situation where the offense of one team passes a ball to one of its players while he is in front of the defense of the other team.

Abstract
“Offside” in soccer is a situation where the offense of one team passes a ball to one of its players while he is in front of the defense of the other team (i.e. closer to the goal than any of the defence players of the other team). In this situation the judge should whistle and pass the ball to the other team. Many times the judge mistakenly calls offside or doesn’t call when there is, because it is hard to tell sometimes. That’s why this project was thought of, to try and determine automatically by a computer if there was an offside or not based on images of the field and players.

The problem
Our part in the system was the following: on receiving coordinates of the players and the ball in the image, to transfer their coordinates from the image plane to the soccer field.
The purpose of this translation is that the image caught by the camera is a perspective image, meaning that it isn’t a “look from above” of the field, so the lines aren’t exactly parallel and the computer cannot deduce based on the image coordinates alone if their was an offside or not.
Once we do the translation to the world coordinates, then we get correct coordinates on the field and the next stage is to get the coordinates of the players and the ball and determine whether there was an offside or not.

The solution
The basic approach to the task was based on an algorithm by Roger Tsai.
This algorithm, based on a number of calibration points and several known parameters of the camera in use, finds a translation function between the image coordinates and the world coordinates, with the restriction (or the advantage) that the calibration points should be on one plane (in our case – the soccer field).
We chose this algorithm after first applying it to a test surface, where we found very good results based on calibration points which were on one plane (as shown below in Figure 1 – the blue marks are points that the algorithm found after inserting the world coordinates in to it (the opposite transform). After that we applied it to the soccer field itself
The task of finding the calibration points was performed using the Hough transform which finds edges (we used it to find the parameters of the lines of the soccer field) and then finding the points of intersection of the soccer field lines. (as you can see in the image below, the points that the our system found are marked with a red cross).

1
Figure 1 – Test array. Blue marks are the image coordinates returned by the algorithm when inserting the world coordinates to it, red marks are calibration points

2
Figure 2 – the field with the calibration points that we found by applying the Hough transform and finding the intersection points between the lines

Conclusions
We found that the algorithm we used works fine.

    The inaccuracies we did find result from several factors such as:

  • The Hough transform inaccuracies (that result from the fact that the field lines aren’t one pixel wide but more, and so it gives more than one possibility for the line parameters)
  • The fact that the calibration points should be spread out equally on the surface for good results, and our points, based on the intersection points, aren’t the best available
  • Our measures in the field weren’t accurate enough (they were done with a running meter)

The projects goals were achieved, we found a transformation function between the world coordinates and the image coordinates of the soccer field (and vise versa) and test it with good results.

Our suggestion is that it would be better to collect the calibration points by accurate measuring and insertion of the calibration points to the camera model and not by trying to automate the process, that way we can choose more and better spread out points and so, get better results from the algorithm.

3
Figure 3 – The lines were found by inserting the world coordinates of the blue (or red) points for each line and then connecting them. As you can see they do form a line and the distances match the real distances (more or less) in the field. (For comparison, the 16 meter box is about 13 meters from the left corner of the field and the 5 meter box (left corner) is about 24 meters from the left corner of the field)

Acknowledgments
We would like to thank our supervisor, Guy Gilboa, for his guidance and support of this project. We would also like to thank the staff of the VISL lab, especially Johanan Erez for all their help.
Also we would like to thank The Ollendorff Minerva Center Fund which supported this project.