Recently, when I try out the auto-threshold function
in ImageJ, I found that two following two methods produce completely different result: (A) Process->Binary->Threshold (B) Image->Adjust->ThresholdÂ… After some reading into the ImageJ source code (ij134s), I found that the (B) operation did some modification on the original image histogram before proceeding to auto threshold based on histogram. In ij\plugin\frame\ThresholdAdjuster, method ImageStatistics setHistogram(ImagePlus imp), it does modify the histogram with the following code: for (int i = 0; i < stats.nBins; i++) if ((histogram[i] > maxCount2) && (i != stats.mode)) maxCount2 = histogram[i]; hmax = stats.maxCount; if ((hmax>(maxCount2 * 2)) && (maxCount2 != 0)) { hmax = (int)(maxCount2 * 1.5); histogram[stats.mode] = hmax; } It seems that if the largest histogram is much greater (2x) than the 2nd largest histogram, the largest histogram will be reduced to 1.5x of the 2nd largest histogram. May I know what is the reasons behind for doing so? Is there any more information on this? Yccheok P/s For my case, my image get much better result through (B) __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
On Monday 24 April 2006 03:56, Cheok Yan Cheng wrote:
> Recently, when I try out the auto-threshold function > in ImageJ, I found that two following two methods > produce completely different result: > > (A) Process->Binary->Threshold > (B) Image->Adjust->ThresholdÂ… They are 2 different things. > It seems that if the largest histogram is much greater > (2x) than the 2nd largest histogram, the largest > histogram will be reduced to 1.5x of the 2nd largest > histogram. > > May I know what is the reasons behind for doing so? Is > there any more information on this? I believe that this is for display purposes (so one does not get a very large peak in the image histogram). > P/s For my case, my image get much better result > through (B) I don't think so. Method A is to *adjust* the threshold value. Method B converts the image into a binary image according to the *current* value set (either manually or automatically using method A). I hope it helps. G. |
Gabriel writes ... > On Monday 24 April 2006 03:56, Cheok Yan Cheng wrote: > > Recently, when I try out the auto-threshold function in ImageJ, I > > found that two following two methods produce completely different > > result: > > > > (A) Process->Binary->Threshold > > (B) Image->Adjust->Threshold. > > They are 2 different things. I believe you are correct, however, the mystery remains. Why are there 2 methods? Genuinely, Michael Shaffer :o) SEM/MLA Research Coordinator (709) 737-6799 (ofc) (709) 737-6790 (lab) (709) 737-6193 (FAX) http://www.mun.ca/creait/maf/ http://www.esd.mun.ca/epma/ Inco Innovation Centre c/o Memorial University 230 Elizabeth Avenue P.O. Box 4200 St. John's, NL A1C 5S7 > > It seems that if the largest histogram is much greater > > (2x) than the 2nd largest histogram, the largest histogram will be > > reduced to 1.5x of the 2nd largest histogram. > > > > May I know what is the reasons behind for doing so? Is > there any more > > information on this? > > I believe that this is for display purposes (so one does not > get a very large peak in the image histogram). > > > P/s For my case, my image get much better result through (B) > > I don't think so. Method A is to *adjust* the threshold > value. Method B converts the image into a binary image > according to the *current* value set (either manually or > automatically using method A). > > I hope it helps. > G. > > __________ NOD32 1.1503 (20060423) Information __________ > > This message was checked by NOD32 antivirus system. > http://www.eset.com > > |
On Monday 24 April 2006 10:47, michael shaffer wrote:
> I believe you are correct, however, the mystery remains. Why are there 2 > methods? No mystery, *Adjusting* the threshold (does not change the image) and *applying the current threshold value* to make a binary image are different things. You can adjust without applying. G. |
In reply to this post by yccheok
The Image->Adjust->Threshold tool modifies the histogram so that
largest count is no larger than 1.5x the next largest count. It does this to increase the y scale in the histogram plot for images with a large number of pixels with the same value. The fact that this modified histogram is used for auto-thresholding is a bug. -wayne On Apr 23, 2006, at 10:56 PM, Cheok Yan Cheng wrote: > Recently, when I try out the auto-threshold function > in ImageJ, I found that two following two methods > produce completely different result: > > (A) Process->Binary->Threshold > > (B) Image->Adjust->Threshold… > > After some reading into the ImageJ source code > (ij134s), I found that the (B) operation did some > modification on the original image histogram before > proceeding to auto threshold based on histogram. > > In ij\plugin\frame\ThresholdAdjuster, method > ImageStatistics setHistogram(ImagePlus imp), it does > modify the histogram with the following code: > > for (int i = 0; i < stats.nBins; i++) > if ((histogram[i] > maxCount2) && (i != > stats.mode)) > maxCount2 = histogram[i]; > hmax = stats.maxCount; > if ((hmax>(maxCount2 * 2)) && (maxCount2 != 0)) { > hmax = (int)(maxCount2 * 1.5); > histogram[stats.mode] = hmax; > } > > It seems that if the largest histogram is much greater > (2x) than the 2nd largest histogram, the largest > histogram will be reduced to 1.5x of the 2nd largest > histogram. > > May I know what is the reasons behind for doing so? Is > there any more information on this? > > Yccheok > > P/s For my case, my image get much better result > through (B) > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > |
In reply to this post by yccheok
Hi wayne,
Thank you very much for your feedback. I was first thought this is a completely new auto threshold algorithm :P cheok __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
Free forum by Nabble | Edit this page |