1 | initial version |
I've been working on a mindstorms robot that takes pics of a rubiks cube via webcam and then solves it. For the question you ask, I broke it down into two problems: - find the cube in an image..openCV is awesome for this - take the RGB values for all of the squares you found and reduce each of those to one of the 6 colors of the cube. There isn't much use for OpenCV on this part
The code for the first part is at https://github.com/dwalton76/rubiks-cube-tracker and the code for the second part is at https://github.com/dwalton76/rubiks-color-resolver
I did a blog post on how rubiks-cube-tracker works http://programmablebrick.blogspot.com/2017/02/rubiks-cube-tracker-using-opencv.html
You can run it on your laptop and hold the cube up to the webcam to scan the six sides and get a solution https://www.youtube.com/watch?v=3tWnl9rLnfE&feature=youtu.be
This is all open source, feel free to use it and/or contribute to it.