问题
I have an ellipse in the image.After segmentation i got a broken ellipse as shown .which morphological operation is used to get the perfect ellipse
Actual input file is
output obtained is
i tried imopen ,but i will lose lower ellipse like structure .how to close the upper ellipse like structure without losing lower ones
Mask i created is
i want to segment the ellipse like structure.but some of these structures are connected with rectangular like bodies.how to separate it. erode will eliminate small ellipses
回答1:
If you want to reconnect something with a mathematical morphology operator, do not use an opening (it increases the gap), but a closing (imclose)! The names are explicits.
In you case, you want to reconnect something vertically cut, so use a horizontal structuring element (type segment).
And yes, you have to invert your image, black pixels representing the absence of information.
回答2:
Usually, for closing gaps, you would need the close operator. However, since most software assume active pixels are white, you would either need to invert the image, or use the open operator. On this image, in matlab, the following works well:
imopen(I,ones(32))
This uses a square structuring element. You may want to experiment with other shapes.
Your example also looks like you moved half of the ellipse, as opposed to some process which deleted pixels in the middle. No simple morphological operation can create a perfect
ellipse out of the sample image, unless you use the knowledge that multiple components can be moved to re-form the ellipse. If that is the actual case, you can scan connected components and try to match them together.
来源:https://stackoverflow.com/questions/34448519/morphological-operation-to-improve-the-shape-of-segmented-image