I'm doing a website that should analyze pictures of a Rubik's cube and extract its colors (to reach a solution).
In order to do that I am taking the average color of every square of the cube (6 faces x 9 squares per face, resulting in 54 colors).
My problem was: how to find the color of each one of the faces?
I tryed some stuff and got this:
The function receives all the colors (54 in my case) and the size of each color group (9 in my case, the amount of extracted colors that belong to a cube face).
It will return 6 colors (54 divided by 9), representing each face of the cube.
Hi!
I'm doing a website that should analyze pictures of a Rubik's cube and extract its colors (to reach a solution).
In order to do that I am taking the average color of every square of the cube (6 faces x 9 squares per face, resulting in 54 colors).
My problem was: how to find the color of each one of the faces? I tryed some stuff and got this:
The function receives all the colors (54 in my case) and the size of each color group (9 in my case, the amount of extracted colors that belong to a cube face).
It will return 6 colors (54 divided by 9), representing each face of the cube.
Example of input and output:
I think that maybe this would be a good addition to chroma.js, what you guys think?