Changed the algorithm to consider the average of the x-radius and y-radius rather than finding the longest sequence in vertical and horizontal directions and using their intersection as the position of the ball. The new algorithm works by finding the x-diameter, then searching up and down from the middle of the x-diameter, and taking the average of the height in each direction. The radius is then determined by taking the Math.min of the x-radius and this y-average-radius. The "blob" with the biggest radius is chosen as the ball.

This algorithm is simultaneously done for red and blue "blobs".