資源簡介
基于圖像的預處理,對圖像進行局部的二值圖像,有較好的適用性

代碼片段和文件信息
function?bw=adaptivethreshold(IMwsCtm)
if?(nargin<3)
????error(‘You?must?provide?the?image?IM?the?window?size?ws?and?C.‘);
elseif?(nargin==3)
????tm=0;
elseif?(tm~=0?&&?tm~=1)
????error(‘tm?must?be?0?or?1.‘);
end
IM=mat2gray(IM);
if?tm==0
????mIM=imfilter(IMfspecial(‘average‘ws)‘replicate‘);
else
????mIM=medfilt2(IM[ws?ws]);
end
sIM=mIM-IM-C;
bw=im2bw(sIM0);
bw=imcomplement(bw);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????413??2008-10-13?15:52??adaptivethreshold.m
評論
共有 條評論