Ask Your Question

Remove small objetc from image after segmentation

asked 2013-03-30 12:48:43 -0500

djou gravatar image

updated 2013-04-04 02:04:55 -0500


I have a brain MRI image, that I want to segment and extract tumore area which is the area having more intensity.

image description

After segmentation with thresholding and watershed method I get this result

image description

After that I want to extracting textural features from the tumor area only, so I have to remove all noise and other objects outside the region of interst (the tumor)

So like shown in image below, I want to remove the object inside the red circle

image description

I've tried morphological operation, but that didn't work, is there any other solution ?

Thank you, and sorry for my bad english !

edit retag flag offensive close merge delete

4 answers

Sort by ยป oldest newest most voted

answered 2013-03-31 14:23:28 -0500

unxnut gravatar image

This is a simple case of blob analysis. Use the middle image and determine the blobs. Keep the blob with the largest area. It may be helpful if you download cvBlobsLib and look at the tutorial. It will take you about five lines of code to do what you want. Also, to get the original image, you can use the AND operator instead of multiplication.

edit flag offensive delete link more


thanks :), I'll see about blob analysis...

djou gravatar imagedjou ( 2013-04-01 03:09:48 -0500 )edit

This blob analysis will simply suit your problem. Just need to determine dimensions of blobs and look for ratios that are possible for tumor areas.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-04 02:53:39 -0500 )edit

answered 2013-03-30 13:22:30 -0500

Basically, multiply each channel of your image with the mask. This will result in a pixel with the RGB value = 000 and thus presenting you with a black region.

edit flag offensive delete link more


And by mask, I mean your binary segmented image that is shown to the right.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-03-30 13:23:10 -0500 )edit

if I understand what you mean, I have to multiply the original image with the binary one, and thus a pixel with value = 0 is black region, but why ? this will not remove the object that I want to remove...sorry, I'm a beginner on computer vision...

djou gravatar imagedjou ( 2013-03-30 13:44:08 -0500 )edit

So you want to remove the grey region, which is the tumor? What do you want as end result? Only the picture of the tumor? The brain without tumor? How do you want the removed area to look like? Some more advice please, then I can make suggestions that fit your problem more.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-03-30 14:09:03 -0500 )edit

Yes, I want the image with only the tumor area like image above, the result I want to get is shown on the left of the image...thanks

djou gravatar imagedjou ( 2013-03-30 14:15:37 -0500 )edit

Can you post a link with a simple single image and a threshold value. I am guessing you do not understand what i mean. If you first threshold the image, you receive a area of the tumor in white, whick is an area of 1 values. If you want as ouput the actual brain without tumor, you multiply original with that binary mask. If you want only the original tumor to show, than you first invert the mask (1 becomes 0) and then multiply. Normal brain tissue will then disappear. The only third option i can think of is that you would like the region to be coloured or something. If so, please tell me, then I will suggest other options.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-03-31 09:41:34 -0500 )edit

answered 2014-02-12 08:21:52 -0500

Probably easiest way is to find the contours of the image and keep only the one that has specific size, eccentricity etc by looking at the contour moments. Then plot the target contour in a new image.

Have a look here:

edit flag offensive delete link more

answered 2013-03-30 22:46:08 -0500

wuling gravatar image

updated 2013-03-30 22:47:50 -0500

Hi about removing small area, you can ref: But this blog is Simple Chinese word. If you have grey regin, i think you must give a thresh, and removesmall object. finally use brainy pic and orginal pic , then you can give you want. I don't know it's good for you or not. The code there:

CV_IMPL void lhMorpRemoveSmallObject(const CvArr* src,CvArr dst,IplConvKernel * element ,int iterations) { IplImage temp = cvCreateImage(cvGetSize(src),8,1); cvGetImage(src,temp); cvErode(src,temp,element,iterations); lhMorpRDilate(temp,src,dst,NULL,-1); cvReleaseImage(&temp); }

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2013-03-30 12:48:43 -0500

Seen: 3,946 times

Last updated: Feb 12 '14