Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
1  
Take a look at ImageTransformation; –  Kuba Jun 4 at 9:56
    
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. –  Pickett Jun 4 at 10:12
    
The link should be this: countyourculture.com/2011/03/19/breathing-wall-visualization –  Taiki Jun 4 at 14:15

2 Answers 2

up vote 5 down vote accepted

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["http://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.

share|improve this answer
    
Cool.. With ImageResize the effect get more fluid: img = ImageResize[Import["http://i.stack.imgur.com/XMwRi.jpg"], 400] –  Murta Jun 4 at 16:28
img = Import["http://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

Note: cannot upload the updated gif animation with Neutral lighting for the time being.

share|improve this answer
    
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. –  Oleksandr R. Jun 7 at 0:24
    
@OleksandrR. thank you - excellent point. –  kguler Jun 7 at 0:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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