求图像信息熵,基于matlab.docVIP

  • 4
  • 0
  • 约小于1千字
  • 约 3页
  • 2020-05-05 发布于江西
  • 举报
图像的信息熵的程序 A=imread(C:\Users\dmin\Desktop\133194489.jpg); [M,N]=size(A); temp=zeros(1,256); for m=1:M; for n=1:N; if A(m,n)==0; i=1; else i=A(m,n); end temp(i)=temp(i)+1; end end temp=temp/(M*N); result=0; for i=1:length(temp) if temp(i)==0; result=result; else result=result-temp(i)*log2(temp(i)); end end result 运行MATLAB结果如下 result = 6.8645 黑白图片 A=imread(C:\Users\dmin\Desktop\t011168b065a19ba23d.jpg); [M,N]=size(A); temp=zeros(1,256); for m=1:M; for n=1:N; if A(m,n)==0; i=1; else i=A(m,n); end temp(i)=temp(i)+1; end end temp=temp/(M*N); result=0; for i=1:length(temp) if temp(i)==0; resul

文档评论(0)

1亿VIP精品文档

相关文档