I'm trying to implement the following method in Matlab: Minimum Error Thresholding - By J. Kittler and J. Illingworth
You may have a look at the PDF:
- http://liama.ia.ac.cn/wiki/_media/projects:pal:kittler1986.pdf?id=projects%3Apal%3Areadinggroup&cache=cache
- http://docs.google.com/viewer?a=v&q=cache:XBuTPelQ3pMJ:www.ee.umanitoba.ca/~thomas/cp/Minimum%2520Error%2520Thresholding.pdf+J.+Kittler+and+J.+Illingworth,+%E2%80%98%E2%80%98Minimum+error+thresholding,%E2%80%99%E2%80%99&hl=en&pid=bl&srcid=ADGEESiXO4bpSsGomAjurUJLSzpmCyuCVxd-WnqMsKppKIMkvETt2xW6SowFxslmntlybz-z_YAea0oaCzVfBdkqiJczfVt3ll8hTDDkMg80xaO6vwl5yCLZg5b-FoWWl0gqfaYr81Bh&sig=AHIEtbQUj2nniDzc0Yj1dbBJ1mty5foZog (At the end).
My code is:
function [ Level ] = MET( IMG )
%Maximum Error Thresholding By Kittler
% Finding the Min of a cost function J in any possible thresholding. The
% function output is the Optimal Thresholding.
for t = 0:255 % Assuming 8 bit image
I1 = IMG;
I1 = I1(I1 <= t);
q1 = sum(hist(I1, 256));
I2 = IMG;
I2 = I2(I2 > t);
q2 = sum(hist(I2, 256));
% J is proportional to the Overlapping Area of the 2 assumed Gaussians
J(t + 1) = 1 + 2 * (q1 * log(std(I1, 1)) + q2 * log(std(I2, 1)))...
-2 * (q1 * log(q1) + q2 * log(q2));
end
[~, Level] = min(J);
%Level = (IMG <= Level);
end
I've tried it on the following image:
The target is to extract a binary image of the letters (Hebrew Letters). I applied the code on sub blocks of the image (40 x 40). Yet I got results which are inferior to K-Means Clusters method.
Did I miss something? Anyone has a better idea?
Thanks.
P.S. Would anyone add "Adaptive-Thresholding" to the subject tags (I can't as I'm new).