Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: convert to polar coordinate

$
0
0

> Cartesian coordinates as applied to an image unquestionably refer to pixel positions x and y. You will not generate these using the 'find' function. Presumably you would do this:
>
> [m,n] = size(img);
> [x,y] = meshgrid(1:n,1:m);
>
> Resizing is not called for in doing this.
>
> However, before converting to polar coordinate you need to decide where the origin is to be located for these. Suppose you want the center of the image to be the origin for this purpose. Then you would do this:
>
> c = ((m+1)/2,(n+1)/2);
> [theta,rho] = cart2pol(x-c,y-c);
>
> Or, if the origin is to be the upper lefthand corner, use
> [theta,rho] = cart2pol(x-1,y-1);
>
> Roger Stafford

Roger,
I agree with you regarding the resizing, but I still have a big problem using the method you described. Doing a
figure, pcolor(theta,rho,img), shading interp

gives a weird result, and doing a

figure, surf(theta,rho,img), shading interp

clearly shows why the pcolor looks weird... however I don;t really understand what's happening and as Ibtesam in his previous message, I am still looking for a way to get a matrix out of the polar transformation, that I could "imagesc".
Do you think I need to go for an interpolation method using IriIcatterInterp, or do you have a solution from the method you described earlier ?

Thank you
Eric

Viewing all articles
Browse latest Browse all 19628

Trending Articles