Re: distorting an image

• To: mathgroup at smc.vnet.net
• Subject: [mg105384] Re: [mg105324] distorting an image
• From: Patrick Scheibe <pscheibe at trm.uni-leipzig.de>
• Date: Mon, 30 Nov 2009 06:12:18 -0500 (EST)
• References: <200911280605.BAA01372@smc.vnet.net>

```Hi,

maybe it's better to use the inverse map which means you have a
function, say f(u,v) which tells you for every position (u,v) in your
resulting image where this point came from in your original image.

For this you only need to interpolate your image to have pixel-data even
on non-grid positions. Doing this completely in Mathematica is too slow
for the most applications but nevertheless you can do it:

img = Import["http://sipi.usc.edu/database/misc/5.1.12.tiff";]

xrange = 1.5; yrange = 1.5;
ip = ListInterpolation[
ImageData[img], {{-yrange, yrange}, {-xrange, xrange}}];
imgf[{x_, y_}] :=
If[-xrange <= x <= xrange && -yrange <= y <= yrange,
ip[y, x], 0];

Image[Table[
With[{z = ArcSin[x + I y]},
imgf[{Re[z], Im[z]}]], {y, -yrange, yrange, 0.01}, {x, -xrange,
xrange, 0.01}]]

Cheers
Patrick

On Sat, 2009-11-28 at 01:05 -0500, Leon Gunther wrote:
> I want to take an image and map each point (x,y) to another point u(x,y) and v(x,y) so as to produce a distorted image.
> It would be analogous to painting a piece of rubber and distorting  the rubber.
>
> My ultimate goal is to map 2d symmetrically so that r -> f(r)
>
>
> Leon Gunther
>
> thegunthers at rcn.com
>
>

```

• Prev by Date: Re: Using GraphPlot to draw an empty graph
• Next by Date: Re: piecewice pdf, problems with cdf
• Previous by thread: Re: distorting an image
• Next by thread: Re: distorting an image