Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

connecting a disconnected silhouette edge

I have a silhouette edge that is not connected and i need a way to make it connected so that i can sort it's pixels clockwise... any help about how to do so. this is an image of the disconnected border but the cuts in the edge will not be obvious it need to zoom in to see them.

Silhouette Image

like image 637
Amr Ramadan Avatar asked Jul 10 '11 15:07

Amr Ramadan


1 Answers

Try the following:

I = double(imread('http://i.stack.imgur.com/2MYgL.png'));
BW = im2bw(I,0.5);                   %# binarize image
BW = imdilate(BW,strel('square',3)); %# dilation
BW = imfill(BW,'holes');             %# fill inside silhouette
BW = imerode(BW,strel('square',3));  %# erode
BW = bwperim(BW,8);                  %# get perimeter
imshow(BW)

enter image description here

like image 150
Amro Avatar answered Oct 05 '22 23:10

Amro