• Remix
  • Share
  • New Entry

  • ME

  • /
  • Popart pout - using canny edge detection

on 22 Nov 2023
  • 8
  • 19
  • 0
  • 0
  • 687
drawframe(1);
Write your drawframe function below
function drawframe(f)
persistent imCData
if(f==1) % Get image data for the pout sample image
I = imshow('pout.tif');
imCData = I.CData;
clf
end
s = size(imCData); % Get sixe of image for axis scaling
if(f<=8) % Show original image in grayscale
surf(1:s(1),1:s(2),imCData','LineStyle','none');
colormap(gray);
else
BW = edge(imCData,'canny'); % use canny edge detection
if(f<=16) % grayscale plot of edge detected image
surf(1:s(1),1:s(2),BW'*2,'LineStyle','none');
colormap(gray);
else % then show various different color schemes using a custom colormap
cmap = [1 .1 .9;.9 .8 .7;1 .4 .2;.9 .9 .7;.1 .7 .9;1 1 0;.95 .3 .3;.2 .3 .2];
if(f<=24)
surf(1:s(1),1:s(2),BW'*2,'LineStyle','none');
elseif(f<=32)
surf(1:s(1),1:s(2),4+BW'*2,'LineStyle','none');
elseif(f<=40)
surf(1:s(1),1:s(2),8+BW'*2,'LineStyle','none');
else
surf(1:s(1),1:s(2),12+BW'*2,'LineStyle','none');
end
colormap(cmap);
clim([0 14]);
end
end
% Set image properties
view([90 90]);
axis([1 s(1) 1 s(2)]);
set(gca,'Color','k','XTick',[],'YTick',[]);
set(gcf,'Color','k');
end
Animation
Remix Tree