Re: RGB to HSB question
Posted by Gabriel Landini on Jan 14, 2006; 11:13am
URL: http://imagej.273.s1.nabble.com/RGB-to-HSB-question-tp3704068p3704069.html
On Saturday 14 January 2006 04:24, Cheok Yan Cheng wrote:
> Recently, I try to find out the HSB histogram of an
> image using ImageJ.
> Since my java code had problem running
> HSB_Histogram.txt, where my java
> program cannot allocated Color_Histogram.jar although
> it had been installed
> at /home/yccheok/ImageJ/plugins.
I get this error with the updated ColorHistogram. The histogram seems to be
calculated, though.
java.lang.NoSuchMethodError: ColorHistogramWindow.getMean()[D
at ColorHistogram_.run(ColorHistogram_.java:72)
at ij.IJ.runFilterPlugIn(IJ.java:197)
at ij.IJ.runUserPlugIn(IJ.java:275)
at ij.IJ.runPlugIn(IJ.java:117)
at ij.Executer.runPlugIn(Executer.java:171)
at ij.Executer.runCommand(Executer.java:133)
at ij.Executer.run(Executer.java:63)
at java.lang.Thread.run(Thread.java:595)
By the way, trying the HSB_Histogram macro here I noted that the name of the
Histogram window does not include the ".tif" anymore (I do not know since
when) so the HSB_Histogram.txt macro needed some fixing. Here is the latest
version.
-----------------------8<-----------------------------
// Calculates the HSB histogram of an RGB image
// The RGB histograms correspond to the H, S and B components respectively
// Requires Color_Histogram plugin by Dimiter Prodanov
// 14/1/2006 fixed renaming of images
a=getTitle();
if (bitDepth()==24) {
run("HSB Stack");
run("Convert Stack to RGB");
run("Color Histogram");
b=getTitle();
selectWindow(a+" (RGB)");
run("Close");
selectWindow(a);
run("RGB Color");
c="title='HSB Histogram of "+a+"'";
selectWindow(b);
run("Rename...", c);
}
else{
showMessage(a +" is not an RGB image.");
}
-----------------------8<-----------------------------
Cheers,
Gabriel