How can I split in color classes, the pixels of an image that I load in Mathematica?
I would an output like this:
<Class1Name> 50%
<Class2Name> 30%
<Class3Name> 20%
The percentages refere to the amount of pixels of the image that are into that colour class.
The definition of the classes would be something like this: <Class1Name>
= All pixels that are into a RGB range of colours (for example from a dark green to a light green)
I have tried a code like this:
Image[{List@@@DominantColors[<imagefile>, n]}, ImageSize -> 300]
But I don't know how to split the output in classes. By encreasing the value of $n$ I will have a better precision right? I would love also a plot of the normal distribution of the pixels, where in the $x$ axis lie the names of the classes and on the $y$ axis a normalized scale that go from 0 to 1. So the plot should look similar to this:
If is possible I would execute the computation of all this on the GPU or on both the CPU and GPU togheter, I would like to chose between an OpenCL and CUDA version of the code and if is not possible I would have a code optimized to perform the computation on all cores an threads of my CPU.
P.S. I have used in the examples only three classes but actually I would like to choose the number of classes that I prefer every time that I run the code.