Computes thresholds iteratively for image binarization
thr = iterthresh(x)
A matrix representing the gray scale image.
A scalar value representing the threshold value for biarizing the gray scale image.
It computes a threshold value for binarizing a gray scale image. The gray scale image matrix is taken as input and the threshold appropriate for binarization is given as output. First an arbitrary value is chosen as threshold value. This threshold value is iteratively modified until it remains unchanged.
x=imread('lena.png'); x=rgb2gray(x); x=double(x); th=iterthresh(x); // computing threshold iteratively y=x>=th; // Binarization imshow(y,[]) // Displaying binarized image y | ![]() | ![]() |