Extracting points from polyshape

4 views (last 30 days)
MaryD
MaryD on 8 Jun 2021
Answered: darova on 24 Jul 2021
I have a figure defined as polyshape and I want to create pointcloud representing full boundary and inside of polygon, not only vertices. The only idea i have for now is to fill polygon in black, open plot as bw image and get th coordinates of the black pixels. Is there any method to do that better? If no, can I 'save' the plot as an image directly to worspace ?

Answers (1)

darova
darova on 24 Jul 2021
See this link about curve interpolation: LINK
Saving the data as a picture is a good idea too: try print
x = 0:20;
y = sin(x);
plot(x,y)
% make axes invisible
set(gca,'Xcolor','w', ...
'Ycolor','w', ...
'xtick',[], ...
'ytick',[])
I0 = print('-RGBImage','-r300'); % returns an image with 300 dots per inch resolution
I1 = im2bw(I0);
imshow(I1)

Categories

Find more on Elementary Polygons 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!