資源簡介
基于迭代法的自動閾值分割代碼,用于matlab圖像處理技術。

代碼片段和文件信息
function?[Ibwthres]?=?autoThreshold(I)
%迭代法自動閾值分割
%
%輸入:I?-?要進行自動閾值分割的灰度圖像
%輸出:Ibw?-?分割后的二值圖像
%??????thres?-?自動分割的閾值
thres?=?0.5*(double(min(I(:)))?+?double(max(I(:))));?%?初始閾值
done?=?false;?%結束標志
while?~done
????g?=?I?>=thres;
????Tnext?=?0.5*(mean(I(g))?+?mean(I(~g)));
????done?=?abs(thres?-?Tnext)?0.5;
????thres?=?Tnext;
end;
Ibw?=?im2bw(Ithres/255);?%二值化
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????437??2018-10-28?17:46??autoThreshold.m
-----------?---------??----------?-----??----
??????????????????437????????????????????1
- 上一篇:Matlab仿真_高勇.caj
- 下一篇:matlab圖像銳化源代碼
評論
共有 條評論