Group Abstract Group Abstract

Message Boards Message Boards

Image distortion with conformal maps

Posted 10 years ago

After making experiments with polar coordinate transformations in the context of my art (e.g. here)

enter image description here

I searched for a more general and diverse approach which lead me to the possibility to distort images with conformal maps (complex analysis) (e.g. six functions implemented within the program SeamlessMaker). But I want to explore a wide range of functions and I need programming ability for batch processing. Therefore my question if someone has experience with this kind of image distortion in Mathematica? Is there a demo, tutorial, article, ...? Thank you very much for your help!!

I think you might find useful ImageTransformation and ImageForwardTransformation. I will crosspost here an answer from: How do I put an image on the complex plane? by J.M..

ImageForwardTransformation[] is the function you want here. To give a concrete example, here's how an image might be transformed by the complex mapping $w=z^3$:

img = ExampleData[{"TestImage", "Mandrill"}];
imgc = ImageForwardTransformation[img, Through[{Re, Im}[(#[[1]] + I #[[2]])^3]] &,
                         Background -> 1,
                         DataRange -> {{-1, 1}, {-1, 1}}, PlotRange -> {{-2, 2}, {-2, 2}}]

cubed mandrill

To see the correspondence with the more usual complex mapping, we show the transformed image along with a suitably transformed Cartesian grid:

ParametricPlot[{Re[(x + I y)^3], Im[(x + I y)^3]}, {x, -1, 1}, {y, -1, 1},
               PlotStyle -> FaceForm[None], Prolog -> {Texture[imgc],
               Polygon[Scaled /@ {{0, 0}, {1, 0}, {1, 1}, {0, 1}},
                       VertexTextureCoordinates -> {{0, 0}, {1, 0}, {1, 1}, {0, 1}}]}]

cubed mandrill with grid


As an example of a nontrivial complex mapping, here is the conformal mapping of a square region to a disk:

img = ExampleData[{"TestImage", "Mandrill"}];
imgc = With[{? = N[1/2 EllipticK[1/2], 25]},
            ImageForwardTransformation[img, 
                         With[{z = ? (#[[1]] + I #[[2]])},
                              Through[{Re, Im}[JacobiSC[z, 1/2] JacobiDN[z, 1/2]]]] &, 
                         Background -> 1, DataRange -> {{-1, 1}, {-1, 1}}, 
                         PlotRange -> {{-1, 1}, {-1, 1}}]]

mandrill on a disk

Another nontrivial example of a complex mapping (the quincuncial projection) is demonstrated in this answer (though the procedure given there uses ImageTransformation[] instead).

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