Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to segment part of an image so that the edges are smooth?

I have an input image as follows and wish to segment the parts into regions. I also want the segmented parts to not been just the pixels which contribute to the solid color but also the edge anti-aliasing between the edge of the region and the next region.

Does there exist any filter or method to segment the image in this way? The important part is that the end result segmented part must contain the edge anti-aliasing between it and the next regions. A correct solution is shown in yellow.

In these two images I zoomed the pixels to be large so the edge anti-aliasing between region edges can be seen clearly.

enter image description here

An example output that I want for the yellow region is shown.

enter image description here

For a definition of "edge anti-aliasing" see https://markpospesel.wordpress.com/2012/03/30/efficient-edge-antialiasing/

like image 661
Phil Avatar asked Oct 30 '22 02:10

Phil


1 Answers

I'm not sure what exactly you want. For example, would some pixels belong to two segments? If that is the case, then I'm relatively sure you have to do something on your own. Otherwise, the following might work:

Opening and Closing

Opening and closing are two morphological operations which will smooth borders

Clustering

There are many clustering algorithms. They are what you want for non-semantic segmentation (for semantic segmentation, you might want to read my literature survey). One example is

P. F. Felzenszwalb, “Graph based image segmentation.”

I would simply give those algorithms a try and see if one directly works.

Other clustering algorithms:

  • K-means
  • DB-SCAN
  • CLARANS
  • AGNES
  • DIANA
like image 99
Martin Thoma Avatar answered Dec 29 '22 23:12

Martin Thoma