How do I display a polar coordinates image in Cartesian?
23 views (last 30 days)
Show older comments
MathWorks Support Team
on 27 Jun 2009
Edited: MathWorks Support Team
on 17 May 2023
I have an RGB color image which is in polar coordinates (RGB as a function of theta and rho). I want to display this image in Cartesian coordinates.
Accepted Answer
MathWorks Support Team
on 17 May 2023
Edited: MathWorks Support Team
on 17 May 2023
For a simple example, if rho is the following 2D array:
rho =
0 0.2000 0.4000 0.6000 0.8000 1.0000
0 0.2000 0.4000 0.6000 0.8000 1.0000
0 0.2000 0.4000 0.6000 0.8000 1.0000
0 0.2000 0.4000 0.6000 0.8000 1.0000
0 0.2000 0.4000 0.6000 0.8000 1.0000
0 0.2000 0.4000 0.6000 0.8000 1.0000
0 0.2000 0.4000 0.6000 0.8000 1.0000
and theta is the following 2D array:
theta =
0 0 0 0 0 0
15 15 15 15 15 15
30 30 30 30 30 30
45 45 45 45 45 45
60 60 60 60 60 60
75 75 75 75 75 75
90 90 90 90 90 90
Here is the example code:
[rho, theta] = meshgrid(0:0.2:1.0,0:15:90);
[X Y] = pol2cart(theta*pi/180,rho);
S = surf(X,Y,ones(size(X)));
Picture = imread('autumn.tif');
set(S,'FaceColor','Texturemap','CData',Picture);
view(2);
Type
doc cart2pol
or
doc function_name
in the MATLAB command window for more information of the commands used in the example code.
For more information on the surface properties, please look at the following URL:
For a transition from Cartesian coordinates to polar or cylindrical, review the following function:
0 Comments
More Answers (0)
See Also
Categories
Find more on Cartesian Coordinate System Conversion in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!