Dynamic chromostereopsis visual illusion

Dynamicchromostereopsisvisualillusion.gif

In response of Vitaliy’s MSE post for generating chromostereopsis visual illusion, I am Providing an updated version of code using more sophisticated transformation function. For different angle rot a bit different the animation is.

im = Rasterize[
  ImageApply[#*RandomChoice[{0, 1}] &, 
   Rasterize[
    Graphics[{Riffle[{Red, Black, Blue, Black, Red}, 
       Disk[{0, 0}, #] & /@ ({10, 7, 6, 4, 3}/10)]}, PlotRange -> 1.1,
      Background -> Black], RasterSize -> 240]], RasterSize -> 2*240]

rot = 2 Pi - Pi/4;

tr[r_] := 
 Evaluate[RotationMatrix[fi] . {-(Sin[(r - 1) rot]/(2 rot)), (
    1 - Cos[(r - 1) rot])/(2 rot)}]

Table[ImageForwardTransformation[im, # + tr[Norm[#]] &, 
   DataRange -> {{-1, 1}, {-1, 1}}], {fi, 0, 2 Pi - 2 Pi/30, 2 Pi/30}];

Export["C:\\ill.gif", %]

lDd2OK9F.gif

##Old version

This is very slow for resolution 480 x 480 pixels and 30 frames. Maybe someone knows how to take advantage of GPU to do the transformations.

Also the transformation function needs finer tuning by changing parameters to resemble the original better but as a start point it is good I think.

im = Rasterize[
  ImageApply[#*RandomChoice[{0, 1}] &, 
   Rasterize[
    Graphics[{Riffle[{Red, Black, Blue, Black, Red}, 
       Disk[{0, 0}, #] & /@ ({10, 7, 6, 4, 3}/10)]}, PlotRange -> 1.3,
      Background -> Black], RasterSize -> 240]], RasterSize -> 2*240]

Table[ImageForwardTransformation[
   im, ((f |-> # + 
         1/5 {Cos[fi + (Pi + Pi Cos[2 Pi Sqrt[2] f])/3], 
           Sin[fi + (Pi + Pi Cos[2 Pi Sqrt[2] f])/3]} (f + 0.1))@Sqrt[
      Total[(# - 1/2)^2]]) &], {fi, 0, 2 Pi - 2 Pi/30, 2 Pi/30}];

Export["C:\\ill.gif", %]

26nZNT9M.gif

Random dots free.

n = 0.25;
Manipulate[
 Graphics[{Point[{0, 0}], 
   Riffle[{Red, Black, Blue, Black, Red}, 
    Table[Disk[0.1 Sum[{Cos[a + q n Pi], Sin[a + q n Pi]}, {q, i}], 
      1 - i/6], {i, 5}]]}, PlotRange -> 1], {a, 0, 2 Pi}]

bZYCQBgU.gif

4 Likes

news-congrads-kkluyshnik-02-04-19.jpg – you have earned Featured Contributor Badge 2015-11-02_10-07-11.png
Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!