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