Posted by
Martin du Saire on
Apr 04, 2006; 6:26pm
URL: http://imagej.273.s1.nabble.com/Color-Image-Segmentation-tp3703193p3703194.html
Anneliese,
If you already have some predefined (R, G, B) values that represent
each of your 256 colors, I'm not sure how you would go about
that. Otherwise, you might want to convert the RGB to HSV and use
the 256 Hue values 0-50, 51-120, etc. as a proxy for "colors". The
gist of the macro would look something like this:
setThreshold(0, 50);
run("Threshold", "thresholded remaining black");
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00
show=Nothing clear record");
totalArea = 0;
for (k = 0; k < nResults; k++)
totalArea = totalArea + getResult('Area', k);
print("Total area for colors 0-50: "+totalArea);
setThreshold(51, 120);
run("Threshold", "thresholded remaining black");
run("Analyze Particles...", "size=0-Infinity circularity=0.00-1.00
show=Nothing clear record");
totalArea = 0;
for (k = 0; k < nResults; k++)
totalArea = totalArea + getResult('Area', k);
print("Total area for colors 51-120: "+totalArea);
etc...
Of course, you could do this in a loop...
M
At 10:26 AM 4/3/2006, you wrote:
>Dear users,
>
>I would like to open an RGB image with 255 colors. I would like to
>segment the image e.g. like this 0-50 (1st color) 51-120 (2nd
>color), 121-190 (3rd color) 191-255 (4th color).
>
>Now I would like to define the complete image as 100 % and find out
>which percentage each of the segmented areas has. And I would like
>to get a histogram for each segmented area.
>
>Does anybody have a plug-in for this kind of segmentation?
>
>Anneliese