color extraction

Hello, (new user)

Is there any way I can extract the dominant color out of a picture(s)?
And re-group the output colors in a different way to construct a new image (for example, all the new colors (from different pictures) will stretch vertical on top of the other.

Thank you!! 

 

Hi zun,

could you please be a bit more specific? What do you mean by dominant color? Do you want to cluster the rgb-values and take the biggest cluster? Or do you want to average the rgb-values?

In case you want to cluster the color (rgb-values) of an image, we have no dedicated node for that. But if you accept a certain overhead, you can do that as demonstrated with the attached example workflow.

Thank you so much hornm for the quick replay, 
being more specific (also i am not as fluent with the terminology) 
calculate the percentage of each color in the picture,
and show only the highest value (a really red pic= red and so forth)
I tried to use the “Average filter” in a some picture, and got
A close result (but I don’t know the mechanics of this filter, and it is not a “generic color")

Example I found: (http://lokeshdhakar.com/projects/color-thief/)

 

Again, thank you!!! 

Hi zun,

I had a look on the color-thief and found that it does actually clustering, but with a specific algorithm called "median cut". Hence, the basic procedure would be similar to the example workflow I attached in my previous reply, unless the k-Means cluster algorithms used there could be replaced by another one. But, as far as I know, there is unfortunately no median-cut node in KNIME.

Actually, ImageJ is apparently using the median-cut algorithm to convert RGB-images to 8-bit images. Its source (http://imagej.nih.gov/ij/source/ij/process/MedianCut.java) is maybe a good starting point ...

 

P.S. To speed-up the example workflow a bit you can also put the "Resampler"-node after the image reader to reduce the size of the input image first

thanks hornm, helped a lot!