How to detect the boundary (binary image)

2 views (last 30 days)
How do I write a program to delete the line L1 (binary image) and make the red line around the boundary area (B2) with the matlab language. From aree.supha@gmail.com

Accepted Answer

Image Analyst
Image Analyst on 1 Dec 2019
One way is to call imclose(), then cast the image to double and then blur it with conv2() and threshold it. Then remove any holes that remain.
mask = imclose(mask, true(7));
mask = conv2(double(mask), ones(3), 'same') > 3; % Adjust number to control the size of the new mask.
mask = imfill(mask, 'holes'); % Remove any interior holes.
Another way might be to use activecontour(). See attached demo. Attach your image if you can't figure it out.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!