Free Object Ball detection for real time processing

justnum

Billiards Improvement Research Projects Associate
Silver Member
The advances in technology means sports can innovate and adopt innovations.

A still image from video can be broken down into numeric data. Todays computers might be fast enough at least high end sports cameras and (HE) computers to use hard coded algorithms to detect circles and then map that data to a bounding box and track data as it processes.

The math is filter data coordinates into a set. Filter the set using a shape analysis (convex geometry). Reverse map the shape analysis to the center of the box. Pass the center value for advanced analysis.

If anyone thinks this is a valid claim, I can do the programming for a cue ball without anything in its way. That is the free demo.

Accustats has proven selling sports that are statistics driven works. Object detection in billiards live broadcast would be a Sputnik moment.
 
Billiards has a wide array of products that don't really sell.

I need a computer project to show off at school and object motion tracking is still limited to commercial software.

If no one has done it, then I can be the first to do it in billiards, like Pat Fleming and Accustats.

Technology has been a blessing for billiards, during and post COVID.

Technology innovations is a BARPA initiative.

openCV on python3 if anyone codes I am doing intro cases tonight.

The initial test cases are detect a circle on blank page. That is the math part.

There are many ways to detect a circle on a blank page, its computationally expensive and an interesting problem to me.
 
The first programming sprint was revealing:

Color detection per pixel was impacting computation speed.

Based on the hardware I have I can only test a fixed setup and it has to be extremely well lit.

The concept is to map what the camera sees, scan every pixel for the pre measured color of the cueball from the distance and lighting that will be covered for the next test. Camera distortion will be an issue, lighting and shadows can also be a problem.

Eliminating pixels from the data group saves computation time, that takes math skill. That means everything happens in real time with no computer processing delay.

The next programming challenge is to calculate the edges of the pixels with the assigned color and determine a bounding box and its center.

In theory I am making a openCV color scanner with real time processing, that will only be tested on billiard balls on a green background from an overhead view.
 
Limitations on Object Ball Tracking:
The balls move too fast at the beginning of a stroke.
It is unlikely the camera is sampling at a fast enough rate for useful analysis.

The next best application for object tracking could be for shot analysis. Presenting information in a filtered or scoped format can help find the best correlations for adjustments.

The second best application is for making animations using filters on video.

What did I learn?
The default library for openCV is well written.
The sift patent expired.
I want to make my own camera, a cheap high speed cam.
python3 is standard
Custom machine learning tools is standard
No one is applying any of the math I learned to the problems, they are clearly designed to solve. Convex geometry, its really big at the Austrian universities.

The below pic is the camera test at 9 inches with weak lighting. I am thinking a video about a cat playing with a billiard ball could be the best application of my time learning this code.
1721789352846.png
 
Object Ball detection is working. The best application is for carom shots.
Pocket billiards is played too quickly to be scanned properly by today's computers.

The video shows a move around in real time with real time scanning. A proper presentation will be developed for product line purposes.

 
Interesting! A practical application might include rolling balls on tables to find unlevel spots/slate cracks/rail issues with precision.
 
Interesting! A practical application might include rolling balls on tables to find unlevel spots/slate cracks/rail issues with precision.

It has been interesting. The rolling ball test is planned for tonight. I tried moving the ball slowly and it reads it.

Next I also have plans to auto diagram the paths, this way I can print them out. The library of carom shots as published by BARPA. All scanned and free for distribution courtesy of the Professor Ramos foundation.

If anyone wants the code let me know, its in python3.
 
Detecting the position of the balls when they're stationary is straightforward. Detecting the ball number (1-15) or the ball type (solid/stripe) is less so. Detecting the ball paths is more difficult. At 30 fps, a ball hit at 10 mph moves about 6 inches between frames.

You'll find that the first 80-90% of that is fairly easy. The edge cases are tricky.

Good camera placement and good quality imagery make a big difference. One or two overhead cameras really helps.
 
The advances in technology means sports can innovate and adopt innovations.

A still image from video can be broken down into numeric data. Todays computers might be fast enough at least high end sports cameras and (HE) computers to use hard coded algorithms to detect circles and then map that data to a bounding box and track data as it processes.

The math is filter data coordinates into a set. Filter the set using a shape analysis (convex geometry). Reverse map the shape analysis to the center of the box. Pass the center value for advanced analysis.

If anyone thinks this is a valid claim, I can do the programming for a cue ball without anything in its way. That is the free demo.

Accustats has proven selling sports that are statistics driven works. Object detection in billiards live broadcast would be a Sputnik moment.

There are several threads on here already about using opencv for this task.
 
There are several threads on here already about using opencv for this task.

Not true. BARPA is placed near the top of google search results.

None of the other results are sharing code.

And even fewer of them post here.

I am one of the leaders for openCV in billiards and soon carom.
 
Detecting the position of the balls when they're stationary is straightforward. Detecting the ball number (1-15) or the ball type (solid/stripe) is less so. Detecting the ball paths is more difficult. At 30 fps, a ball hit at 10 mph moves about 6 inches between frames.

You'll find that the first 80-90% of that is fairly easy. The edge cases are tricky.

Good camera placement and good quality imagery make a big difference. One or two overhead cameras really helps.

I agree that is why I am pivoting to three cushion or carom.

Its three balls and mostly played at slow speeds.

I do have hopes to use the scanner for ball counting in 14.1. The ball number wont matter.
 
I am one of the leaders for openCV in billiards and soon carom.
I am really sorry. But you are not. You are using a Hough transform and contour analysis only, and as I can see you are not varying your detection radius dynamically. No optical flow. I’ve spent a lot of time on this problem using OpenCV and I have failed, but not as spectacularly as you. I am saying this only because you are not being humble.

I know a few people that have created production ready ball tracking systems, for example the one used for Kazoom. They use sophisticated hardware and training algorithms, not a hobbyist toolkit package.
 
I am really sorry. But you are not. You are using a Hough transform and contour analysis only, and as I can see you are not varying your detection radius dynamically. No optical flow. I’ve spent a lot of time on this problem using OpenCV and I have failed, but not as spectacularly as you. I am saying this only because you are not being humble.

I know a few people that have created production ready ball tracking systems, for example the one used for Kazoom. They use sophisticated hardware and training algorithms, not a hobbyist toolkit package.

So where is your free working demo? its presentation time and I am the only project active this year. If you want free help just ask.

Ive been talking about automated scoring in the 14.1 section.

Its now feasible for me with the free software and commercial hardware.

Only a handful of people can read the code and implement the code. That is why it is commercially locked software.

However its as simple as linear algebra and some statistics.

Hough is costly. I am using only linear transforms. I am filtering the bounding boxes with lower and upper limits.
 
Back
Top