6
$\begingroup$

I would like to recreate the effect of the one in this video: Breathing walls

enter image description here

This is my first time manipulating images, and because of that, I don't even have a clue where to start.

But I think the way to do this must be transforming the geometry of the image with sine waves, correct me if I'm wrong.

$\endgroup$
3
  • 1
    $\begingroup$ Take a look at ImageTransformation; $\endgroup$
    – Kuba
    Jun 4, 2014 at 9:56
  • $\begingroup$ The author of those videos wrote about it on his blog, although not with the details required to implement the thing it has a good source that might help someone: here. $\endgroup$
    – C. E.
    Jun 4, 2014 at 10:12
  • $\begingroup$ The link should be this: countyourculture.com/2011/03/19/breathing-wall-visualization $\endgroup$
    – Taiki
    Jun 4, 2014 at 14:15

2 Answers 2

7
$\begingroup$

Here's a way of implementing sinusoidal undulations, updated to write out an animated gif, and to use a smaller image, as suggested by Murta.

img = ImageTake[Import["https://i.stack.imgur.com/XMwRi.jpg"], {200, 500}, {200, 600}];
Export["breathing.gif", 
 Table[ImageTransformation[img, # + {.004 Sin[4 #[[1]] + p], .005 Sin[5 #[[1]] + p]} &, 
   Padding -> Black], {p, 0, 2 Pi, 0.3}], "DisplayDurations" -> 0.3]

You can make the animation smoother by replacing 0.3 with 0.1 or smaller and the DisplayDurations 0.3 to 0.1.

$\endgroup$
1
  • $\begingroup$ Cool.. With ImageResize the effect get more fluid: img = ImageResize[Import["http://i.stack.imgur.com/XMwRi.jpg"], 400] $\endgroup$
    – Murta
    Jun 4, 2014 at 16:28
13
$\begingroup$
img = Import["https://i.stack.imgur.com/8Pgul.gif"];
image = img[[3]];

gr = Graphics[{EdgeForm[Directive[Thickness[.1], Black]],
FaceForm[Opacity[0]], Rectangle[{0.1, 0.1}, {.9, .9}]}, ImageSize -> 400];

Animate[
   Overlay[{
            ParametricPlot3D[{x , y , 1 + .2 ( Cos[ t y + (1 - t) x] )}, 
             {x, -Pi, Pi}, {y, -Pi, Pi},
             Mesh -> False, PerformanceGoal -> "Quality", Boxed -> False, 
             Axes -> False, ImageSize -> 400, 
             Lighting-> "Neutral", (*thanks: Olexandr R. *)
             PlotStyle -> Texture[image], ViewPoint -> Top], gr}, 
      Alignment -> Center], 
 {t, 0, 1}, AnimationRunning -> False, AnimationRate -> .5]

enter image description here

$\endgroup$
2
  • $\begingroup$ Needs Lighting -> "Neutral". Otherwise it's the breathing, oddly pinkish, color changing wall. But a definite +1 for a simple and effective approach to producing the undulations. $\endgroup$ Jun 7, 2014 at 0:24
  • $\begingroup$ @OleksandrR. thank you - excellent point. $\endgroup$
    – kglr
    Jun 7, 2014 at 0:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.