-2

I want to make a program that solves the Rubik's cube.

Basically, I want the easiest way to get an output like this:

G G Y W W Y B G G

From an image like this:

enter image description here.

Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
  • I agree with Amitay Nachmani's answer. To improve it you could place a white marker somewhere (like behind the cube) as there is possibility white cell is not visible in an image. Then do white balance and black correction and only then determine color. Take a look at related QAs:[Get quantitative value for color on two-color scale](http://stackoverflow.com/a/35766531/2521214) , [What should i use HSV/HSB or RGB ? and why?](http://stackoverflow.com/a/30024735/2521214) , [RGB value base color name](http://stackoverflow.com/a/37476754/2521214) – Spektre Aug 17 '16 at 07:59

1 Answers1

1

Using only colors for the recognition is a very problematic because the colors are very sensitive to change in the light of the scene. Therefor if you insist on using only color i would do the following:

  1. Take several images
  2. For each image identify the colors and sample them.
  3. Use the White rectangle to do white balancing.
  4. Correct the sampled colors according to the white balancing.

For a new image first do white balancing second use the sampled values to segment the image according to each color.

My suggestion is use also the shape of the rectangles and not only the color for the segmentation.

Amitay Nachmani
  • 3,259
  • 1
  • 18
  • 21