Posted by
Michael Schmid on
Feb 19, 2020; 2:15pm
URL: http://imagej.273.s1.nabble.com/differentiation-of-RGB-images-sorting-tp5022962p5022966.html
Hi Rainer,
one simple solution might be doing the statistics for each color (or
linear combinations of colors).
The macro command
setRGBWeights(redWeight, greenWeight, blueWeight)
is very handy for this; e.g.
setRGBWeights(1, 0, 0);
getStatistics(area, meanR);
setRGBWeights(0, 1, 0);
getStatistics(area, meanG);
setRGBWeights(0, 0, 1);
getStatistics(area, meanB);
print("average color values ", meanR, ",", meanG, ",", meanB);
setRGBWeights(0.299, 0.587, 0.114); //revert to defaults
Of course, you can also convert the RGB image to a Lab stack and do the
statistics there.
Michael
________________________________________________________________
On 19.02.20 13:29, Rainer M. Engel wrote:
> Hi,
>
> I have some macro code, where I need to sort images based on their
> colour as some kind of quick 'classification'. I though about analysing
> some similar coloured images to get a 'descriptor' in form of softened
> ranges of RGB or Lab, but maybe exactly this is already there and I
> simply don't know where to look, like before :))
>
> I tested the Color Inspector 3D, but this is more suited for
> visualization, although it provides some nice clustered representation.
>
> Any hint would be great.
>
> Kind regards,
> Rainer
>
>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html