K-Nearest Neighbor cutout (KNN matting) __ Machine learning

Source: Internet
Author: User
Tags cos sin
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.