Thursday, December 12, 2019

"Knitting" Drawing


IMGGR[file_,n_,d_,emb_,s_]:=Module[{img,gr,imgr,imgtb},
img=ImageResize[Import[StringJoin["https://olgabelitskaya.github.io/",file]],{s,s}];
gr=RemoveAlphaChannel[Image[GraphPlot[KnightTourGraph[n,d],
VertexSize->0,GraphLayout->emb]]];
imgr=ImageResize[ImageAdjust[ColorConvert[gr,"Grayscale"]],{s,s}];
imgtb=Table[Table[ImageData[imgr][[j,i]]*ImageData[img][[j,i,1;;3]],{i,s}],{j,s}];
Image[imgtb,ColorSpace->"RGB",ImageSize->s]];
IMGGR["flower5.jpeg",18,18,"SpringElectricalEmbedding",290]

 IMGGR2[file_,n_,d_,emb_,s_]:=Module[{img,gr,imgr,imgtb},
img=ImageResize[Import[StringJoin["https://olgabelitskaya.github.io/",file]],{s,s}];
gr=RemoveAlphaChannel[Image[GraphPlot[
RandomGraph[BernoulliGraphDistribution[n,d],
VertexSize->0,GraphLayout->emb]]]];
imgr=ImageResize[ImageAdjust[ColorConvert[gr,"Grayscale"]],{s,s}];
imgtb=Table[Table[ImageData[imgr][[j,i]]*ImageData[img][[j,i,1;;3]],{i,s}],{j,s}];
Image[imgtb,ColorSpace->"RGB",ImageSize->s]];
IMGGR2["flower5.jpeg",100,.09,"StarEmbedding",290]

 IMGGR3[file_,n_,emb_,s_]:=Module[{img,gr,imgr,imgtb},
img=ImageResize[Import[StringJoin["https://olgabelitskaya.github.io/",file]],{s,s}];
gr=RemoveAlphaChannel[Image[GraphPlot[CompleteGraph[n],
VertexSize->0,GraphLayout->emb]]];
imgr=ImageResize[ImageAdjust[ColorConvert[gr,"Grayscale"]],{s,s}];
imgtb=Table[Table[ImageData[imgr][[j,i]]*ImageData[img][[j,i,1;;3]],{i,s}],{j,s}];
Image[imgtb,ColorSpace->"RGB",ImageSize->s]];
IMGGR3["flower5.jpeg",20,"BalloonEmbedding",290]

No comments:

Post a Comment