Sigma motion visual illusion in R

1 comment

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

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="")  

  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"))
## You will find the output here:
file.path(tempdir(), "animation.gif")

## 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

1 comment :

GGY said...

Good demo! This phenomena, I believe, can be observed in viewing a merry go round.
At a distance, the movement of the animals going round and round, and up and down
at the same time makes for a difficult focus for the eye. But if you following the animals
with the eye in a certain way, the eye can then focus on each animal rendering a
graceful motion to the entire display.

Post a Comment