Image segmentation is a basic problem in the field of computer vision, and hyper-pixel segmentation is a preprocessing step, the so-called hyper-pixel, refers to a similar texture, color, brightness and other features of the adjacent pixel image block (is a set of pixels), using hyper-pixel in place of pixels for image processing, Can reduce the complexity of subsequent image processing tasks to a large extent. The algorithm of hyper-pixel generation can be divided into two methods based on graph theory and gradient descent method, Slic algorithm belongs to the latter. In the current hyper-pixel segmentation algorithm, the effect of slic is comparatively good.
On the introduction of the hyper-pixel segmentation algorithm, we can refer to the research review of hyper-pixel segmentation algorithm:
Http://wenku.baidu.com/link?url=NLGalCf2j04mcUbD7358Gwu1kknpD9U_8U8SlYCsLFZ5-_ Knoknktegpue0jnunr4obib3cbdeqyeouweqlhz1ocr58yjum8rrothe8fuhu
On the implementation of SLIC, you can refer to the article "SLIC superpixels":
Http://ivrlwww.epfl.ch/supplementary_material/RK_SLICSuperpixels/index.html
This article is reproduced from: http://blog.csdn.net/u014568921/article/details/44588207
The following are reproduced content:
--------------------------------------------------------------------------------------------------------------- -------------------------------------------
The SLIC algorithm is the abbreviation for simple linear iterative cluster, which is used to generate hyper-pixel (superpixel).
Basic ideas
Algorithm General idea is this, the image from the RGB color space to the Cie-lab color space, corresponding to each pixel (l,a,b) color value and (x,y) coordinates to form a 5-D vector v[l,a,b,x,y], the similarity of two pixels can be measured by their vector distance, the greater the distance, The smaller the similarity.
The algorithm first generates K seed points, then searches the surrounding space of each seed point for several pixels closest to the seed point, and classifies them as the seed point, until all pixel points are sorted. The average vector value of all pixels in the K-pixel is then computed, re-get K cluster Center, and then to the K Center to search for its surrounding with the most similar pixels, all the pixels are sorted out after the K-pixel, update the cluster center, iterate again, so repeated until convergence. How does it feel like the K-means clustering algorithm.
The algorithm accepts a parameter k, which specifies the number of pixels generated. Set the original image has N pixels, then each pixel is divided into approximately n/k pixels, each pixel of the edge length is roughly s=[n/k]^0.5, we start every pixel to take a cluster center, and then the cluster center around the 2s*2s for its search space, A number of the most similar points are searched in this space. Here is a problem, in order to avoid the selected cluster center is the edge and noise such an unreasonable point, the algorithm has been improved, in the 3*3 window to move the cluster center to the smallest gradient area, the gradient is defined as
G (x,y) =[v (x+1,y)-V (x-1,y)]^2+[v (x,y+1)-V (x,y-1)]^2
This will avoid the above mentioned situation.
Because l,a,b in Cie-lab color space, the size of the l,a,b is limited, and image size is not limited, if the size of the picture is larger, will result in measuring vector distance space distance (x,y) effect is too large, so need modulation space distance (x,y) effect, so need to X, Y is normalize. The measurement of the improved vector distance is as follows:
d_lab=[(Lk-li) ^2+ (Ak-ai) ^2+ Bk-bi (^2]^0.5)
d_xy=[(XI-XK) ^2+ (yk-yi) ^2]^0.5
ds=d_lab+ (M/s) *d_xy
M is used to adjust the weight of the d_xy, typically 1-20, set to 10 in the algorithm.
Finally, there may be small areas where D is labeled as belonging to a pixel but is not connected to this pixel, this requires that the small area d be reclassified to the largest pixel connection to this small area d to ensure that the pixel is complete. Algorithm Flow
Let's see the effect: