Detect and Fill Edges of a Binary Image
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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.
0 Commenti
Risposta accettata
Akira Agata
il 24 Mag 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)
0 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!