Iterative threshold selection on an input gray-level image
Show older comments
Perform iterative threshold selection on an input gray-level image to include a variable that counts the number of iterations and an array that stores the values of T for each iteration.Please, this is what i have tried but i know i am wrong, somebody help me out.
I = imread('coins.png');
Id = im2double(I);
Imax = max(Id(:));
Imin = min(Id(:));
T = 0.5*(min(Id(:)) + max(Id(:)));
deltaT = 0.01;
done = false;
while ~done
g = Id >= T;
Tnext = 0.5*(mean(Id(g)) + mean(Id(~g)));
done = abs(T - Tnext) < deltaT;
T = Tnext;
end
imshow(g);
Accepted Answer
More Answers (0)
Categories
Find more on Images in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!