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

1 Ansicht (letzte 30 Tage)
Naim
Naim am 6 Jul. 2017
Beantwortet: Walter Roberson am 17 Jul. 2017
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!

Antworten (2)

Gautham Sholingar
Gautham Sholingar am 17 Jul. 2017
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: http://www.mathworks.com/help/images/ref/imagesegmenter-app.html

Walter Roberson
Walter Roberson am 17 Jul. 2017
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