Code covered by the BSD License  

Highlights from
Gray image thresholding using the Triangle Method

4.25

4.2 | 5 ratings Rate this file 39 Downloads (last 30 days) File Size: 2.8 KB File ID: #28047

Gray image thresholding using the Triangle Method

by

 

28 Jun 2010 (Updated )

Computes a threshold the Triangle method.

| Watch this File

File Information
Description

The Triangle method is due to Zack (Zack GW, Rogers WE, Latt SA (1977), "Automatic measurement of sister chromatid exchange frequency", J. Histochem. Cytochem. 25 (7): 741–53.

 A line is constructed between the maximum of the histogram at b on the gray level axis and the lowest (or highest depending on context) value a on the gray level axis where the histogram is significantly larger than 0. The distance L normal to the line and between the line and the histogram is computed for all values from a to b. The level where the distance between the histogram and the line is maximal is the threshold value (level). This technique is particularly effective when the object pixels produce a weak peak in the histogram.

Acknowledgements

This file inspired Analysis Of Platelet Aggregate Morphology Using 2 D Autocorrelation.

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (7)
30 Sep 2013 Bernard Panneton

There are a couple of assumptions that can change the end result. One is that the histogram has one tail longer than the other and that the threshold has to be on the long tail side. The other is the definition of the end point of a histogram tail. In the code, this is set to 10000 (i.e. tails end when there are less than 10000 pixels in the corresponding histogram bin). Depending on the size of the image, this might not be an optimum choice.

29 Sep 2013 Ramzan Basheer  
19 Apr 2013 Jan Motl

It's giving different threshold than triangle method in ImageJ applied to the same image.

14 Apr 2013 Jan Motl  
06 Oct 2010 Image Analyst

Including a screenshot of a bar chart of a histogram with a vertical red bar where the histogram gets thresholded would be helpful for people to understand what they'd be downloading.

22 Jul 2010 ula?  
09 Jul 2010 Image Analyst

This is a very useful and practical way to do thresholding. It may not be based on any theory, but in practice it's one of the best methods for thresholding a skewed histogram.

One way to improve this submission would be to include a little demo program to call it that would read in a standard MATLAB demo image (such as the cameraman), display it and its histogram, draw a line on the histogram where the threshold level is calculated, and then finally display the binarized image. I had to write all this myself.

Updates
12 Jul 2010

A demo file was included.

Contact us