I have to work on image segmentation. The idea is to divide an image into regions which have pixels either of the similar color or the ones which can be represented by a gradient equation (linear or radial). I have found many algorithms which do the separation based on colors but could not find anyone which handles gradients. Does someone know any such algorithm or suggestions on how to go for it.
问题:
回答1:
Mean-Shift Segmentation might be what you are looking for. It is implemented in OpenCV. It is tolerant of smooth gradients, yielding a more natural result, or something that a human would come up with if he was converting an image to a paint-by-number.
Here is an image that was segmented with mean-shift:
回答2:
In gradient areas, the edge function (laplacian or other edge detection functions) will detect no edge (the result will be nearly zero ("black")). So, apply an edge filter on the image, and then you will have nearly black areas (for gradient or other similarly-colored sections) outlined by bright edges (where there was a strong difference in the original image). This image should be easily segmented by most segmentation algorithms (and if they classify the bright edges as their own segment, simply merge edge pixels back with the closest black area).
Note that you may want to find and segment only the gradient areas first, and then use a more decent segmentation algorithm on the original (non-edges) image. Note also that the edge detection doesn't work exactly for the radial gradients, so you may want to actually compute the edge function twice to acheive better results