Merge binary images and smooth the edges

5 visualizaciones (últimos 30 días)
Davide Messina
Davide Messina el 11 de Mayo de 2021
Comentada: Rik el 11 de Mayo de 2021
Hello,
I am trying to extract the shape of a metallic droplet from the first picture and convert it into a binary image with edges as smooth as possible. So far I have been using the following commands: im2bw (with different thresholds), imfill (to fill any holes in the droplet), and imopen to smooth the edges. However, I am far from the results I would like to obtain.
In order: (1) photo that I want to process (2-3) im2bw with two different thresholds (4) manual merge of pictures 2-3 (5) example of what I would like to achieve.
Does anyone have a suggestion on how I can proceed?

Respuestas (1)

Rik
Rik el 11 de Mayo de 2021
I'm not getting as smooth as your example, but this should do as a first approximate.
IM=imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/614215/image.png');
BW{1}=rgb2gray(IM);
BW{2}=edge(BW{1},'canny');
BW{3}=imclose(BW{2},ones(10));
BW{4}=imfill(BW{3},'holes');
BW{5}=imopen(BW{4},ones(20));
BW{6}=~BW{5};
for n=1:6
subplot(2,3,n),imshow(BW{n}),title(sprintf('step %d',n-1))
end
  2 comentarios
Davide Messina
Davide Messina el 11 de Mayo de 2021
Thank you for your answer Rik! Maybe I should have specified that, beside obtaining a smooth surface of the droplet, I also need to keep the black line underneath it (it is the substrate on which the droplet is deposited) as the angle formed between substrate and droplet is a valuable information for my experiments.
Do you think it is feasible to keep it with the approximation that you proposed?
Rik
Rik el 11 de Mayo de 2021
You could try to use it to zoom in to the relevant sections of your image. My approximation is reasonable if you want to segment the droplet, but is grossly inadequate if you are looking for the angle.

Iniciar sesión para comentar.

Categorías

Más información sobre Bodies 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