📄 ksw.asv
字号:
function y=ksw(t,mingrayvalue,maxgrayvalue,hist1,HT)
%计算最佳直方图熵(KSW熵)
Pt=0;
for i=mingrayvalue:t
Pt=Pt+hist1(i+1);
end
Ht=0;
for i=mingrayvalue:t
if hist1(i+1)==0
temp=0;
else
temp=-hist1(i+1)*log(hist1(i+1));
end
Ht=Ht+temp;
end
if Pt==0 | Pt==1 % or(Pt==0,Pt==1)
H=0;
else
H=log(Pt*(1-Pt))+Ht/Pt+(HT-Ht)/(1-Pt);
end
y=H;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -