Fill the lines in the images
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Dear All;
I have a line among the image and i have tried to fill using imfill but I could not do it , any idea to fill this image (attached)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/149626/image.jpeg)
0 Kommentare
Antworten (1)
Image Analyst
am 1 Okt. 2015
Draw lines down the edges then call imfill, then erase the lines
row1 = find(binaryImage(:, 1), 1, 'first');
row2 = find(binaryImage(:, 1), 1, 'end');
row3 = find(binaryImage(:, end), 1, 'first');
row4 = find(binaryImage(:, end), 1, 'end');
% Seal edges
binaryImage(:, 1) = true;
binaryImage(:, end) = true;
% Fill in the line.
binaryImage = imfill(binaryImage, 'holes');
% Erase temporary lines on edges that we made.
binaryImage(:, 1) = false;
binaryImage(:, end) = false;
% Fill in left and right edges.
binaryImage(row1:row2, 1) = true;
binaryImage(row3:row4, end) = true;
Siehe auch
Kategorien
Mehr zu Image Processing and Computer Vision finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!