Detect and Fill Edges of a Binary Image
조회 수: 2 (최근 30일)
이전 댓글 표시
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
채택된 답변
Akira Agata
2018년 5월 24일
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!