Changing semi circle image from Cartesian to Polar coordinate
Show older comments
Hi Folks,
I want to create an Image of 2 semi circle with (R1 and R2) and than convert the cordinate from cart to polar.
below is the code that i used to create circle but i dont know how to expand it to 2 semi circle.
Can you please help me with that?
% First create the image.
imageSizeX = 144;
imageSizeY = 144;
[columnsInImage rowsInImage] = meshgrid(1:1:imageSizeX, 1:1:imageSizeY);
% Next create the logical circle in the image
centerX = 72;
centerY = 72;
r = 64; %radius
circlePixels =(rowsInImage - centerY).^2 ...
+ (columnsInImage - centerX).^2 <= r.^2;
% circlePixels is a 2D "logical" array.
%convert logical to number
img1 = double(circlePixels);
% Now, display it.
imagesc(img1);
set(gca,'YDir','normal') % invert Y-axis on images
imageCenter=[72,72];
viscircles(imageCenter,64,'EdgeColor','w','LineWidth',1); % Draw circles line with white color line and width line is 5
grid on
grid minor
save ('img1.mat'); % save ref. image as img1.mat file for analysis
Accepted Answer
More Answers (0)
Categories
Find more on Cartesian Coordinate System Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!