user2753594
user2753594

Reputation: 145

How to connect points in a binary image in matlab

I have a binary image with several points as below:

enter image description here

How can I make a connection between these points? Like this:

enter image description here

I have tried

se = strel('line', LEN, DEG); 
imclose(image, se);

But nothing is changed.

Please help me

Thank you

Upvotes: 3

Views: 3199

Answers (1)

Shai
Shai

Reputation: 114786

You can use roipoly to create a mask defined by the points.
Given a binary mask you can use bwmorph(BW,'remove'); to get the boundary and you are done.

The only problem is determining the order of the points, different order defines different mask. This one you'll have to figure for yourself.

Example of ambiguity in ordering the points:
enter image description here

Upvotes: 4

Related Questions