我正在MATLAB中进行肺癌检测。我想分割肺部CT扫描的二进制图像以获取感兴趣的区域。
在图片中,您可以看到黑色区域内的白色区域。黑色物体表示肺部,黑色物体内部的白色区域表示癌症影响肺部。我想从图像中获取白色区域。我想把输出只作为黑色背景中的那个白色区域。我怎样才能做到这一点?
答案 0 :(得分:1)
这样的事情怎么样:
% Read in image and convert to BW
BW = im2bw(imread('http://i.stack.imgur.com/pxpOz.jpg'));
% Invert so that the lung appears white white
BW = ~BW;
% Create a structuring element. Tune the '2' depending on the size of the gap
se = strel('disk',2);
% Perform mophological closing
closeBW = imclose(BW,se);
% Fill the holes
lungBW = imfill(closeBW,'holes');
% subtract the lung image from the closed image
cancerBW = (lungBW - closeBW);
% Display the results
figure; imshow(cancerBW);
答案 1 :(得分:0)
你没有给出代码,所以我也在没有代码的情况下回答。
你可以
或者,你可以