Borrar filtros
Borrar filtros

Coding for run length encoding....

5 visualizaciones (últimos 30 días)
Loy Soo Ling
Loy Soo Ling el 19 de Ag. de 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.

Respuestas (0)

Categorías

Más información sobre Image Segmentation and Analysis en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by