Magic Vs Machine


Magic vs. Machine is a robot that solves the classic game, "Three Cups, One Ball", where a magician shuffles three identical cups, one with a ball underneath, and an onlooker tries to follow (or guess) which cup holds the ball. Our project acts as the onlooker, accurately following the cups.

How it was made.

We primarily used this project to learn various aspects of computer vision and motion tracking. First, we use OpenCV (a standard, open source computer vision library used in most every computer vision application) to record still frames from a cheap USB webcam; then we "binaryize" the image, converting RGB values less than a threshold to black, while retaining the lights as white -- this isolates the white cup caps; following is a search for circular blobs (patches of white roughly resembling circles); using the current coordinates of the blobs, and their previous coordinates, we can determine which blob is at which new position. The image modifications and blob detection algorithm used many functions from the OpenCV library, the tracking algorithm was written entirely by us. By interfacing these modules to an Arduino (serially with the python-Arduino library), lights, and buttons, we took our project beyond the screen into a well-rounded hardware/software hack utilizing all groupmembers' respective majors.

Challenges we ran into

During the completion of this twelve hour process we ran into many issues with the code. The first problem was that the lighting and skin tones causing conflicts with detecting blobs, we solved it by adjusting the background and wearing dark clothes. The second issue was blobs doubling up on numbers which became a huge issue as it not only reduced the amount of possible moves we can achieve but it would end up causing an irreversible error in the code. The last issue was that going out of bounds would cause one blob to triple up on values creating another irreversible issue. We fixed this issue by understanding the boundaries that we are allowed to cross, thus making the issue irrelevant.

Accomplishments that we're proud of

The greatest accomplishment was creating a complete project that starts and finishes with minimal issues. The second accomplishment was how cohesively and quickly we solved the issues with our program which lead us to a timely completion.

What we learned

We learned about object recognition especially when it comes to open cv along with tracking algorithms. We also learned about integrating multiples systems such as an Arduino, a camera and a computer in order to create a fully function single unit.

What's next for Magic vs. Machine

Both as a team and individually, we plan to use skills, knowledge, algorithms, and techniques acquired herein in future computer vision and artificial intelligence projects.

Share this project: