資源簡介
自己寫的經典算法OTSU算法進行二值化處理,并顯示了圖像直方圖。
代碼片段和文件信息
close?all
clear?all
clc
I=imread(‘D:\Program?Files\MATLAB\R2011a\toolbox\images\imdemos\cameraman.tif‘);
figure(1)imshow(I);
figure(2)imhist(I);
n=imhist(I);
N=sum(n);
max=0;
for?i=1:256
????P(i)=n(i)/N;
end
for?T=2:255
????w0=sum(P(1:T
評論
共有 條評論