Effacer les filtres
Effacer les filtres

From points to closed contour

1 vue (au cours des 30 derniers jours)
Yohanes Setiawan
Yohanes Setiawan le 23 Avr 2020
Commenté : Ameer Hamza le 24 Avr 2020
I have 6 points as shown in the picture above.
Can I make a closed contour from the 6 points as shown below?
I've tried to use creating ellipse and imfill() but they didn't work.
Thank you.

Réponse acceptée

Ameer Hamza
Ameer Hamza le 23 Avr 2020
Modifié(e) : Ameer Hamza le 23 Avr 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);
  7 commentaires
Yohanes Setiawan
Yohanes Setiawan le 24 Avr 2020
It has been solved!
I changed into double and WORKED!
Thank you so much for your help.
Ameer Hamza
Ameer Hamza le 24 Avr 2020
I am glad to be of help.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by