dotted output after skeletonization in matlab

151 Views Asked by At

I wish to skeletonize this image

enter image description here

To do so i am using matlab's bwmorph function, Here is the snippet :

bw = bwmorph(img_bw,'skel',Inf);

However the output is not as expected. Here is the output.

enter image description here

Could someone suggest a better way to achieve proper results ?

EDIT: here is a stripped down relevant code

img = imread(name);
img = rgb2gray(img*4);
img_bw = img > 50;
img_bw = medfilt2(img_bw,[10 10]);
bw = bwmorph(img_bw,'skel',Inf);
1

There are 1 best solutions below

1
Daniel On BEST ANSWER

What you see is aliasing, the imshow function can not display the full image because it is to large to fit the screen. To fit the screen some rows and columns are skipped, which cause the lines to be disconnected. To display an image at full resolution using a scrollpanel, use imscrollpanel

hFig = figure('Toolbar','none', 'Menubar','none');
hIm = imshow(bw);
hSP = imscrollpanel(hFig,hIm);