This is a contest sponsored by Nvidia and presented by CVZone.
The task is to predict the path of the ball being hit and to predict whether it will go in the pocket or not having to predict before the cue ball touches the colored ball.
To solve the problem, the contour approach was used, finding contours of Stick, Cue and Ball in specific frame, then making math calculations and projections it is able to tell if the ball will fall inside one of the 6 holes in the table. If that is the case, draw in green the path and the ghost balls else will draw in red.
For finding contours some tweaks in Canny variables and Kernel size was made to get the all contours, then are filtered to keep only the ones of interest.
Holes and lower edge will have the same coordinates in every case.