Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I think Yolo is a bit overkill for ball detection, but you can keep if it works. You might also try HoughCircles.

The idea you had is clever, but unfortunately there's a risk of having important errors. The problem is that a 1 pixel error in the diameter detection can lead to large errors in distance estimation (~0.5-1m). (and if you zoom in to a far ball, you can see its pixel level contour is not nice)

Anyway, what you can try is to take a ball that's close (C) and another one that's far (F). The corners of the trapezoid are: (0, C.y),(W,C.y),(W/2+R*W2,F.y),(W/2-R*W2,F.y) where R=F.d/C.d.