By means of color separation and edge detection we divide football players into their groups.
Abstract
By means of color separation and edge detection we divide football players into their groups.
The final purpose of this work will be automatic detection of an offside and our project is one of the stages to this final goal.
The raw material is a video film taken from a static camera.
The algorithm
Part 1: Finding the location of a player.
(a) The original picture is taken from the video film as a single frame from the avi file.
(b) We applied a gaussian filter on the original picture in order to remove noise, added by sampling, quantization, etc.
(c) A sequence of frames are selected and analyzed by the median filter. The median filter was applied in the forth dimension which is
the time dimension. Each pixel was compared to the corresponding pixel in the other frames and the median value is selected.
The result contains only the background, which is the static part of the picture.
The reconstructed background presented below:

(d) After the background image is subtracted, we can detect moving objects. By usage of Sobel filter the main edges were detected.
The result is a binary image.
(e) This stage is constructed from the following steps:
1.Each 3×3 block that contains more than a certain threshold of ones, was replaced by a single pixel with the value = 1.This is a sort
of dilation and sub sampling of the edged picture.
2.On the smaller picture the actions of dilation and erosion were applied.
3.In order to receive smooth and complete shapes, we applied one more filtering: using bwmorph command with a majority
parameter.
Results

The Sobel Result After dilation and sub sampling

After Erosion After Majority
The larger shapes were detected (above a specified threshold) and their locations were saved.
Part 2 – Separation by color detection:
As the first step, the user selects an area that contains the player’s uniform.
Three methods were checked:
Average method:
The selected area is the player’s shirt only. The values in the R, G and B components were averaged separately. This
average value wastransformed to the HSV domain and was used as a reference color for that group of players.
The main disadvantage of this method is that the player’s shirt might contain several colors, and thus the average values
of two differentgroups, might be similar. (Though the group colors are very different).
A)The Bases method.
The selected area is the player’s shirt and pants. By using the assumption that the player’s uniform contains two main
colors, one canestablish the two points representing the mass centers of those colors. (This method can be extended to
more than two colors).
This method gave better results than the previous one.
The green and blue points are the two selected players.
The diamond shaped points are the corresponding bases.
Perceptron method.
The inputs to the perceptron are the two areas selected by the user for the two different groups.
In the learning phase, the perceptron creates a line that separates between the two groups.
When the separating line is a straight line, the perceptron searches for two weights W1, W2 and a bias b, in each iteration:

Conclusions
1.95% success in color separation of the players, by the perceptron method.
2.92% success in color separation of the players, by the bases method.
3.Good detection of ‘third party’ players such as the judge and the gatekeeper.
4.Massive processing operation are made once, and off-line.
To view the result movie: click here
Acknowledgments
We wish to thank our project supervisor, Mr. Guy Gilboa and the Vision and Image Science Lab. and also the management of the Haifa’s football
stadium that allowed us to film a football game. Also, a special thanks to Mr. Tsvi Dvorkind and Amir – husband and friend.
Also we would like to thank The Ollendorff Minerva Center Fund which supported this project





