Borrar filtros
Borrar filtros

Detect and Fill Edges of a Binary Image

6 visualizaciones (últimos 30 días)
Carolyn
Carolyn el 16 de Mayo de 2018
Respondida: Akira Agata el 24 de Mayo de 2018
I have this image that I have created from a point cloud. I want to connect the inner and outer rings and fill the region between them with 1s. Any suggestions? I tried creating a boundary of the scatter data, but I couldn't enclose the region with that. I can't use bwboundary because the points aren't currently connected. I would love to connect them then use that function if possible.

Respuesta aceptada

Akira Agata
Akira Agata el 24 de Mayo de 2018
Assuming that the inner/outer ring can be approximated by the edge of convex hull of inner/outer ring points, the area between inner and outer ring can be extracted by the following:
% Read and prepare the binary image
I = imread('Slice.jpg');
Igray = rgb2gray(I);
BWin = imbinarize(Igray);
BWin = imclearborder(BWin);
% Convex hull of outer ring points
CH1 = bwconvhull(BWin);
% Remove outer ring points
se = strel('disk',10);
CH1b = imerode(CH1,se);
BW1 = BWin & CH1b;
% Convex hull of inner ring points
CH2 = bwconvhull(BW1);
% Extract the area between inner and outer convex hull
BWout = CH1 - CH2;
% Show the result
figure
imshowpair(BWin,BWout)

Más respuestas (0)

Categorías

Más información sobre Lighting, Transparency, and Shading en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by