Group Abstract Group Abstract

Message Boards Message Boards

Dynamic chromostereopsis visual illusion

Posted 10 hours ago

Dynamic chromostereopsis visual illusion

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", %]

enter image description here

enter image description here

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", %]

enter image description here

enter image description here

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}]

enter image description here

POSTED BY: Azer Bajdzan

enter image description here -- you have earned Featured Contributor Badge enter image description here 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!

POSTED BY: EDITORIAL BOARD
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard