MATLAB: How to connect pixels of a binary image as shown in picture

disconnected pixels

Best Answer

I would try morphological closing and see if that gets the result you want, e.g.
img = imread('image.png');
newimg = imclose(img, strel('disk', 3));
results in:
closed.png
Related Question