skimage2.filters.threshold_isodata#
- skimage2.filters.threshold_isodata(image=None, nbins=256, return_all=False, *, hist=None)[source]#
Return threshold value(s) based on ISODATA method.
Histogram-based threshold, known as Ridler-Calvard method or inter-means. Threshold values returned satisfy the following equality:
threshold = (image[image <= threshold].mean() + image[image > threshold].mean()) / 2.0
That is, returned thresholds are intensities that separate the image into two groups of pixels, where the threshold intensity is midway between the mean intensities of these groups.
For integer images, the above equality holds to within one; for floating- point images, the equality holds to within the histogram bin-width.
Either image or hist must be provided. In case hist is given, the actual histogram of the image is ignored.
- Parameters:
- image(M, N[, âĶ]) ndarray
Grayscale input image.
- nbinsint, optional
Number of bins used to calculate histogram. This value is ignored for integer arrays.
- return_allbool, optional
If False (default), return only the lowest threshold that satisfies the above equality. If True, return all valid thresholds.
- histarray, or 2-tuple of arrays, optional
Histogram to determine the threshold from and a corresponding array of bin center intensities. Alternatively, only the histogram can be passed.
- Returns:
- thresholdfloat or int or array
Threshold value(s).
References
[1]Ridler, TW & Calvard, S (1978), âPicture thresholding using an iterative selection methodâ IEEE Transactions on Systems, Man and Cybernetics 8: 630-632, DOI:10.1109/TSMC.1978.4310039
[2]Sezgin M. and Sankur B. (2004) âSurvey over Image Thresholding Techniques and Quantitative Performance Evaluationâ Journal of Electronic Imaging, 13(1): 146-165, http://www.busim.ee.boun.edu.tr/~sankur/SankurFolder/Threshold_survey.pdf DOI:10.1117/1.1631315
[3]ImageJ AutoThresholder code, http://fiji.sc/wiki/index.php/Auto_Threshold
Examples
>>> from _skimage2.data import coins >>> image = coins() >>> thresh = threshold_isodata(image) >>> binary = image > thresh