How to get image indices in polar coordinates

Answers (2)

Where is your origin? At the upper left like it normally is for images? Have you seen cart2pol()?

4 Comments

Lets assume that the origin is the upper left corner. Yes I did see cart2pol function, but I didnt understand how to use it with image objects and I absolutely didn't understand how to get image indices, since this function returns matrix of different data
You don't use it with image objects. You use it on pixel coordinates. So it appears that you really don't want this function and want to do something totally different than what your subject line is. What do you really want to do, find, or measure in your image, and where did you upload your image to (e.g. tinypic.com)?
Ok. Let me explian. This is stady task. Need to rotate an image in the frequency domain. It should be relatevely easy, since all you need to do is multiply indices by exp(i*angle). But this will work only is picture represented in polar coordinates. So the botlle neck for me currently is an ability to read the image transform it to polar coordinates and walkthrough it indices
Isn't the angle arctangent(y/x)? You might need to call fftshift andset your origin at the center to get the right angle, like atan(((y-yCenter) / (x-xCenter)). By the way in the past week or so there already was a posting on how to rotate an image via the Fourier domain, perhaps it was a classmate of yours. Do a search for it. It had working code and everything.

Sign in to comment.

Are you trying to take a rectangular image and "warp" it to a circle, like a "fish-eye lens" ?
Are you trying to create a circular image and are hampered because arrays are rectangular, and you are not sure how to map the rectangular array to the circular image?
If your goal is to create a circular image and you want to know how to map the pixels, then there are two basic methods of doing that. You can start with the rectangular coordinates and "push" each of them in to the circle, or you can start with the circle and "pull" pixels from the rectangle.
People tend to program the "push" method, but it can be shown that for some image transformations, this will leave unpainted gaps in the final image. The only general and reliable method is the "pull" method of starting with the structure of the final image and figuring out where the pixels should come from.
Either way you have the problem that multiple pixels in the source will affect each destination pixel, so you have to use non-linear extrapolation. I know it would take me a while to figure out. I would probably google for information rather than working through the math.

Tags

Asked:

on 26 Nov 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!