![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/286999/image.png)
From points to closed contour
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Yohanes Setiawan
el 23 de Abr. de 2020
Comentada: Ameer Hamza
el 24 de Abr. de 2020
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/286986/image.jpeg)
I have 6 points as shown in the picture above.
Can I make a closed contour from the 6 points as shown below?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/286987/image.jpeg)
I've tried to use creating ellipse and imfill() but they didn't work.
Thank you.
0 comentarios
Respuesta aceptada
Ameer Hamza
el 23 de Abr. de 2020
Editada: Ameer Hamza
el 23 de Abr. de 2020
Try this
im = im2double(imread('image.jpeg'));
im_gray = rgb2gray(im);
im_gray = imbinarize(im_gray)*1;
[r,c] = find(im_gray==1);
points = [c r];
p = convhull(points);
points = points(p, :).';
poly_points = points(:).';
im_gray = insertShape(im_gray, 'FilledPolygon', poly_points, ...
'Color', [1 1 1], ...
'Opacity', 1, ...
'SmoothEdges', false);
imshow(im_gray);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/286999/image.png)
7 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!