Baxter Hills

Billiard Laser

Concept

In the game of Snooker, if your opponent misses the object ball entirely, it's a foul shot and you can have the balls put back to their original positions and have them play again and again until they hit the ball-on, or when there's not enough points on the table for them to win due to the foul points given away.

The only problem is, many balls can be disturbed in a foul shot and all of them have to be replaced with extreme precision, otherwise the match outcome is affected. Both players have to agree on the replacements and there can be disputes and arguments, slowing the match down for up to several minutes at a time.

No doubt many important matches worth $100,000+ have had their match outcomes affected as a result of inaccurate ball replacements, arguments between players, and disruption of flow and focus. Not to mention the crowd get bored out of their mind waiting.

Bad Ball Replacement
Players Arguing
Arguing with Referee

But there's a better way! With the help of software and (in the future) lasers, you don't have to rely on memory and we can speed up the process and make it more accurate.

Software Design

I am using a Windows Forms C# .Net App, with the Emgu.CV package for edge detection in images and the Aforge.Video package to handle incoming camera frames. To get live video input I use my phone's camera running Iriun Webcam, a free app that streams video over wifi. The pc also runs iriun as a receiver.

The main form allows you to take in either pre-recorded videos for testing or live camera. It attempts to detect the cueball in every frame and track shots, which is what happens from when the cueball starts moving to when it stops moving.

When you want to replace the balls in the event of a miss or foul, you simply select the frame before the miss and open up the Ball Replacer form.

This form shows the starting table position with the live camera feed superimposed on it at a lower opacity. Here you can quickly and accurately replace the balls by moving them until they both match up and appear as one. This is a manual method but it is very accurate and relatively fast, and certainly superior to relying solely on memory.

Original Positions with Camera Overlaid

To identify the cueball in the image, it uses an RGB mask for both the cloth and cueball colour, which is fine tunable with a Debug Video form. You can also enable blurring/sharpening, and table-edge filtering. In this form, it also shows all the stages of image processing to identify where the processing or masking is going wrong. The changes are effictive immediately and work while video or camera is being processed.

Debug Form Showing Intermediate Images

Hardware Design

I am using a Joby Gorilla tripod positioned high up to hold the phone to get a view of the whole-table.

I am working to make ball replacement even easier with an automated laser system that shines the exact ball position on the table for quick replacements. This was the initial goal that I came to mind when I conceived the idea for this project.

Using an Arduino R3 board, servo motors in a pan/tilt configuration, and a laser module, I have attempted to setup an automated replacement mechanism, however the accuracy was unacceptable. I am currently working on replacing the servos with high gear ratio (420:1) stepper motors. Stay tuned for an update on that.

Last modified: 03 December 2024