A number of improvements have been made to the imaging software.Â
Using almost hardcoded values for the position of rods in the picture, the position of the human men on the rods can now be found. For each rod the algorithm works by starting to look at the rod from one end and progressing towards the other, pixel by pixel.Â In each pixel row it measures the number of pixels that look like a man. Then a weighted average of these values is made to find the actual position of the man.
TheÂ ball finding algorithm now usesÂ a weighted averageÂ of the color values in each pixel to find the exact position of the ball.Â This should giveÂ sub pixel precision but measurements of the variance in the found position with and without a weighted average should be made.
When playing, the camera shakes back and forth. To compensate for this when trying to find the ball and men, we have made an antishaking algorithm that continually looks at one edge of the table. When this edge moves the antishaker changes the corner pixels of the table accordingly.
On the calibration picture you can see where the program has found the white sticker in the corner, where it thinks the corner of the actual playing field is, where it thinks the rods are and where it finds the edge of the table (for the antishaker).
The big black box shows the area within it looks for the white sticker. The smaller black boxes indicate where the antishaker looks for the white to dark transition and thereby the table border.