Manage Color Histogram value

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Manage Color Histogram value

sonemy
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Manage Color Histogram value

sonemy
Does anyone know how to fix it?
Reply | Threaded
Open this post in threaded view
|

Re: Manage Color Histogram value

sonemy
Hi.
I've imported the ij.jar in my project and i need to obtain color statistics about my image. Thus, i've imported Color_Histogram plug-in, but i'm not able to manage the RGB value and, above all, the statistics of each color chanel, such as red mean and mode.
Is it possible to intervene in the plug-in processing and get data? Or is there an alternative way to get the statistics and histograms of the RGB channels?

I apologize for my bad English.

Thank you all.

Laura
Reply | Threaded
Open this post in threaded view
|

Re: Manage Color Histogram value

Rasband, Wayne (NIH/NIMH) [E]
On Feb 18, 2011, at 2:38 PM, sonemy wrote:

> Hi.
> I've imported the ij.jar in my project and i need to obtain color statistics
> about my image. Thus, i've imported Color_Histogram plug-in, but i'm not
> able to manage the RGB value and, above all, the statistics of each color
> chanel, such as red mean and mode.
> Is it possible to intervene in the plug-in processing and get data? Or is
> there an alternative way to get the statistics and histograms of the RGB
> channels?

You can get RGB statistics and histograms by using the setWeightingFactors() and getStatistics() methods. Here is a JavaScript example:

 imp = IJ.getImage();
 if (imp.getBitDepth()!=24)
    IJ.error("RGB image required");
 ip = imp.getProcessor();
 ColorProcessor.setWeightingFactors(1,0,0);
 red = ip.getStatistics();
 ColorProcessor.setWeightingFactors(0,1,0);
 green = ip.getStatistics();
 ColorProcessor.setWeightingFactors(0,0,1);
 blue = ip.getStatistics();
 ColorProcessor.setWeightingFactors(1.0/3.0,1.0/3.0,1.0/3.0);
 IJ.log("Means: "+red.mean+", "+green.mean+", "+blue.mean);
 IJ.log("Modes: "+red.mode+", "+green.mode+", "+blue.mode);
 IJ.log("Histogram");
 for (i=0; i<256; i++)
    IJ.log("  "+i+": "+red.histogram[i]+", "+green.histogram[i]+", "+blue.histogram[i]);
Reply | Threaded
Open this post in threaded view
|

Re: Manage Color Histogram value

sonemy
Thank you very very much.

Greetings,
Laura.