I am being told by MATLAB that im2bw is no longer recommended and instead imbinarize should be used. I cannot, however, figure out how to change my code to derive the same output as im2bw. Here is my function:
[bw_img, bw_label] = wingMorphFilter2(~, label) label(label == 2) = 1; label(label == 3) = 2; label(label == 4) = 2; rgb_img = label2rgb(label); bw_img = im2bw(rgb_img); bw_img = imcomplement(bw_img); bw_img = imclearborder(bw_img); bw_img = bwareafilt(bw_img,7); bw_img = imfill(bw_img,'holes'); se = strel('disk', 8); bw_img = imerode(bw_img,se); bw_img = imfill(bw_img,'holes'); bw_img = bwareafilt(bw_img,7); bw_img = imdilate(bw_img,se);
Best Answer