Testing some code
for stippling images
Here is the code, if you want to have some fun!
clear all IBW= imread ("stippling_input.jpg"); [n m]=size(IBW); figure(1) clf imshow(IBW) print -dpng "-S 496,466" "plant.png" mIBW=mean(mean(IBW)) sIBW=sqrt(mean(mean((mIBW-IBW).^2))) nplot=15000; ############################################################ k=0; while (k<=nplot) xi=n*rand+1; yi=m*rand+1; i=floor(xi); j=floor(yi); rx=rand; if (floor((rx+rx^2+rx^3+rx^4+rx^10)*255/5)>=IBW(i,j)) k=k+1; x(k)=xi/n; y(k)=yi/n; end end figure(2) clf plot(y(1:nplot),1-x(1:nplot),'k.',"markersize", 2) axis([0 1 0 m/n]) axis off title("Geometric") print -dpng "-S 496,466" "plant_r.png" ############################################################ clear x clear y k=0; while (k<=nplot) xi=n*rand+1; yi=m*rand+1; i=floor(xi); j=floor(yi); # randx=abs(random("normal", mIBW, sIBW)); if (floor(brand*255)>IBW(i,j)) k=k+1; x(k)=xi/n; y(k)=yi/n; end end figure(3) clf plot(y(1:nplot),1-x(1:nplot),'k.',"markersize", 2) axis([0 1 0 m/n]) axis off title("Blue Noise") print -dpng "-S 496,466" "plant_blue.png" ############################################################ ############################################################ clear x clear y k=0; while (k<=nplot) xi=n*rand+1; yi=m*rand+1; i=floor(xi); j=floor(yi); if (floor(rand*255)>=IBW(i,j)) k=k+1; x(k)=xi/n; y(k)=yi/n; end end k figure(4) clf plot(y(1:nplot),1-x(1:nplot),'k.',"markersize", 2) axis([0 1 0 m/n]) axis off title("Uniform") print -dpng "-S 496,466" "plant_rand.png" ############################################################Palavras chave/keywords: image, octave, stippling image
Criado/Created: 20-02-2015 [14:11]
Última actualização/Last updated: 10-10-2022 [14:26]
(c) Tiago Charters de Azevedo