MATLAB Answers

Naim
0

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

Asked by Naim
on 6 Jul 2017
Latest activity Answered by Walter Roberson
on 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!

  0 Comments

Sign in to comment.

2 Answers

Answer by Gautham Sholingar on 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

  0 Comments

Sign in to comment.


Answer by Walter Roberson
on 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

  0 Comments

Sign in to comment.