Continuous Function Image Manipulation
Convolution is a very powerful image manipulation tool, but it is possible to go much further with Mathematica. We are now going to see how to use the unique combination of symbolic and numerical capabilities of Mathematica to manipulate images in ways impossible in any other system.
The key idea is to transform the image from a discrete matrix of values into a continuous mathematical function, which can then be manipulated mathematically.
Mathematica includes a tremendously clever and powerful feature for doing this.
(A small annoyance: The
Let's see how this function works. Say you want to find out the value of a pixel in the image. You could pick out a particular element from the original data using
So far, nothing remarkable. But the powerful thing about
Instead of thinking in terms of arrays of pixels, we can now think in terms of a mathematical function (of two variables) that happens to have z-values that correspond to the brightness of patches of our image. So, let's start thinking mathematically. What's the first thing you do with a function of two variables? Why, plot it of course.
Note that the x and y plot ranges correspond to the number of pixels in the original image. This is merely the default used by
Ah, there's the puppy.
What happens if we apply a function to the x and y variables before passing them to
This diagram may help explain the distortion better.
The parabolas represents the and functions we are using to distort the image. Towards the bottom of the image where the slope is shallow, a small portion of the original image is stretched to fill a large portion of the output image. Near the top where the slope is steep, the image is instead compressed. The same thing holds in the left/right direction.
For example, look at the square at the lower right of the original image. Follow the lines, and you'll see that it turns into a much bigger square in the output image. Conversely, the upper left square, which starts out the same size, turns into a smaller square in the output image. The lower left square turns into a wide rectangle, while the upper right square turns into a tall rectangle.
Before we continue, let's redo the
Converted by Mathematica April 21, 2000