Curve Fitting and Ball Tracking

In this project, our purpose was to track the thrown ball in various lighting conditions and fit a curve using various curve fitting techniques including Least Square, Total Least Square, and RANSAC(Random Sampling Consensus).

The very first step was to extract the coordinate of the ball from the given video:

  1. This was done in the most simple method, which is color thresholding.
  2. After finding a suitable range of HSV values, it is easy to separate the ball from the background.
  3. Using this blob of separated out color, we can use the cv2’s findContour function to find the blob of the ball and also the center of the ball. This center can denote the point that we are going to use for curve fitting.
Extracted ball from background

4. Equation of parabola is given by:

5. We will use the standard least square method to extract the three coefficients – a,b and c. Use this equation to plot the curve.

Standard Least square based curve fitting