简体   繁体   中英

MATLAB image processing and filteration

One sample image can be found here:

http://www.auntminnie.com/user/images/content_images/su_cto/2008_08_07_15_16_16_735_mcnitt.lidcnodule.jpg

I downloaded this image and renamed it to be oiu.jpg . My code is:

Now here I am getting two regions, one the small area (1) and the other as the big one (2)

The output is seen below:

http://i.stack.imgur0.com/8So8G.jpg

I only want to get the smaller area and everything else as black. I tried Gabor filtering but I was not able to do it. I can also use Morphological Operations. Please help. And also comment on the method of median filtering and threshold value I am applying. Thanks

Here is an input file and "output.jpg" is the corresponding output file. Thanks

In your original code I saw that the user could interact with the dicom datased you have input to the script, as it returns a message when the image is not greyscaled.

If interaction is possible when the code runs you could try to ask the user to select a region from one of the images of the dicom dataset in order to search there for the tumor in the same slice or in the previous or following slices of the dataset. You could try to use the "imcrop" function for doing so.

On the other way round, I guess that there is also the chance to ask the user to select the undesired white part of the mask, and then run a code to eliminate this part of the mask.

Hope this advice help you to develop a code for doing so.

Using the image you have posted, this is what I got:

在此处输入图片说明

It is very simple. You can apply morphological operations & chose a suitable strel operator which serves your purpose.

img = im2bw(img);
img_dil = imdilate(img , strel('disk', 10 )); 
img_erd = imerode(img_dil , strel('disk', 4 )); 

figure, subplot(2,2,1), imshow(img), title('original Image');
subplot(2,2,2), imshow(img_dil), title('dilated Image');
subplot(2,2,3), imshow(img_erd), title('eroded Image');

After this, you can use bwareaopen

n = 3000; % change n according to your requirement.
img_out = bwareaopen(img_erd, n);
img_out = imsubtract (img_out,img);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM