Filter: Polar Coordinates

Source: [HOLZ88:48-49], [CLAE97]

The idea for this geometric transformation came from [HOLZ88:48-49]. Surprise! Photoshop® has this one too, but I did not realize it until after I began work on this filter and did some investigation. The idea here is simple. Pretend that the pixels in our Cartesian-based image are actually polar coordinates and display them using the Cartesian system. That is, a pixel at coordinate (x,y) has a corresponding polar coordinate radius and angle (r,a), using the center of the image as the polar origin. Here, to find a value for the filtered image, we find (r,a), then use r = x, and a = y and plot the point in our Cartesian system. The conversion to polar coordinates from Cartesian, is based on geometry and trigonometry:

   radius = sqrt(x*x + y*y)
   angle = arctan(x / y)

Although not used in this filter, the conversion back to Cartesian is given by:

   x = radius * cos(angle)
   y = radius * sin (angle)

Using this method, not every coordinate location in the filtered image would have been plotted with a pixel value from the original image. To resolve this issue, we first set every pixel in the filtered image to white.

As mentioned, the idea is simple, but the implementation takes careful work of the manipulation of both coordinate systems working together in order to produce the correct result. The simple pseudocode is given below, however the actual implementation is a bit more confusing. Much of the success of the results is based on trail and error. The interested reader is referred to the FilterExplorer code.

   for every pixel in the filtered image do
   currentpixel.color(255); // set to white

   for every pixel in the original image do
   {
   // x and y are the coordinates of the currentpixel
   // the pixel in the center of the image x = 0, y = 0
      r = sqrt(x*x + y*y);
      a = atan(x/y);
      x = r * image_height / R;
      y = a * image_width / 6.2832;
      filterpixel.x = x;
      filterpixel.y = y;
   }

I once found on the Internet a digital artist who made some interesting compositions using this filter, so if used creatively, the effect is worth more than just its novelty.


Polar coordinates on original with superimposed grid


Return to the list of filters
 


© 2001 Jason Waltman