Concept
KNN Matting The Laplace matrix method based on KNN is proposed, and the adjacency matrix is constructed by KNN, then the degree matrix and the Laplace matrix are brought into the solution equation of Α\alpha. Pull a picture
Pull up the technology to separate part of the image from the rest. The image is divided into two layers, the layer becomes the foreground layer, and the other part of the image is called the background layer.
Each point in the image is composed of a foreground color and a background color, where the proportion of the foreground color is called the alpha factor. Color combination equation:
i=αf+ (1−α) b i=\alpha f+ (1-\alpha) b
I, F, B represent the synthetic, foreground, and background colors on the image, Α\alpha is the alpha value of the point.
In the case of only knowing I, solving alpha,f,b, this is a constraint insufficiency (under-constrained) problem.
By assuming that F and B are constant values in very small windows, the problem is reduced to the following constraint problem (the theorem extracted in the paper).
Α=argminα′lαs.t.α (i) =s (i) \alpha = \arg \min \alpha ' L\alpha \\\\. S.T (i) \alpha (i)
where S S is a manually labeled region, S (i) s (i) is the pixel value in S. Use the following formula to solve:
The main contribution of the
(l+λd) ∑inαi=λm (L+\lambda D) \sum\limits_{i}^{n}\alpha_i=\lambda m
K nearest neighbor is to propose a method of calculating Laplace matrix based on KNN.
1. Eigenvector calculation
The eigenvector of a given pixel I is defined as follows:
X (i) = (cos (h), sin (h), s,v,x,y) X (i) = (cos (h), sin (h), s,v,x,y)
which h,s, The V is the coordinate value of the HSV color space, (x,y) is the spatial coordinate of the pixel I.
2. Kernel function calculation
defines kernel functions:
K (i,j) =1−∥x (i) −x (j) ∥c K (i,j) =1-\frac{\left\| X (i)-X (j) \right\|} {C}
C is the weight adjustment factor, guaranteed K (I,j) ∈[0,1] K (i,j) \in [0,1], | | | | Is the sum of the 1 norm, the absolute value of the difference between two vectors.
Laplace Matrix:
L=d−a l=d-a
where the similarity matrix aij=k (i,j) a_{ij}=k (i,j), diagonal matrix Dii=∑jaij D_{ii}=\sum\limits_{j}{a_{ij}}
K neighbors The cutout gives you a fit for any color