Connect objects binary image

10 visualizaciones (últimos 30 días)
Mithushan Soundaranathan
Mithushan Soundaranathan el 4 de Feb. de 2020
Comentada: Jonne el 29 de Abr. de 2021
Hi
I have this binary image with 4 objects, and want to connect this 4 object into one object/blob (see image, with the approximate connection points marked with red).
I have tried: imclose, bwmorph(BW,'bridge'), bwmorph(BW,'endpoints'), imdilate, imerode and imfill.
Do you have solution for that, I have been struggling for weeks. BW_img_marked.jpg

Respuestas (1)

Subhadeep Koley
Subhadeep Koley el 4 de Feb. de 2020
Hi, try the code below and see if it gives the expected output. (Download the attached image)
a = rgb2gray(imread('BW_img_marked.jpeg'));
b = imbinarize(a);
se = strel('disk', 12, 4); % Structuring element for dilation
c = imdilate(b, se); % Dilating the image
d = imfill(c,'holes'); % Filling the holes
imshow(d);
filledBWImage.png
  3 comentarios
Mithushan Soundaranathan
Mithushan Soundaranathan el 4 de Feb. de 2020
Editada: Mithushan Soundaranathan el 4 de Feb. de 2020
I though of something similar to this, to find the outer boundary?
Jonne
Jonne el 29 de Abr. de 2021
Nice how did you do this? could you share the code

Iniciar sesión para comentar.

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by