Face image fusion method, device, equipment and storage medium
By detecting and adjusting the skin tone of the original face image in the fusion of face image, combined with the fusion method of generating an adversarial network, the problem of unnatural skin tone when faces of different skin tones are fusion, and the degree of skin tone fusion is improved.
Patent Information
- Application Number
- CN202311506854.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-10
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2043-11-10
AI Technical Summary
The existing facial image fusion method is used to blend faces of different skin colors, and the complexion of skin tones is unnatural, resulting in low complexion of skin tones.
The skin color area of the first face image is determined through the skin color detection algorithm, and its color space is converted. The skin color area of the face is separated according to the preset color attribute range, and the face skin color color value of the second face image is extracted. The separated skin tone area is adjusted and synthesized with other areas to obtain a third face image, and then the target face image is generated through the trained generative adversarial network.
The skin tone adjustment of the original face image before the face image is fused, so that the skin tone is more natural when the faces of different skin colors are fused, and the complexity of the skin tone is improved.
Smart Images

Figure CN117611460B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of images, and in particular to a face image fusion method, device, equipment and storage medium. Background Art
[0002] With the development of various technologies, face processing technology in images is becoming more and more widespread. Major camera software has functions such as beauty, stickers, hairstyle change, fusion, etc. Among them, the face image fusion technology used in fusion is to fuse two different face images into one face image, and the newly obtained fused image retains the facial features of the original face images.
[0003] The current face fusion technology is based on the Generative Adversarial Networks (GANs) method, but when GANs fuse faces of different skin colors, the skin color fusion is unnatural. Therefore, the skin color fusion degree of the existing face image fusion method is low. Summary of the invention
[0004] The main purpose of the present invention is to solve the technical problem of low skin color fusion degree when face images are fused.
[0005] A first aspect of the present invention provides a face image fusion method, the face image fusion method comprising:
[0006] Acquire a first face image and a second face image, wherein the first face image is an original face image that has not been processed, and the second face image is a face image that is a reference for changes in the first face image;
[0007] Determine the facial skin color region of the first facial image by using a skin color detection algorithm, and convert the color space of the facial skin color region;
[0008] Separating the facial skin color area from the first facial image according to the facial skin color area after color space conversion and a preset color attribute range;
[0009] Extracting a facial skin color value from the second facial image, adjusting the skin color of the separated facial skin color region according to the facial skin color value, and synthesizing the facial skin color region with the adjusted skin color with other regions in the separated first facial image to obtain a third facial image;
[0010] A target facial image is obtained through a trained generative adversarial network according to the third facial image and the second facial image.
[0011] Optionally, in a first implementation of the first aspect of the present invention, the preset color attribute range includes a preset hue range and a preset saturation range;
[0012] The step of separating the facial skin color area from the first facial image according to the facial skin color area after the color space conversion and the preset color attribute range comprises:
[0013] According to the preset hue range and the preset saturation range, selecting a target pixel in the human face skin color area after the color space conversion;
[0014] According to the target pixel, a target face skin color area is obtained;
[0015] The target face skin color area is separated from the first face image.
[0016] Optionally, in a second implementation of the first aspect of the present invention, selecting, according to the preset hue range and the preset saturation range, a target pixel in the human face skin color area after the color space conversion comprises:
[0017] generating a mask according to the preset hue range and the preset saturation range;
[0018] The mask and the first face image are subjected to a bitwise operation to obtain a target pixel in the face skin color area after color space conversion.
[0019] Optionally, in a third implementation of the first aspect of the present invention, extracting the facial skin color value of the second facial image, adjusting the skin color of the separated facial skin color area according to the facial skin color value, and synthesizing the facial skin color area with the adjusted skin color with other areas in the separated first facial image to obtain the third facial image includes:
[0020] extracting the facial skin color value of the second facial image by a color analysis tool;
[0021] According to the human face skin color value, adjusting the color component of the separated human face skin color area to perform skin color adjustment;
[0022] The skin color area of the face with adjusted skin color is synthesized with other areas in the separated first face image through an image reconstruction method to obtain a third face image.
[0023] Optionally, in a fourth implementation manner of the first aspect of the present invention, determining the facial skin color area of the first facial image by a skin color detection algorithm, and converting the color space of the facial skin color area includes:
[0024] Separating the foreground person and the background in the first face image by an image segmentation algorithm;
[0025] Determining the facial skin color area of the foreground person by a skin color detection algorithm;
[0026] The color space of the skin color area of the face is converted.
[0027] Optionally, in a fifth implementation manner of the first aspect of the present invention, obtaining a target facial image through a trained generative adversarial network according to the third facial image and the second facial image includes:
[0028] Train the initial generative adversarial network so that the trained generative adversarial network can learn the features of human faces;
[0029] Extracting facial features of the third facial image and facial features of the second facial image;
[0030] The facial features of the third facial image and the facial features of the second facial image are input into the generator of the generative adversarial network, and the generator fuses the facial features of the third facial image and the facial features of the second facial image to obtain a target facial image.
[0031] Optionally, in a sixth implementation of the first aspect of the present invention, determining the facial skin color area of the first facial image by a skin color detection algorithm, and converting the color space of the facial skin color area includes:
[0032] Converting the first face image into a grayscale image;
[0033] Performing noise reduction and normalization processing on the grayscale image to obtain a preprocessed image;
[0034] The human face skin color area of the preprocessed image is determined by a skin color detection algorithm, and the color space of the human face skin color area is converted.
[0035] A second aspect of the present invention provides a facial image fusion device, comprising: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via lines; the at least one processor calls the instructions in the memory so that the facial image fusion device executes the above-mentioned facial image fusion method.
[0036] A third aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned face image fusion method.
[0037] In an embodiment of the present invention, a first facial image and a second facial image are obtained; a facial skin color area of the first facial image is determined through a skin color detection algorithm, and the color space of the facial skin color area is converted; based on the facial skin color area after the color space conversion and a preset color attribute range, the facial skin color area is separated from the first facial image; the facial skin color value of the second facial image is extracted, and the skin color of the separated facial skin color area is adjusted according to the facial skin color value, and the facial skin color area with adjusted skin color is synthesized with other areas in the separated first facial image to obtain a third facial image; based on the third facial image and the second facial image, a target facial image is obtained through a trained generative adversarial network. In the present invention, first, the color space of the facial skin color area of the first facial image is converted, the facial skin color value of the second facial image is extracted, and the skin color of the separated facial skin color area is adjusted according to the facial skin color value. Then, the facial skin color area with adjusted skin color is synthesized with other areas in the separated first facial image, and a target facial image is obtained through a trained generative adversarial network. The skin color of the original facial image can be adjusted before the facial images are fused, so that when faces with different skin colors are fused, the skin color fusion is more natural, thereby improving the skin color fusion degree. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 A schematic diagram of an embodiment of a face image fusion method in an embodiment of the present invention;
[0039] Figure 2 A schematic diagram of an embodiment of a face image fusion device in an embodiment of the present invention;
[0040] Figure 3 Schematic diagram of an embodiment of a face image fusion device in an embodiment of the present invention. DETAILED DESCRIPTION
[0041] The embodiments of the present invention provide a facial image fusion method, device, equipment and storage medium.
[0042] The embodiments disclosed in the present invention will be described in more detail below with reference to the accompanying drawings. Although certain embodiments disclosed in the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments disclosed in the present invention are only for exemplary purposes and are not intended to limit the scope of protection disclosed in the present invention.
[0043] In the description of the embodiments disclosed in the present invention, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0044] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , an embodiment of the face image fusion method in the embodiment of the present invention includes:
[0045] S100, obtaining a first face image and a second face image.
[0046] In this embodiment, the first facial image is an unprocessed original facial image, and the second facial image is a facial image for reference of changes in the first facial image. When the facial images are fused, the facial skin color of the first facial image needs to be adjusted to the facial skin color of the second facial image, and then the faces of the first facial image and the second facial image are swapped.
[0047] S200, determining a facial skin color region of the first facial image by using a skin color detection algorithm, and converting a color space of the facial skin color region.
[0048] In this embodiment, a skin color detection algorithm is used to determine the facial skin color area of the first facial image. The skin color detection algorithm is usually based on a color space model, such as RGB, HSV or YCbCr; the color space of the facial skin color area is converted, wherein color space conversion refers to converting or representing color data in one color space into corresponding data in another color space, that is, using data in different color spaces to represent the same color. Optionally, in the present invention, the RGB color space of the facial skin color area can be converted into the HSV color space. The HSV color space can better describe the sensory characteristics of the color, and it is more advantageous to identify colors on HSV than on RGB.
[0049] S300, separating the human face skin color area from the first face image according to the human face skin color area after color space conversion and the preset color attribute range.
[0050] In this embodiment, by setting an appropriate color attribute range, the human face skin color area can be separated from the first face image. Specifically, a preset color attribute range of HSV is set. If the color attribute value of the pixel in the human face skin color area is within the preset color attribute range, the pixel is marked. Then, based on all the marked pixels, the human face skin color area is separated from the first face image. In addition, a large amount of marked image data can be used to train the model, and a machine learning algorithm (such as a support vector machine, a neural network, etc.) can be used to classify the skin color and non-skin color areas.
[0051] S400, extracting the facial skin color value of the second facial image, adjusting the skin color of the separated facial skin color area according to the facial skin color value, and synthesizing the facial skin color area with the adjusted skin color with other areas in the separated first facial image to obtain a third facial image.
[0052] In this embodiment, the facial skin color value of the second facial image is extracted, and the facial skin color value of the second facial image is used as a reference to adjust the facial skin color value of the separated facial skin color area, such as changing the brightness, saturation or hue, to adjust the skin color, wherein color mapping, histogram equalization, adjustment curve and other technologies can be used to achieve skin color adjustment. After the facial skin color area is adjusted, the adjusted facial skin color area is synthesized or reconstructed with other areas in the separated first facial image to obtain a third facial image to maintain overall consistency and naturalness, wherein the third facial image refers to a new image formed by merging the facial skin color area after the skin color adjustment with other areas remaining in the first facial image after the facial skin color area is separated from the first facial image.
[0053] 500, obtaining a target face image through a trained generative adversarial network according to the third face image and the second face image.
[0054] In this embodiment, the third face image and the second face image are input into a trained generative adversarial network to obtain a target face image, wherein the generative adversarial network (GANs) is a network architecture composed of a generator and a discriminator, the generator attempts to generate realistic synthetic images, and the discriminator attempts to distinguish between real images and synthetic images. Through continuous adversarial training, the generator and the discriminator compete with each other and gradually improve the generator's ability to generate realistic images. The target face image is a new image obtained by swapping the first face image.
[0055] In an optional implementation of the first aspect of the present invention, the preset color attribute range includes a preset hue range and a preset saturation range; and separating the face skin color area from the first face image according to the face skin color area after color space conversion and the preset color attribute range includes:
[0056] According to a preset hue range and a preset saturation range, a target pixel in the face skin color area after color space conversion is selected; according to the target pixel, a target face skin color area is obtained; and the target face skin color area is separated from the first face image.
[0057] In this embodiment, in the HSV mode, H (Hue) represents hue, S (Saturation) represents saturation, and B (Brightness) represents brightness. Skin color usually falls within a certain range of Hue and Saturation, where hue is measured by position on a standard color wheel of 0 to 360°. In normal use, hue is identified by a color name, such as red, green, or orange; saturation represents the purity of the color, 0 is gray, white, black, and other gray colors have no saturation, and at the maximum saturation, each hue has the purest color light, with a value range of 0 to 100%. In the present invention, a preset hue range and a preset saturation range are first set, and then, in the pixels of the human face skin color area after the color space conversion, the target pixels that meet the preset hue range and the preset saturation range are found, and the target pixels are extracted to achieve the separation of the human face skin color area.
[0058] In an optional implementation of the first aspect of the present invention, selecting a target pixel in the human face skin color area after color space conversion according to a preset hue range and a preset saturation range includes:
[0059] A mask is generated according to a preset hue range and a preset saturation range; and a bitwise operation is performed on the mask and the first face image to obtain a target pixel in the face skin color area after color space conversion.
[0060] In this embodiment, the available hue range and saturation range in the HSV space can be set by OpenCV, and then a mask is generated by using the inRange function method, where the mask is a binary image; and then the bitwise_and() function is used to perform bitwise operations on the mask and the original image, i.e., the first face image, to extract the target pixels in the skin color area of the face after the color space conversion.
[0061] In an optional implementation of the first aspect of the present invention, extracting a facial skin color value of the second facial image, adjusting the skin color of the separated facial skin color region according to the facial skin color value, and synthesizing the facial skin color region with the adjusted skin color with other regions in the separated first facial image to obtain a third facial image includes:
[0062] The facial skin color value of the second facial image is extracted by a color analysis tool; the color component of the separated facial skin color area is adjusted according to the facial skin color value to adjust the skin color; and the facial skin color area with adjusted skin color is synthesized with other areas in the separated first facial image by an image reconstruction method to obtain a third facial image.
[0063] In this embodiment, an image with a desired skin color, i.e., a second face image, is selected, and a color analysis tool, such as a color picker, is used to obtain the color value of the face skin color in the image; the color value of the separated face skin color area is adjusted to the desired face skin color value, which can be achieved by using color adjustment tools (such as levels, curves, color balance, etc.) in image processing software. When adjusting the color value, the value of each color component (such as R, G, B) can be gradually adjusted with reference to the desired face skin color value until a preset effect is achieved.
[0064] In an optional implementation of the first aspect of the present invention, determining the facial skin color region of the first facial image by a skin color detection algorithm, and converting the color space of the facial skin color region includes:
[0065] The foreground person and the background in the first face image are separated by an image segmentation algorithm; the face skin color area in the foreground person is determined by a skin color detection algorithm; and the color space of the face skin color area is converted.
[0066] In this embodiment, an image segmentation algorithm is used to separate the foreground person and the background in the first face image. Commonly used image segmentation methods include threshold-based, edge-detection-based, and region-growing-based methods. For the extracted foreground person region, a skin color detection algorithm can be used to determine the face skin color region in the foreground person, and then the color space of the face skin color region is converted.
[0067] In an optional implementation of the first aspect of the present invention, obtaining a target face image through a trained generative adversarial network according to the third face image and the second face image includes:
[0068] An initial generative adversarial network is trained so that the trained generative adversarial network can learn features of a human face; facial features of a third facial image and facial features of a second facial image are extracted; the facial features of the third facial image and the facial features of the second facial image are input into a generator of the generative adversarial network, and the generator fuses the facial features of the third facial image and the facial features of the second facial image to obtain a target facial image.
[0069] In this embodiment, in face image fusion, a GAN model needs to be trained first. Specifically, the parameters of the generator and discriminator networks are initialized first; then n samples are extracted from the training set, and the generator generates n samples using the defined noise distribution; then the generator is fixed, and the discriminator is trained to distinguish between true and false as much as possible. After multiple updates and iterations, in an ideal state, the discriminator cannot distinguish whether the image comes from the real training sample set or the sample generated by the generator. At this time, the probability of identification is 0.5, and the training is completed. The trained GAN model can learn the features of the face. Then, by inputting the facial features of the third face image and the facial features of the second face image into the generator, the generator will try to synthesize the two facial features into a new face image. The generated image will have the identity features of one person, but at the same time reflect the appearance features of another person.
[0070] In an optional implementation of the first aspect of the present invention, determining the facial skin color region of the first facial image by a skin color detection algorithm, and converting the color space of the facial skin color region includes:
[0071] The first face image is converted into a grayscale image; the grayscale image is subjected to denoising and normalization processing to obtain a preprocessed image; a face skin color region of the preprocessed image is determined by a skin color detection algorithm, and the color space of the face skin color region is converted.
[0072] In this embodiment, before performing face image fusion, the first face image needs to be preprocessed. The first face image is first grayscaled to obtain a grayscale image. A color image usually includes three components, R, G, and B, which respectively display various colors such as red, green, and blue. Grayscale is the process of making the three components of R, G, and B of the color image equal. Then, the grayscale image is subjected to noise reduction and normalization processing to eliminate irrelevant information in the original image and restore useful real information, thereby improving the reliability of image fusion.
[0073] See also Figure 2 The second aspect of the present invention provides a face image fusion device, the face image fusion device comprising:
[0074] An image acquisition module 10 is used to acquire a first face image and a second face image, wherein the first face image is an original face image that has not been processed, and the second face image is a face image that is a reference for changes in the first face image;
[0075] A color space conversion module 20, used to determine the facial skin color area of the first facial image through a skin color detection algorithm, and convert the color space of the facial skin color area;
[0076] An image separation module 30, for separating the human face skin color region from the first face image according to the human face skin color region after color space conversion and a preset color attribute range;
[0077] An image synthesis module 40 is used to extract the facial skin color value of the second facial image, adjust the skin color of the separated facial skin color area according to the facial skin color value, and synthesize the facial skin color area with the adjusted skin color with other areas in the separated first facial image to obtain a third facial image;
[0078] The target image acquisition module 50 is used to obtain a target face image based on the third face image and the second face image through a trained generative adversarial network.
[0079] In an optional implementation of the second aspect of the present invention, the image separation module 30 is also used to select target pixels in the facial skin color area after color space conversion according to a preset hue range and a preset saturation range; obtain a target facial skin color area based on the target pixels; and separate the target facial skin color area from the first facial image.
[0080] In an optional implementation of the second aspect of the present invention, the image separation module 30 is also used to generate a mask based on a preset hue range and a preset saturation range; perform a bit operation on the mask and the first face image to obtain a target pixel in the face skin color area after the color space conversion.
[0081] In an optional implementation of the second aspect of the present invention, the image synthesis module 40 is also used to extract the facial skin color value of the second facial image through a color analysis tool; adjust the color component of the separated facial skin color area according to the facial skin color value to perform skin color adjustment; and synthesize the facial skin color area with the adjusted skin color with other areas in the separated first facial image through an image reconstruction method to obtain a third facial image.
[0082] In an optional implementation of the second aspect of the present invention, the color space conversion module 20 is also used to separate the foreground person and the background in the first face image through an image segmentation algorithm; determine the facial skin color area in the foreground person through a skin color detection algorithm; and convert the color space of the facial skin color area.
[0083] In an optional implementation of the second aspect of the present invention, the target image acquisition module 50 is also used to train an initial generative adversarial network so that the trained generative adversarial network can learn the features of a human face; extract the facial features of a third facial image and the facial features of a second facial image; input the facial features of the third facial image and the facial features of the second facial image into a generator of the generative adversarial network, and the generator fuses the facial features of the third facial image and the facial features of the second facial image to obtain a target facial image.
[0084] In an optional implementation of the second aspect of the present invention, the color space conversion module 20 is also used to convert the first facial image into a grayscale image; perform denoising and normalization on the grayscale image to obtain a preprocessed image; determine the facial skin color area of the preprocessed image through a skin color detection algorithm, and convert the color space of the facial skin color area.
[0085] Figure 3 is a schematic diagram of the structure of a face image fusion device provided by an embodiment of the present invention. The face image fusion device 500 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 510 (for example, one or more processors) and a memory 520, and one or more storage media 530 (for example, one or more mass storage devices) storing application programs 533 or data 532. Among them, the memory 520 and the storage medium 530 can be short-term storage or permanent storage. The program stored in the storage medium 530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the face image fusion device 500. Furthermore, the processor 510 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the face image fusion device 500.
[0086] The face image fusion device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input and output interfaces 560, and / or one or more operating systems 531, such as Windows Serve, Mac OS X, Unix, Linux, Free BSD, etc. Those skilled in the art will appreciate that Figure 3 The structure of the face image fusion device shown does not constitute a limitation on the face image fusion device, and may include more or less components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0087] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the face image fusion method.
[0088] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0089] In addition, although each operation is described in a specific order, this should be understood as requiring such operation to be performed in the specific order shown or in a sequential order, or requiring that all illustrated operations should be performed to obtain desired results. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single implementation in combination. On the contrary, the various features described in the context of a single implementation can also be implemented in multiple implementations individually or in any suitable sub-combination mode.
[0090] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A face image fusion method, characterized in that: The face image fusion method comprises: Acquire a first face image and a second face image, wherein the first face image is an original face image that has not been processed, and the second face image is a face image that is a reference for changes in the first face image; Determine the facial skin color region of the first facial image by using a skin color detection algorithm, and convert the color space of the facial skin color region of the first facial image; Separating the facial skin color region of the first facial image from the first facial image according to the facial skin color region of the first facial image after color space conversion and the preset color attribute range; Extracting the facial skin color value of the second facial image, adjusting the skin color of the facial skin color area of the separated first facial image according to the facial skin color value, and synthesizing the facial skin color area of the first facial image with the adjusted skin color with other areas in the separated first facial image to obtain a third facial image; extracting the facial skin color value of the second facial image, taking the facial skin color value of the second facial image as a reference, adjusting the facial skin color value of the facial skin color area of the separated first facial image by changing the brightness, saturation or hue, and using color mapping, histogram equalization, and adjustment curve technology to achieve the skin color adjustment; Obtaining a target face image through a trained generative adversarial network according to the third face image and the second face image; The extracting of the facial skin color value of the second facial image, adjusting the facial skin color area of the separated first facial image according to the facial skin color value, and synthesizing the facial skin color area of the first facial image with the adjusted skin color with other areas in the separated first facial image to obtain the third facial image comprises: extracting the facial skin color value of the second facial image by a color analysis tool; According to the facial skin color value, adjusting the color component of the facial skin color area of the first separated facial image to perform skin color adjustment; Acquire the facial skin color value in the second facial image through a color picker, adjust the color value of the facial skin color area of the separated first facial image to the facial skin color value of the second facial image, and when adjusting the facial skin color value, refer to the facial skin color value of the second facial image, and gradually adjust the value of each color component in the facial skin color area of the separated first facial image until a preset effect is achieved; By using an image reconstruction method, the facial skin color area of the first facial image with skin color adjustment is synthesized with other areas in the first facial image after separation to obtain a third facial image.
2. The face image fusion method according to claim 1, characterized in that: The preset color attribute range includes a preset hue range and a preset saturation range; The step of separating the facial skin color region of the first facial image from the first facial image according to the facial skin color region of the first facial image after color space conversion and the preset color attribute range comprises: According to the preset hue range and the preset saturation range, selecting a target pixel in the face skin color area of the first face image after color space conversion; According to the target pixel, a target face skin color area is obtained; The target face skin color area is separated from the first face image.
3. The face image fusion method according to claim 2, characterized in that: The selecting, according to the preset hue range and the preset saturation range, a target pixel in the face skin color area of the first face image after the color space conversion comprises: generating a mask according to the preset hue range and the preset saturation range; The mask and the first face image are subjected to a bitwise operation to obtain a target pixel in the face skin color area of the first face image after color space conversion.
4. The face image fusion method according to claim 1, characterized in that: Determining the facial skin color area of the first facial image by using a skin color detection algorithm, and converting the color space of the facial skin color area of the first facial image comprises: Separating the foreground person and the background in the first face image by an image segmentation algorithm; Determining the facial skin color area of the foreground person by a skin color detection algorithm; The color space of the facial skin color area of the first facial image is converted.
5. The face image fusion method according to claim 1, characterized in that: The step of obtaining a target face image by training a generative adversarial network based on the third face image and the second face image includes: Train the initial generative adversarial network so that the trained generative adversarial network can learn the features of human faces; Extracting facial features of the third facial image and facial features of the second facial image; The facial features of the third facial image and the facial features of the second facial image are input into the generator of the generative adversarial network, and the generator fuses the facial features of the third facial image and the facial features of the second facial image to obtain a target facial image.
6. The face image fusion method according to claim 1, characterized in that: Determining the facial skin color area of the first facial image by using a skin color detection algorithm, and converting the color space of the facial skin color area of the first facial image comprises: Converting the first face image into a grayscale image; Performing noise reduction and normalization processing on the grayscale image to obtain a preprocessed image; The facial skin color region of the preprocessed image is determined by a skin color detection algorithm, and the color space of the facial skin color region of the first facial image is converted.
7. A facial image fusion device, characterized in that: The face image fusion device comprises: An image acquisition module, used to acquire a first face image and a second face image, wherein the first face image is an original face image that has not been processed, and the second face image is a face image that is a reference for changes in the first face image; A color space conversion module, used to determine the facial skin color area of the first facial image by using a skin color detection algorithm, and convert the color space of the facial skin color area of the first facial image; an image separation module, configured to separate the facial skin color region of the first facial image from the first facial image according to the facial skin color region of the first facial image after color space conversion and a preset color attribute range; An image synthesis module is used to extract the facial skin color value of the second facial image, adjust the skin color of the facial skin color area of the separated first facial image according to the facial skin color value, and synthesize the facial skin color area of the first facial image with the adjusted skin color with other areas in the separated first facial image to obtain a third facial image; the facial skin color value of the second facial image is extracted, and the facial skin color value of the facial skin color area of the separated first facial image is adjusted by changing the brightness, saturation or hue with reference to the facial skin color value of the second facial image, and the skin color adjustment is achieved by using color mapping, histogram equalization, and adjustment curve technology; A target image acquisition module, configured to obtain a target face image through a trained generative adversarial network according to the third face image and the second face image; The image synthesis module is also used to extract the facial skin color value of the second facial image through a color analysis tool; According to the facial skin color value, adjusting the color component of the facial skin color area of the first separated facial image to perform skin color adjustment; Acquire the facial skin color value in the second facial image through a color picker, adjust the color value of the facial skin color area of the separated first facial image to the facial skin color value of the second facial image, and when adjusting the facial skin color value, refer to the facial skin color value of the second facial image, and gradually adjust the value of each color component in the facial skin color area of the separated first facial image until a preset effect is achieved; By using an image reconstruction method, the facial skin color area of the first facial image with skin color adjustment is synthesized with other areas in the first facial image after separation to obtain a third facial image.
8. A facial image fusion device, characterized in that: The face image fusion device comprises: a memory and at least one processor, the memory stores instructions, and the memory and the at least one processor are interconnected via a line; The at least one processor calls the instruction in the memory so that the face image fusion device executes the face image fusion method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the face image fusion method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Face fusion model training method and device and electronic equipment
CN111598818A
Face skin sensitivity detection method, system, equipment and medium
CN116977464A