Re: Questions about the Log Polar Transform.



"Robin Tucker" <idontwanttobespammedanymore@xxxxxxxxxxxxxxx> writes:
>Forgive me but I'm a bit new to all this; as I understand it, the polar
>transform maps radial lines in Cartesian space to horizontal lines in polar
>coordinate space:

>Like this:

>[1] r = sqrt ( ( x - xc ) ^2 + ( y - yc ) ^ 2 )
>[2] a = tan-1 ( ( y - yc ) / ( x - xc ) )

>So I can calculate r and a for each point in a source image using [1] and
>[2].

That formula will only give you angles between -90 and +90 degrees. To
get proper polar coordinates, you'll have to use atan2(), or look at
the sign of (x-xc) and make a correction to get angles in the left half
of the plane.

That's the first half of the mapping. This gives you the polar
coordinates of the pixel in the source image. Then you have to map
that to a new position (x', y') in the destination image using
something like

x' = k1 * r + k2
y' = k3 * a + k4

where k1-k4 are constants used to set the size of the output image and
make the X and Y addresses all positive.

If you want a log-polar output image, not just a polar one, you'll also
need to change "r" to "log(r)" in the above.

>Now correct me if I'm wrong, but I cannot apply a transform to the source
>image purely by performing a linear interpolation of a pixel from the source
>image at the destination image between r1 and r2 and a1 and a2 (where r1,
>r2, a1, a2 are the minimum and maximum r and a in the source image).

No, you need to apply the transformation point by point, since it is not
a linear mapping.

>How do I map the source pixel (x, y) through polar coordinates (r, a) onto a
>destination image?
>Should I use something like x = [r cos a], y = [r sin a]?

The easiest thing to do in this case is to operate in output image
space. For every pixel location (x', y') in the output image, calculate
the input pixel location (x, y) by inverting the expressions above.
This will give you a position that isn't exactly aligned with any input
pixel.

For a quick and dirty test, just round the position to the nearest
integer (x, y) and use that pixel - this is called nearest neighbour
resampling. If you want a good-quality output image, you will need to
interpolate between several input pixels to determine the output pixel
value. Bilinear interpolation between 4 input pixels is cheapest,
bicubic interpolation using 16 input pixels is better, and the
resampling literature can provide even better (and more expensive)
interpolation.

Dave
.



Relevant Pages

  • Re: Questions about the Log Polar Transform.
    ... > coordinates of the pixel in the source image. ... Resulting Image Map is 320 x 240 pixels. ... > The easiest thing to do in this case is to operate in output image ... For every pixel location in the output image, calculate ...
    (sci.image.processing)
  • Re: code optimization help
    ... interpolation lookup table for speed. ... of pixels from the source image that contribute to the corresponding ... contribute to the output pixel. ...
    (comp.soft-sys.matlab)
  • Re: Image rotation and new image recreation
    ... Scanning the output image and doing bilinear interpolation to get the output values? ... and decide where to send input pixels. ... would be at that location if a pixel were located there. ...
    (comp.soft-sys.matlab)
  • Re: Is there anyone who has developed map projection library?
    ... >To add a comment to Pauls thoughs on transformation of images: ... Now scan through the OUTPUT image and find ... >the location of this pixel in the original image and fill it with that value. ... >because your entire output image is filled with values (or outside the input image) ...
    (comp.infosystems.gis)
  • Re: Rookie having problems with some filter code. Any help?
    ... This doesn't seem to match your output image so perhaps you are adding the filter result to the input pixel value. ... with a 4 in the middle, this would be a Laplacian but now it is a sum of the Laplacian and the center pixel. ...
    (sci.image.processing)