Cassapa - Augmented Reality Pool Game

Cassapa is a system to help aiming at pool games. It uses augmented reality to help the player to adjust the cue direction.

Similar projects worth following
Cassapa is a system to help aiming at pool games. It uses augmented reality to help the player to adjust the cue direction.

Here's a video of the project:

Here is a diagram of the main components:

The system is comprised by a computer, a webcam and a video projector. The camera is placed on the ceiling, above the pool table. It's very important that the camera is positioned parallel to the ground, at the center of the table, so the captured image won't be distorted.

The projector is placed next to the camera. It won't be parallel to the table, but we can fix the projection distortion later, using either the projector own trapezoid corrections or even using homography.

The computer can be anywhere in the room, but it's easy if its near the camera. Some cameras doesn't work with long connection cables. The smaller the computer, the better to fix it on the ceiling. But I'm assuming a Raspberry Pi doesn't have the processing resources necessary for a smooth video processing.

The software running on the computer will get the camera image, detect the positions of all the balls on the table, detect the position and angle of the cue, calculate the game physics and draw the cue aiming on the screen, which will be projected on the table surface by the video projector

This software is based on the open-source (BSD) computer vision library OpenCV. There are parts of the code that rely on FMOD library for sound. FMOD is free for non-commercial uses, which is the case of this project. But these sound functions of Cassapa are not mandatory, and can be removed if you're not ok on using non-open-source code.

  • 1 × Zotac ID41 mini-PC Actually, any computer would do it, but a small one is better. RaspPy doesn't have enough "HP" to run the computer vision software
  • 1 × Logitech C525 webcam A good cam for computer vision: Auto-focus, good adjustable base, with rubber grip. 720p,

  • Now on github

    alex07/02/2017 at 13:40 0 comments

    Finally revamped/cleaned the code and uploaded it to github:

  • Lighting issues

    alex08/19/2014 at 23:27 0 comments

    Since this is a glassless augmented reality system, I'm facing some lighting problems related to the interaction between the camera and the projector.

    The first problem is simple: The camera needs a lot of ambient light to detect the image. However, the projector works better on darker environments. Finding the best compromise between these may be tricky. And, with my first set, I didn't have much choice, because of my cheap projector. Now I'm moving to a better one.

    A possible solution for that is to use a non-visible source of light. For example, a torch made out of IR leds. That would not interfere with the projector image, but would still be "visible" by the camera sensors. The problem here is that we would loose any color information on the image. You can see, by the simulation of the next image, that it would be harder to identify the balls against the cloth without the contrast of their colors

    As pointed by the red arrow, we also have some visual elements that are easily confused with a ball (The light reflecting on my hand, at this example). Another detection that is harder to do without color information

    Another problem is that the projector image is projector over the image captured by the camera. So, the captured image will include all drawings made by the projector, and them may interfere with the computer vision. For example, the software may confuse a projected aiming line with the cue. I'm dealing with this by adjusting the brightness of the projected image, so it will only create "translucent" drawing over the table cloth that I can easily filter out via software.

  • Reality is not only vision

    alex08/17/2014 at 21:17 0 comments

    It seems that the common-sense for Augmented Reality is something related to what we see. I found out that I was struck with this "vision" (tum-tum-tss) when I realized that what I wanted is a system to help me aiming the cue, and that doesn't mean this help shall be visual.

    So, since I'm still having problems to attach the projector permanently on the ceiling, I've added an audio output to Cassapa, to help the aiming when the projector is not available. It plays an continuous sound when the cue is aiming a ball, and the changes the pitch according to the trajectory forecast. Pitch increases as the probability of the ball hitting the pocket increases.

    Currently I'm doing this with FMOD library, which has a non-commercial license, but I'm still looking for a fully open alternative. Since this is functionality is not mandatory for Cassapa, it can be completely removed if you don't agree with free-as-beer-but-not-free-as-speech software.

  • Cover

    alex08/10/2014 at 23:32 0 comments

    To get rig of those ugly wires and equipments hanging on the ceiling of my living room, I'm preparing a cover that will also work as a lamp for the pool table. 

    I made this box with a 1mm sheet of aluminum. It's just a long metal rectangle, bended to make a square,

  • The current set

    alex08/06/2014 at 23:23 0 comments

    So, I've got a mini-PC installed on the ceiling for the first prototype.  This is a Zotac box, with an Intel D525 processor. Its performance for the computer vision software is good (Sometimes 17 frames/sec). The camera is a Logitech C525, which has a very nice articulated base, and can be easily adjusted to point the correct direction.

    Unfortunately, there's no room for the projector on the ceiling. All projectors I found need at lease 3 meters from the projection screen, and I have less than 2 m from the ceiling to the table surface. There are some low-distance projectors out there, but they are expensive. I'll try to put the projector at another position, and then fix the image distortion via software or via the projector.

    Wife didn't get very much happy, so I'm already planning a lamp or something else to cover it. :)

View all 5 project logs

View all instructions

Enjoy this project?



domenico.thoeni wrote 07/20/2015 at 09:53 point

Hey there. I've done the very same project for my recently finished Bachelors thesis.

Regarding the problem with the ceiling height, which I also encountered: Check out the Acer S1370WHN. It creates an Image with a width of 2 Meters upon 1 Meter distance!

If you need any further help, we maybe could work together on this!

  Are you sure? yes | no

tyspa wrote 04/25/2015 at 13:09 point

Your link to the Github repo appears to be broken.

  Are you sure? yes | no

Jasmine Brackett wrote 08/06/2014 at 00:15 point
Hello Alex, now is the time to add a few more details to your project to give it the best chance of going through to the next round of The Hackaday Prize.

Your off to a good start as you've got the video, the video link, the system design document, and a link to your source code (I'd move it from the build instructions and put it with your video link).

By August 20th, you need to to make sure you have 4 Project logs, and remember to mention any licenses or permissions needed for your project. For example, if you are using software libraries you need to document that information.

There is a couple of tutorial video's with more info here:

Good luck!

  Are you sure? yes | no

Adam Fabio wrote 07/29/2014 at 05:54 point
As someone who grew up playing pool, I have to say this is an awesome project! Thanks for entering Cassapa in The Hackaday Prize! One of the great things about structured projection is that it can be an incredible interactive tutor. I think you've captured that here.
Keep the updates rolling in, and don't forget about the videos as well! Good luck!

  Are you sure? yes | no

Nicu Buga wrote 07/28/2014 at 05:43 point
awesome project

  Are you sure? yes | no

zuul wrote 07/25/2014 at 04:09 point
just like in quantum leap

  Are you sure? yes | no

lydenmarikh wrote 01/26/2016 at 01:20 point


  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates