## Anamorphosis and symmetries

As proposed by Farris in “Creating Symmetry” we can use anamorphosis to make images of any symmetry from some other input image. Here I briefly discuss how I am doing it and what you will find in my next program.

Each pixel of the output image has integer indices (h,k) for its row and column. After an offset and a scaling we get a point (x,y) in 2-dimensional space:

x=outputScale*(h-outputOffsetX) and

y=outputScale*(k-outputOffsetY).

We can choose the offsets and the scale interactively. Changing the offset we move a center of symmetry around in the image. We can zoom in or out by varying the scale.

Then a mapping transforms the point (x,y) to an image point (X,Y). This mapping defines the symmetry. For theoretical work we can use complex coordinates z=x+i*y and Z=X+i*Y. But in the end we have to use real numbers x and y for our programming.

The image point (X,Y) points to the input image and shows where to sample its color, which will be the color of the output image pixel at (h,k). For versatility we rotate, scale and shift the coordinates to get row and column values:

H=inputScale*(X*cos(α)-Y*sin(α))+inputOffsetX and

K=inputScale*(X*sin(α)+Y*cos(α))+inputOffsetY.

To find the best image we choose the angle α, the input scale and the input offsets interactively. Obviously, H and K are not integers and we need some pixel interpolation. For fast exploration we simply take the color of the nearest pixel. To get good image quality we can change to linear or cubic interpolation.

And now for something completely different: Fight for your rights and support the ACLU.

This entry was posted in Anamorphosis, Kaleidoscopes, programming and tagged , , . Bookmark the permalink.