Ok looking at the input image you gave me, I would suggest the following approach for detecting the objects.
- Take the blue channel from your RGB
image
- Normalize the blue colour channel
for the other colours
- Look for local maxima (using some
threshold region) in that image, it
will be points with high blue
components
- Create a binary mask for those
maxima found
- Assign contours to those regions
- Calculate center points for those
regions
- Use the blobs or the center points to actually track the ball
Some guides that could be usefull