Image segmentation: I want to get rid of ugly "branches" of a binary image

조회 수: 1 (최근 30일)
Naim 2017년 7월 6일
답변: Walter Roberson 2017년 7월 17일
See attached photo. I want to keep the ellipse in the blue while getting rid of the roots that stick out. there are thousands of images with different such branches but the same shaped reoccuring ellipse in the centre.
Morphology does not work, there are big holes in the ellipses sometimes so I cant erode, and the roots sometimes touch the ellipse twice making "imfill" impractical.
would active contours or some kind of shape fitting work? a point in the right direction would be great!

답변 (2개)

Gautham Sholingar
Gautham Sholingar 2017년 7월 17일
There are a few ways to approach this issue:
1) Considering that you have several images where the ellipse is the one common theme between all of these images, you can essentially combine these images in some form of averaging/logical AND operation to remove all the roots and extraneous elements which will differ from one image to the next.
  • An averaging operation of all these images assuming white is intensity 255 and black is intensity 0 will lead to an image with a gradient with the ellipse being mostly white and the surroundings being less than 255. If you threshold this averaged result with a high threshold you will get an image which is mostly an ellipse.
  • If you perform an AND operation of several images, only the white pixels common to all the images should remain. There will be some extraneous smaller patches of white left which you can remove using morphology operations.
2) It is useful to play around with the image segmenter app to identify ways to segment the image using active contours.
The following documentation link explains this in detail:

Walter Roberson
Walter Roberson 2017년 7월 17일
imerode(), bwareaopen() to get the largest object, imdilate by the amount you eroded, find boundaries, use boundaries to extract everything inside the original ellipse

Community Treasure Hunt

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

Start Hunting!

Translated by