From: Ibtesam Saleh on 20 May 2010 11:45 hi... I want to make sure if my way is correct to convert my image to polar coordinate or not, If not please tell me the correct way. img=imread(imageName); img= imresize(img, [500 500]); % find the Cartesian coordinate [x,y]=find(img); % convert from Cartesian to polar [theta,radius]=cart2pol(x,y); %The arrays X and Y must be the same size that why I use imresize 1- but how I know the best size for all my images to resize them?? 2- how can I get the polar image as a matrix from [theta,radius] because I want use the image after get its polar coordinate?
From: Roger Stafford on 20 May 2010 13:49 "Ibtesam Saleh" <bossy_4me(a)yahoo.com> wrote in message <ht3lef$jt6$1(a)fred.mathworks.com>... > hi... > I want to make sure if my way is correct to convert my image to polar coordinate or not, > If not please tell me the correct way. > > img=imread(imageName); > img= imresize(img, [500 500]); > % find the Cartesian coordinate > [x,y]=find(img); > % convert from Cartesian to polar > [theta,radius]=cart2pol(x,y); %The arrays X and Y must be the same size that why I use imresize > > > 1- but how I know the best size for all my images to resize them?? > 2- how can I get the polar image as a matrix from [theta,radius] because I want use the image after get its polar coordinate? - - - - - - - - - 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
|
Pages: 1 Prev: variable Phase shift in Simulink Next: Quadratic Cost Function x^T Q x |