How to convert arc circle plot into binary circle?
Show older comments
how to change the circumference into binary circle ?

Accepted Answer
More Answers (1)
https://matlab.fandom.com/wiki/FAQ#How_do_I_create_an_arc.3F shows how to create an arc.
But for your purpose, instead of using plot(), multiply the coordinates by the resolution you want, and round() them, and then subtract off the minimum x and y . Now you have matrix coordinates.
resolution = 25;
th = linspace(0, 7*pi/9, 500);
r = 5;
xc = 3;
yc = 7;
[x,y] = pol2cart(th, r);
x = x + xc;
y = y + yc;
%the above are data coordinates. Make them into array coordinates.
buffer = 5;
xm = round(x * resolution);
ym = round(y * resolution);
xmin = min(xm);
ymin = min(ym);
xmax = max(xm);
ymax = max(ym);
xmc = xm - xmin + 1 + buffer;
ymc = ym - ymin + 1 + buffer;
arc_image = accumarray([ymc(:), xmc(:)], 1);
imshow(arc_image)
Categories
Find more on Axes Transformations 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!
