MATLAB Answers

0

Polar coordinates of image.

Asked by Stewart Tan on 6 Sep 2019
Latest activity Commented on by Walter Roberson
on 7 Sep 2019
So i have used the cart2pol() function to obtain the polar coordinates represented by and θ. In a paper I'm analysing, it is said that the image function, will be multiplied with a matrix.
Is it possible to use in Matlab instead of the normal ?

  0 Comments

Sign in to comment.

2 Answers

Answer by Jackson Burns on 7 Sep 2019

The function pol2cart might be what you are looking for.

  4 Comments

Show 1 older comment
If your f is an array rather than a function, then f(x,y) would not be typical. The first dimension corresponds to rows and the second dimension correspond to columns, and normally rows corresponds to Y and columns corresponds to x. If your f were an array then normally you would index f(row,column) which would correspond most closely to f(y,x) .
However, rows and columns do not typically correspond to y and x, because your y and x are not typically restricted to small consecutive positive integers. You would normally have some kind of correspondance index or formula, such as
column = floor(x*10) + 51
which might be used if you were willing to approximate x by 1/10 increment for an x range starting from -5.0
If you had an array fpol then fpol(r,theta) would have similar issues to above, namely that your r and theta would be restricted to small positive integers. You would be more likely to have an fpol(rows, columns) with translation formulas such as row = 1 + r * 100 and column = floor(theta*100) + 501 to support r increments of 1/100 starting from 0 and theta increments of 1/100 starting from -5.00 .
But you really need to be clear on whether you are working with an array fpol or a polar function
When you start talking about multipling by matrices in this context, you should start suspecting that lurking somewhere around is a transformation matrix such as a rotation matrix . In such a case what you would probably be working with is a matrix with two columns of coordinates, and the matrix multiplication would transform the coordinates to new coordinates.
@Walter Roberson, spot on!! the image function is multiplied by a rotation matrix. I've been trying to figure it out for weeks now.
You will probably find that is a function that produces and coordinate pairs, and that the rotation matrix operates on those to produce and coordinate pairs
Rotation matrices can also be created in terms of polar coordinates
[r(:), theta(:), zeros(numel(r),1)] * [1 0 0; 0 1 dtheta; 0 0 1]
which would increate theta -> theta+dtheta ... though for that simple case it would typically be easier to just do theta = theta + dtheta

Sign in to comment.


Answer by Walter Roberson
on 7 Sep 2019

If what you have is a formula in terms of x and y, and you need to convert it to polar, and you have the symbolic toolbox, then use
syms r theta
polar_formula = simplify( subs(YourFormula, {x, y}, {r*cos(theta), r*sin(theta)}) )