After some simple preprocessing I am receiving boolean mask of segmented images.
I want to "enhance" borders of the mask and make them more smooth. For that I am using OPEN morphology filter with a rather big circle kernel , it works very well until the distance between segmented objects is enough. But In alot of samples objects stick together. Is there exists some more or less simple method to smooth such kind of images without changing its morphology ?
Not 100% sure what you are trying to achieve, but this may be an avenue to explore... the tool
potrace
takes images and converts them to vectorised images which involves smoothing. It prefersPGM
format input files so I use ImageMagick to prepare them. Anyway, here is an example of the command and the result so see what you think:I have converted the resulting
SVG
file to aPNG
so I can upload it to SO.Without applying a morphological filter first, you can try to detect the external contours of the image. Now you can draw these external contours as filled contours and then apply your morphological filter. This works because now you don't have any holes to fill. This is fairly simple.
Another approach:
In the code below, I've applied the second approach to a sample image.
Input image
External contours without any smoothing
After applying a Gaussian filter to x and y 1-D signals
C++ code