Sigma motion visual illusion in R

Michael Bach, who is a professor and vision scientist at the University of Freiburg, maintains a fascinating site about visual illusions. One visual illusion really surprised me: the sigma motion.

The sigma motion displays a flickering figure of black and white columns. Actually it is just a chart, as displayed below, with the columns changing backwards and forwards from black to white at a rate of about 30 transitions per second.

It can be a bit irritating to watch the movement, hence I use a button here to display and hide the animation.

Now, put your finger on the animated chart and move the finger to the left or right, so that you cover the chart in about 2 seconds and you will notice that the flickering stops and instead it appears that the columns move in the same direction as your finger! It works particular well on a touch screen device.

You find more information, details and another implementation on Michael’s page. Below is the little R script which produced the charts/GIFs used in this post.

R code to replicate plots

library(animation)
fps <- 30
nstripes <- 20
ani.options(interval=1/fps, ani.width=600, ani.height=100)

sm <- function(n=20, col=c("black", "white")){
x <- c(1:(2*n))
y <- 1
z <- matrix(rep(c(1,0),n), ncol=1)
image(x, y, z, col=col, bty="n",
xaxt="n", yaxt="n", xlab="", ylab="")
}

saveMovie({
op <- par(mar=c(0,0,0,0))
for(i in c(1:(2*fps))){
sm(nstripes, col=c("black","white"))
sm(nstripes, col=c("white","black"))
}
par(op)
})
## You will find the output here:
file.path(tempdir(), "animation.gif")

sessionInfo()
## R version 2.15.1 (2012-06-22)
## Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
##
## locale:
## [1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
##
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base
##
## other attached packages:
## [1] animation_2.1


Citation

Markus Gesmann (Aug 21, 2012) Sigma motion visual illusion in R. Retrieved from https://magesblog.com/post/2012-08-21-sigma-motion-visual-illusion-in-r/

BibTeX citation:

@misc{ 2012-sigma-motion-visual-illusion-in-r,
author = { Markus Gesmann },
title = { Sigma motion visual illusion in R },
url = { https://magesblog.com/post/2012-08-21-sigma-motion-visual-illusion-in-r/ },
year = { 2012 }
updated = { Aug 21, 2012 }
}