Regarding the explanation of the background distortion correction algorithm, in order to be more clear, I will briefly introduce the main points in the text of the article:
1, enter the original image.
2. Beauty sdk face feature point detection, background image grid division and line segment detection.
3. Synthesize the second point to judge the distribution of line segments in the triangular mesh.
4. According to the third point, judgment and treatment: use slope-preserving constraint to establish optimization equation or use triangle shape-preserving constraint to establish optimization.
Equation.
5. Establish the overall optimization objective function.
6. Affine transformation of the corresponding triangle.
If the slopes of straight lines in the background before and after the beauty model remain unchanged, users will no longer perceive the background distortion obviously. To this end, according to the preset rules
Then select some feature points in the background of the original image, and use these feature points to triangulate the background area. After the operation, these feature points
The position of will change. By detecting the straight line in the background of the original image, the slope of the straight line and the shape of the triangle will remain unchanged before and after the change.
Keeping the two constraints unchanged, the optimization objective function is established, and finally the corrected feature point position is obtained.
The above is the introduction of the background distortion correction algorithm in Beauty sdk, mainly starting from the core of keeping the linear slope of the background image unchanged.
Starting from the concept, the background image will not be deformed while ensuring the basic beauty effect. If you are interested in the development of beauty sdk, please consult the official customer service.