Weblog > Solve Rubik’s Cube with your Webcam
Via YouTube I found a how to solve Rubik’s cube video by using your webcam.
A C++ application called CVRubik.exe is used that solves a 3×3 Rubik’s cube. It uses a webcam to “look” at a Rubik’s cube and generate a step by step solution in 3D graphics on your computer. CV Rubik draws on knowledge from different fields of computer science such as Computer Vision, Artificial Intelligence and 3D Graphics.
The following steps are performed by the program at runtime:
1. The user holds a scrambled 3×3 Rubik’s Cube in front of the webcam.
2. Using the OpenCV library, the live video feed is processed to locate the cube in the input image and determine the 9 colors of the frontal face.
3. The user rotates the cube 5 times for the software to capture all the other faces.
4. Using OpenGL, a 3D cube that matches the original one is created and displayed on the screen.
5. The cube is solved one step at a time using the solution published in 1981 in the DER SPIEGEL magazine.
Note: If no webcam or cube are available, the software gives the option to generate a random cube. Happy Puzzling!
Tags: Rubik’s Cube