Login  Register

Re: Progamatically using the histogram plugin

Posted by karl wettin-4-3 on May 27, 2009; 4:08pm
URL: http://imagej.273.s1.nabble.com/Progamatically-using-the-histogram-plugin-tp3692404p3692406.html

27 maj 2009 kl. 16.08 skrev Wayne Rasband:

> On May 27, 2009, at 5:14 AM, Karl Wettin wrote:
>>
>> I want to use the histogram plugin to do some simple automated  
>> computer vision thingies, but I can't figure out how to load an  
>> image and pass it down to the plugin from my code.
>
> Use the getStatistics() method of the ImagePlus class to get the  
> histogram.
>
>    ImagePlus imp = IJ.openImage(path);
>    int[] histogram = imp.getStatistics().histogram;

Excellent, thanks!

This works really well. I'm using the histogram to classify real  
estate images as photos or blueprints with the Weka IBk (k=2) and I  
get 100% certainty with 2000 images as ground truth and testing on  
10000 images. (Not sure what to use it for, but it's really cool. ;)


         karl