4

I've asked a similar question before, but felt my question wasn't really answered. I'm using the Circle Hough Transform to detect and track a ball. However, I now need an extra check to find out whether the detected circle, is in fact, a ball.

I've been thinking of maybe using Neural Networks, Haar Classifiers, SVM's, that sort of thing (i.e. AI). However, it needs to be incredibly robust and as I'm new to these AI techniques, I'm not sure which is the best and most robust technique to invest my time into learning.

I'm using gray-scale high-speed cameras to capture the images and I'd like to be able to use soccer balls of any colour/pattern. The ball may also be partially occluded.

If you think that these techniques are not suitable, I'm open to any ideas/suggestions for how this can be achieved.

I thank you all for your help in advance, much appreciated!

Adam
  • 610
  • 1
  • 7
  • 21

2 Answers2

1

Just a note this hasn't been tested.

Once you extract ball's location, you can get its contours. My suggestions will work only with soccer balls that have lighter patches and darker patches (which are pentagons).

Determine good binary threshold to grab both white and black patches. Do some image manipulation like erode or dilate to get rid of cracks between patches made by stitches. Draw white circle around the ball to make sure none of your black patches are considered a "hole in the ball" and you're ready to grab contours inside the ball. Main contour is the white countour made by white patches, and all black contours are the dark patches.

Weak points: Dirty ball can have issues with binary thresholding, maybe use adaptive threshold?

1. Using look-up table/math formula(?) for black patches size and distance

Black patch's size depends on the distance from center of the ball. Feed the algorithm with learning data on black patches distances from center and their sizes (both values relative to the ball size).

For example:

Ball in recorded frame has bounding box of 200x200 px and area of 30000px
Found 6 black patches inside:
patch 1 is in the middle (distance 0px from center) and has area of 600px
patch 2 is on the side (distance 50px from center) and has area of 150px
patch 3... patch 4... and so on

So you feed your lookup table with data:

distance = 0% -> area = 2%
distance = 25% -> area = 0.5%
distance = ... -> area = ...
and so on

Now when you check if the thing you detected is a ball, check their black patches sizes. If most of their sizes and distances from center of the ball are within accepted ranges, the detected object is a ball.

2. Checking contour shape

You can check each contour using cvApproxPoly. If most black contours are pentagons - it's a ball.

0

Build your own Classifier using OpenCV. Here is how: http://johnallen.github.io/opencv-object-detection-tutorial/

The difficult part is get a complete set of positive images for any color/pattern of a soccer ball.

Jarvis
  • 117
  • 1
  • 1
  • 10