I agree with other posters that using basketball color is a good approach. Here is some simple code that does this:
import cv2 import numpy as np im = cv2.imread('../media/basketball.jpg')
result:

I suppose that:
- One and only one basketball is always present.
- Basketball is the main orange item on the stage.
With these assumptions, if we find anything in the right color, we can take his ball and put a circle in it. Thus, we do not do any circle detection at all.
As you can see in the top image, there are some smaller orange elements (from shorts) that can ruin our estimate of the radius of the ball. The code uses the opening operation ( erosion followed by dilation ) to remove them. This works well for your sample image. But for other images, a different method might be better: using the detection of a circle or contour shape, size, or if we are dealing with video, we could track the position of the ball.
I ran this code (only modified for video) on a random short basketball video, and it worked surprisingly well (not great .. but good).
source share