How to fill the gaps in an image after thinning?

113 Views Asked by At

How can I fill the gaps that occurred as a result of thinning? The first image is the image before thinning, the second one is the image after thinning and the third one is an example of the pixels that I need to connect. I'm using MATLAB R2013a.

I used this code in thinning:

bw_clean = imopen(binary_image, strel('rectangle',[3 3]));
bw_clean = bwareaopen(bw_clean, 15);
thin_image = ~bwmorph(imcomplement(bw_clean), 'thin', Inf);

Image before thinning:

Image before thinning

Image after thinning:

Image after thinning

Example of what I need to connect:

Example of what I need to connect

When I used BW2 = imfill(A,'holes'); the output was:

Output using imfill

And when I used

se = strel('disk',10);
closeBW = imclose(A,se);

the output was:

Output usimg imclose

0

There are 0 best solutions below