-1

I'm working in this project under .Net (yes I know, I should be using something different). The idea is to be able to track a ball moving down a table, the lighting situation is usually the same and the background is a still background, no other objects interfere and there always be just one ball being tracked.

The video acquisition part is done, as I'm capturing 25 fps when the ball is in motion, so I got 25 images with different ball positions, and a background initial image so I can run filters to try to extract just the ball and find the center. There is so much info going around and I'm kind unsure where to start with this part as it sounds easy but I'm kind of clueless to computer vision still.

halfer
  • 19,824
  • 17
  • 99
  • 186
Ale K.
  • 316
  • 6
  • 18

1 Answers1

0

This looks like a problem for the CamShift algorithm.

CamShift is an algorithm for tracking objects. One common use of the algorithm is tracking an object with a unique color.

You will first need to initialize the algorithm by taking an image of the ball, converting the image to HSV color-space, and tuning thresholds on the channels in a way that only the ball will be in the ranges (between the lower and upper threshold of each channel), while the background will not.

The CamShift algorithm will search, in each frame, the location in which the most neighbor pixels are in those ranges. The locations are searched based on the location of the object in the previous frame (thus called tracking).

Second, you can use Hough Transform for circles in order to detect the round shape of the ball. This should give you an initial location of the ball, in the first frame, before tracking it through the next frames. Also, it will give you the exact boundary of the ball.

Both of those algorithms are implemented in OpenCV, which fortunatelly for you, has a few wrapper-libraries for .net - See this thread.

Here's a guy who did this in Python, and it looks good: Fast Object Tracking – Robot Computer Vision

Hope this is enough to get you on your way. Good luck!

Community
  • 1
  • 1
Shaked
  • 475
  • 1
  • 3
  • 12