--- Saving session to: ECE480.PH437_11-Feb-2002.txt --- Processed startup.m --- ; ; ; ; ; ; ; runim ans = Encoded result:\n enc = 0:14 1:3 0:4 1:3 0:1 1:1 0:1 1:2 0:2 1:1 0:2 1:1 0:7 ans = Compression ratio = 1.6:1 ans = Encoded result:\n enc = 0:7 1:4 0:1 1:12 0:15 1:1 0:2 ans = Compression ratio = 2.6:1 ans = Encoded result:\n enc = 0:0 1:3 0:3 1:5 0:31 ans = Compression ratio = 3.8:1 Error in ==> c:\personal\class\2001-02\winter\ece480\matlab\runim.m On line 38 ==> pause pred Waiting for keypress... Waiting for keypress... pred Waiting for keypress... Waiting for keypress... runim ans = Encoded result:\n enc = 0:14 1:3 0:4 1:3 0:1 1:1 0:1 1:2 0:2 1:1 0:2 1:1 0:7 ans = Compression ratio = 1.6:1 Error in ==> c:\personal\class\2001-02\winter\ece480\matlab\runim.m On line 16 ==> pause type runim % EE437 Intro to Image Processing, S96 % Day 25: Run-length encoding % % use runim.m to specify the images % Image data f = [0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 1 1 1 0; 0 0 0 1 1 1; 0 1 0 1 1 0; 0 1 0 0 1 0; 0 0 0 0 0 0]; runi pause f = [0 0 0 0 0 0; 0 1 1 1 1 0; 1 1 1 1 1 1; 1 1 1 1 1 1; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 1 0 0]; runi pause f = [1 1 1 0 0 0; 1 1 1 1 1 0; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0; 0 0 0 0 0 0]; runi pause f=double(imread('f0.png')); f = round(f/256); runi type runi % EE437 Intro to Image Processing, S96 % Day 25: Run-length encoding % % use runim.m to specify the images % Image dimensions m=size(f,1); n=size(f,2); % Display the image imshow(f,2,'n') % Place grid lines on the image for r=1:m, line([0 n+0.5],[r+0.5 r+0.5]) end for c=1:n, line([c+0.5 c+0.5],[0 m+0.5]) end drawnow % Generate the run-length encoded data cnt=0; cval=0; enc=[]; enc2=[]; for r=1:m, for c=1:n, %sprintf('%d %d\n',cval,cnt) if f(r,c)==cval cnt=cnt+1; else enc=[enc sprintf('%d:%d\n',cval,cnt)]; enc2=[enc2 sprintf('%d\n',cnt)]; cval= ~cval; cnt=1; end end end enc=[enc sprintf('%d:%d\n',cval,cnt)]; enc2=[enc2 sprintf('%d\n',cnt)]; % Display the encoded data result 'Encoded result:\n' enc % Display the compression ratio sprintf('Compression ratio = %3.1f:1', size(f(:))/size(enc2(:))) exit