The invention provides a method for synthesizing a face backlight picture. The method comprises the following steps: S1, preprocessing an image; s2, face feature point detection: S2.1, a
normal face image is sent to a
face detection model, and
face contour points are detected; s2.2, inputting the
background image into a
face detection model, and detecting background
face contour points; s3, generating a closed
face contour line; s4,
mask construction: S4.1, applying a flooding filling
algorithm to the image template M to generate a face region
mask 0; s4.2, according to the corresponding contour points, solving
homography matrixes of the two images;
homography transformation is carried out on the
mask0; a mask 1 after transformation is obtained;
homography transformation is carried out on the face image; a transformed face image is obtained; s4.3, carrying out
negation operation on the mask 1, and generating a background region mask 2; s5, target area extraction: S5.1, performing mask operation on the transformed face image and a mask 1, and extracting a face area to obtain an image I1; s5.2, performing mask operation on the
background image and a mask 2, and extracting a backlight background area to obtain an image I2; and S6,
image splicing: carrying out addition operation on the obtained image pixels to obtain a spliced image.