Skip to content

Dimnir/TrackingSnookerBalls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 

Repository files navigation

Overview:

Projects Goal: Tracking Snooker balls, generating 2D top view.

Environment: Jupyter Notebook, Python, OpenCV


Final result should look like this:

input_output

Output video - YouTube link


General info:


In this project I created a model which detects Snooker balls in a video and generates a 2D version of the table.

input video: YouTube link

Steps:

For each frame:

  1. Warp the perspective of the original frame.

  2. Using HSV image to get color of table, mask the table, invert the mask to get image of masked objects on the table.

  3. Finding contours of each object

  4. Filtering contours based on their shapes and sizes.

  5. Calculating average color inside of each contour to get each balls color.

  6. Drawing a colored ball for each contour at its center on a 2D generated table.


steps image

  • for designing the 2D table I just used cv2 functions Circle , Line . markdowns according to this link

Overall:

The model can track the balls and generate a 2D version of the table, although the final output is not perfect.
This is a simple model which does not know position of balls and does not remember balls locations, it only projects 'what it sees' no matter how many balls or what colors they are.