Pages

RSymmetry

I have always loved symmetry in photography. The picture above was created in Photoshop simply by coping and rotating certain parts. See SchlockySymmetry for other symmetrical photos. Recently, I stumbled upon an article in R-bloggers that used abind and biOps for some simple image manipulation. I thought it would be fun to perform some of the tricks mentioned in the article to achieve the picture above.

R Code:

#Image processing

#Read Original Image
x <- readJpeg("Boudha.jpg")

plot(x)
dev.copy(png,filename="original.png",width=2048,height=1206);
dev.off ();

#copy pixels from left to right and mirror
y <- imagedata(abind(x[,1:(ncol(x)/2),], x[,(ncol(x)/2):1,] , along=2))

plot(y)
dev.copy(png,filename="halfmirror.png",width=2048,height=1206);
dev.off ();

#copy all pixels and mirror rows
z <- imagedata(abind(y[1:(nrow(x)),,], y[(nrow(x)):1,,] , along=1))

plot(z)
dev.copy(png,filename="final.png",width=2048,height=1206);
dev.off ();

Result

original.png
halfmirror.png
final.png

Ayush Subedi

Coffee Connoisseur