conversion of Image presentation from Cartesian to polar coordinates

Discussion in 'MATLAB' started by Allen Richter, Oct 22, 2003.

  1. Hi to all

    I have the following problem:
    I have an image I(m,n) which I would like to present not in a
    cartesian format but in a polar format I(r, theta). At the end I need
    to have the power spectrum of the image as
    H(r, theta) and NOT H(m,n). This is because I have to multiply the
    Power Spectra of the image with other functions which are in polar
    coordinates. It is also better in optical engineering to have polar
    coordinates so I can present resolution as cycles/degree and not in

    It would be great if someone could help me with this. I know that a
    Matlab function exists "car2pol", which converts from cartesian to
    polar coordinates but I don't know how to implement this with any
    image file.

    Thanks a lot!

    Allen Richter, Oct 22, 2003
    1. Advertisements

  2. Generate 2 matrices and fill them with the r and theta coordinates you
    want to appear at each point. Maybe like:

    [r, theta] = meshgrid(1:N/2, linspace(0,2*pi,200));

    Now transform these coordinates to two more matrices which are the
    corresponding x,y coordinates into your image. Be sure to account for
    the offset for the center of your image. Now use interp2 to sample
    your original image at the coordinates in your new matrices.
    Peter Boettcher, Oct 22, 2003
    1. Advertisements

  3. Dear Peter
    thanks for your quick response, unfortunately I only could read the
    message now.
    how can I transform the coordinates (r, theta) to two more matrices
    and how do I change the offset of the image?

    Allen Richter, Oct 30, 2003
  4. I'm not going to write all the code for you. If a single point is
    r=100, th=pi, what is the corresponding x,y value? Well, depends on
    the dimensions of your image and what you define as theta=0, etc. But
    assuming theta=0 is to the right, horizontally, then th=pi,r=100 would
    to me mean 100 pixels left of center.

    You'll want sin and cos in there somewhere. Draw it out.

    The offset is just because you don't want r=0 to map to x=0,y=0,
    because you can't index into a matrix using negative values. You just
    need to add something to x and y so your image indices go from 1 to

    Give it a shot. If it doesn't work post your code.
    Peter Boettcher, Oct 30, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.