how to change the color of lung portion only from binary image?

2 views (last 30 days)

Answers (1)

Image Analyst
Image Analyst on 18 Feb 2019
Invert the lousy image you have (that is if you don't want to improve the segmentation), call imerode(), call imclearborder, call bwareafilt() to take the two largest remaining blobs. Here's a start
se = strel('disk', 0, 50); % Adjust 50 as necessary
mask = imerode(~mask, se);
mask = imclearborder(mask);
mask = bwareafilt(mask, 2);
mask = imdilate(mask, se);
imoverlay(.........
See if you can finish it.

Community Treasure Hunt

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

Start Hunting!