The ball detection algorithm (without the use of a trained model) has been completed. Following the work posted in the last blogpost, I realized that it may be a better idea to isolate the ball away from its environment and determine its bounding box in the cropped image. The first analysis of the ball based on a conservative value for color sensitivity provides an initial estimate of the location of the ball. The image is cropped around the first estimate (of the largest contour) and is analyzed again with a larger range of sensitivity which leads to a larger bounding box that includes the entire ball.
I have also removed histogram equalization since it distorts the image to an extent of causing unrelated contour to appear greener and hence interfere in the proper detection of the largest contour (which should be some part of the ball). Moreover, instead of considering the weighted mean point, the modified algorithm outputs the center of the bounding box of the largest contour.
Splitting the algorithm into two steps has helped detect the ball in all 31 images available. Moreover, the bounding box has accurately surrounded the ball for most images.
01.png 02.png 03.png

However, the algorithm has failed to detect the complete ball in a few images but has rather detected a section of the ball:
04.png

This will be an issue for the next step of the problem: monocular depth estimation. As a result, I am looking forward to refine the algorithm by training and similar techniques.

Next Post Previous Post