Coding for run length encoding....

5 次查看(过去 30 天)
Loy Soo Ling
Loy Soo Ling 2013-8-19
I am currently doing the image compression by using run length method. So far I had done the part of encoding. However, I am now facing the problem of doing the part of decoding. Is there any way that can be done to do for decoding the compressed image? Below is my encoding coding for run length compression.
function Output=rle2(y)
x=imread('nc_linggi.tif');
y=x(:,:,2);
L=length(y);
j=1;
k=1;
i=1;
while i<2*L
comp=1;
for j=j:L
if j==L
break
end;
if y(j)==y(j+1)
comp=comp+1;
else
break
end;
end;
Output(k+1)=comp;
Output(k)=y(j);
if j==L && y(j-1)==y(j)
break
end;
i=i+1;
k=k+2;
j=j+1;
if j==L
if mod(L,2)==0
Output(k+1)=1;
Output(k)=y(j);
else
Output(k+1)=1;
Output(k)=y(j);
end;
break
end;
end;
Thanks.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Segmentation and Analysis 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by