Work

Solving a Rubik's Cube with computer vision

Year: 2024
Type: dissertation
Abstract: In this thesis, computer vision tools for solving the Rubik’s Cube are examined and developed. The main goal of the thesis is to develop a program that can detect the state of a scrambled Rubik’s Cube via webcam, compute a solution for it, and guide human user to execute the solution. This is done in Python using software libraries OpenCV for computer vision tasks and Kociemba for solution computing. Besides creating the program, the goal of this thesis is to examine commonly used tools and practices in the field of computer vision, and to present its applications on other fields of activity. In the first part of the thesis, the relevant background information is presented for the reader. Structure and mechanics of the Rubik’s Cube are discussed, existing solving algorithms are compared to each other, uses and evolution of computer vision are examined, and three already existing remarkable robotic Rubik’s Cube solvers are presented. In the second part of the thesis, the implementation of the program is discussed. The program is implemented using traditional computer vision techniques that are based on detecting different colors and shapes from an image following hard-coded rules rather than utilizing machine learning, although advanced techniques that take use of machine learning are briefly discussed in the background info section. To compute solutions for given states of the cube, an algorithm developed by German mathematician Herbert Kociemba is used. The algorithm allows the program to find near-optimal solutions in minimal time. The programming process was demanding, and it took lots of debugging and error fixing to get the program to work in desired way. Biggest challenges turned out to be the changes in lighting conditions of the environment, and some specific patterns of the cube pieces that often led to flawed conclusions of the state of the cube. However, the final version of the program meets the goal of solving the Rubik’s Cube from any starting state and does not seem to be prone to errors when used properly. A useful improvement for the program would be an automatic calibration of the limit values of the colors to get them to match the prevailing lighting conditions. Also, the detection features could be improved in a way that it would not be so strict in which order the user shows each face to the camera and how the cube is held during the detection and solving. The program could also be used in future applications where the human user would be replaced by robotic hardware handling the cube, making the system completely autonomous.
Institution: Tampere University
Language: English
Open Access status: green
OpenAlex ID: W7132870710
Cites: 10
Cited by: 1
Related to: 10