im_orange = im.copy()
im_orange[im_hsv == 0] = 0
element = np.ones((5, 5)).astype(np.uint8)
im_hsv = cv2.erode(im_hsv, element)
im_hsv = cv2.dilate(im_hsv, element)
points = np.dstack(np.where(im_hsv > 0)).astype(np.float32)
center, radius = cv2.minEnclosingCircle(points)
cv2.circle(im, (int(center[1]), int(center[0])), int(radius), (255, 0, 0),
    thickness=3)
out = np.vstack([im_orange, im])
cv2.imwrite('out.png', out)
How can i pythonically us opencv to find a a basketball in an image?