【发布时间】:2010-01-13 09:57:46
【问题描述】:
我正在尝试在 MATLAB 中实现以下 Minimum Error Thresholding(由 J. Kittler 和 J. Illingworth 编写)方法。
您可以查看 PDF:
我的代码是:
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
目标是提取字母的二进制图像(Hebrew Letters)。 我将代码应用于图像的子块(40 x 40)。 然而我得到的结果不如K-Means Clustering method。
我错过了什么吗? 谁有更好的主意?
谢谢。
附: 有人会在主题标签中添加“自适应阈值”吗(我不能,因为我是新手)。
【问题讨论】:
-
您不能保证通过自适应聚类获得更好的结果,您是否使用您的算法尝试过其他图像?
-
好吧,还有 3 个这样的。同样的结果,糟糕的结果。
标签: matlab image-processing adaptive-threshold