Filter löschen
Filter löschen

Coding for run length encoding....

5 Ansichten (letzte 30 Tage)
Loy Soo Ling
Loy Soo Ling am 19 Aug. 2013
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.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by