i try to convert image into polar coordinates

here a code :
a=imread('1e.png');
r=imresize(a,[64 64]);
bw=im2bw(r);
[m,n]=size(bw)
m =
64
n =
64
[x,y]=meshgrid(1:n,1:m);
c = ((m+1)/2,(n+1)/2); %make center of the image to be the origin
|
Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.
[theta,rho] = cart2pol(x-c,y-c);
how to fix this ? thanks

1 Commento

Sophia
Sophia il 17 Mar 2016
Modificato: Sophia il 17 Mar 2016
change this c = ((m+1)/2,(n+1)/2)); and what is the error message after this

Accedi per commentare.

 Risposta accettata

Sophia is correct. The problem is on this line:
c = ((m+1)/2,(n+1)/2); %make center of the image to be the origin
Do you want c to be a two-element array? If yes, change the line to
c = [(m+1)/2,(n+1)/2]; %make center of the image to be the origin

10 Commenti

thanks Chad for answare my question. Yes, i want c to be a 2 element array.. thanks now the code is working, but i getting the arror again : c =[(m+1)/2,(n+1)/2];
[teta,rho]=cart2pol(x-c,y-c)
Error using -
Matrix dimensions must agree.
Perhaps you want
[teta,rho]=cart2pol(x-c(1),y-c(2))
thanks Chad, but how to show the result image after process [teta,rho]=cart2pol(x-c(1),y-c(2)) ??
walter, here my code, but i don't get the polar image
a=imread('1e.png');
a2=imresize(a,[64 64]);
bw=im2bw(a2);
[m,n]=size(bw);
[x,y]=meshgrid(1:n,1:m);
c =[(m+1)/2,(n+1)/2];
[teta,rho]=cart2pol(x-c(1),y-c(2));
S = surf(x,y,ones(size(bw)));
what's wrong ?
Image Analyst
Image Analyst il 18 Mar 2016
Modificato: Image Analyst il 18 Mar 2016
You forgot to attach 1e.png. Make it easy, not hard, for us to help you by giving us everything we need to run and fix your code.
And what are you expecting? Some kind of round image or something? Did you notice that after you compute teta and rho that you never even use them? Why not????
thanks you for answare my question.. sorry i am is a very new beginner in matlab. i want to convert my rectangle image into polar image. i hope the result is the circle image with the object is in center of the image. But, i'm very confused .. after i compute teta and rho what should i do to get the result is the polar image ? thank you so much :D i am sorry that my english is not good enough :(
i was make it but i get the error : Error using handle.handle/set Invalid or deleted object. how to fix it ?
Please show your code attempt complete with the texture mapping step, and please post the complete error message.

Accedi per commentare.

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by