Add Triangle thresholding algorithm

Add Triangle method for automatic threshold computation next to the existing
Otsu's method. Triangle deals better with images whose histogram does not
contain dominant peak.

See paper Zack GW, Rogers WE, Latt SA.: Automatic measurement of sister
chromatid exchange frequency. J Histochem Cytochem. 1977 Jul;25(7):741-53.
This commit is contained in:
Miroslav Benes
2014-10-22 16:54:39 +02:00
parent 322593e89f
commit 5b1fd739d9
5 changed files with 122 additions and 7 deletions

View File

@@ -109,7 +109,8 @@ enum { THRESH_BINARY = 0, // value = value > threshold ? max_value : 0
THRESH_TOZERO = 3, // value = value > threshold ? value : 0
THRESH_TOZERO_INV = 4, // value = value > threshold ? 0 : value
THRESH_MASK = 7,
THRESH_OTSU = 8 // use Otsu algorithm to choose the optimal threshold value
THRESH_OTSU = 8, // use Otsu algorithm to choose the optimal threshold value
THRESH_TRIANGLE = 16 // use Triangle algorithm to choose the optimal threshold value
};
//! adaptive threshold algorithm