资源简介
还可以,自己写的关于霍夫曼编码的MATLAB程序设计
代码片段和文件信息
clear
f0=imread(‘football.jpg‘);
subplot(121)
imshow(uint8(f0));
xlabel(‘\fontsize{16}原始图像‘);
f=abs(f0/4)-10;
[MN]=size(f);
p=zeros(161);
for t=1:61
count=0;
for i=1:M
for j=1:N
if f(ij)==t-1
count=count+1;
end
end
end
p(t)=count;p0=p;
end
core=cell(611);
sign=zeros(61);
for hh=1:60
re=M*N;
for t=1:61
if (p(t)0)
re=p(t);
end
end
t=1;
while (p(t)~=re)&(t<61)
t=t+1;
end
if sign(t1)==0
core{t}=‘0‘;
else
core{t}=[‘0‘core{t}];
i=1;
while (sign(ti)~=0)&(i<61)
core{sign(ti)}=[‘0‘core{sign(ti)}];
i=i+1;
end
end
p(t)=0;
cou=t;
re1=M*N;
for t=1:61
if (p(t)0)
re1=p(t);
end
end
t=1;
while (p(t)~=re1)&(t<61)
t=t+1;
end
if sign(t1)==0
core{t}=‘1‘;
else
core{t}=[‘1‘core{t}];
i=1;
while (sign(ti)~=0)&(i<61)
core{sign(ti)}=[‘1‘core{sign(ti)}];
i=
评论
共有 条评论