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 -- Rainer M. Engel, Dipl. Digital Artist -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
I have had success in classifying differences in colors by simply measuring the absolute distance (length of a vector in space) between the point of a measured color and the point of a reference color in a chosen color space (for example RGB). You may thus calculate an average RGB value of your image, and calculate the difference (color distance) between this and the value of your chosen reference image. You may do this for any type of color space (RGB, HSV, LAB etc). Color Inspector 3D is in this context extremely useful for providing a visual representation of how your colors is distributed in a given color space. Sorry for not providing any code example for this, as I do not have any general solution. But the idea might get you started with something.
Stein -----Original Message----- Sent: 19. februar 2020 13:30 To: [hidden email] Subject: differentiation of RGB images (sorting) 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 -- Rainer M. Engel, Dipl. Digital Artist -- ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&data=02%7C01%7Cstein.rorvik%40sintef.no%7C8f01b3de91064258259008d7b53e43f0%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C1%7C637177151341196064&sdata=YHUsfxGhHydavxMSaNrJ%2FFq2mr4c%2FZANVEyU1Q3kvk8%3D&reserved=0 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Rainer M. Engel
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 |
In reply to this post by Rainer M. Engel
Why not convert to HSB and build a function based on the hue &/or saturation channels, maybe first converting low brightness values to NaN?
Cheers- Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, NY 10016 Office: 646-501-0567 Cell: 914-309-3270 [hidden email] http://nyulmc.org/micros http://microscopynotes.com/ -----Original Message----- From: Rainer M. Engel <[hidden email]> Sent: Wednesday, February 19, 2020 7:30 AM To: [hidden email] Subject: differentiation of RGB images (sorting) [EXTERNAL] 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 -- Rainer M. Engel, Dipl. Digital Artist -- ImageJ mailing list: https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DwID-g&c=j5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs&r=E0xNnPAQpUbDiPlC50tp7rW2nBkvV7fujQf0RknE5bU&m=lA4Wvw6AsFG2FWVl-R3kNAZSLMMvrhOYdGkf4wNiXMw&s=dtCGlDknk7pHN0m1rLOGQTKJCUxCbeJTOgNcsKfyfAI&e= -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Rainer M. Engel
Thank you very much for your responses.
I'll follow the hints.. Kind regards, Rainer Am 19.02.2020 um 13:29 schrieb Rainer M. Engel: > 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 |
Free forum by Nabble | Edit this page |