Artificial Intelligence-Based Image Generation Method, System, and Storage Medium

By calculating the face steering parameters and edge adjustments in image generation and selecting matching template images, the problem of low authenticity of image generation in the prior art is solved, and image generation with higher quality and authenticity is achieved.

CN118967881BActive Publication Date: 2025-08-01SHENZHEN LOCKTEVISION TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411005528.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2025-08-01
Estimated Expiration
2044-07-25

AI Technical Summary

Technical Problem

The prior art fails to effectively consider the matching between the template image and the target image when generating the image, resulting in low authenticity of the generated image.

Method used

By obtaining the facial key points of the target image, calculating the facial steering parameters, selecting the template image with the highest similarity, and generating a fusion image based on the key points and edge adjustments to ensure that facial features match.

Benefits of technology

Improve the quality and authenticity of image generation, reduce the need for facial feature adjustment, improve processing speed and naturalness of image generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118967881B_ABST
    Figure CN118967881B_ABST
Patent Text Reader

Abstract

The present invention belongs to the technical field of image processing, and discloses an image generation method, system and storage medium based on artificial intelligence. The method includes: extracting a first facial region of a target person from a target image, further obtaining first key points of the first facial region, calculating a first facial turning parameter of the target person based on the first key points, traversing a first storage module based on the first facial turning parameter to obtain a second facial turning parameter with the highest similarity to the first facial turning parameter, extracting a first template image corresponding to the second facial turning parameter from the first storage module based on the second facial turning parameter, obtaining a first side line of the target image, adjusting the first template image based on the first side line and the first key points to generate a second template image, and synthesizing the first facial region into the second template image to generate a fused image. The technical solution of the present invention can improve the quality of image generation and the authenticity of the image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image processing, and particularly relates to an image generation method, system and storage medium based on artificial intelligence. Background Art

[0002] With the continuous development of artificial intelligence technology, great progress has been made in image generation technology. However, how to more accurately achieve customized image generation and make the generated images more in line with user expectations is an urgent problem to be solved at present.

[0003] Similar prior arts include a Chinese patent application with publication number CN112116548A, which discloses a method and device for synthesizing face images. The method includes obtaining a user's real face image and a template face image, extracting basal face parameters from the template face image, and extracting actual face parameters from the real face image. Based on the basal face parameters and the actual face parameters, fusion face parameters are determined, and a fusion face image is determined according to the fusion face parameters. The fusion face image is added to the template face image to obtain a synthesized face image representing the user. There is also a Chinese patent application with publication number CN107451950A, which discloses a face image generation method, a face recognition model training method and corresponding devices. The method includes obtaining a face image with marked face key points, obtaining a hair image with marked hair key points, where the hair key points correspond to the face key points, and superimposing the hair part of the hair image on the face image based on the face key points and the hair key points to obtain a face composite image.

[0004] When generating images, the above-mentioned prior arts do not consider whether the selected template image matches the target image, and the authenticity of the generated images is not high. Therefore, it is an urgent problem to provide an image generation method, system and storage medium based on artificial intelligence to improve the quality and authenticity of the generated images. Summary of the Invention

[0005] In view of the above-mentioned technical problems, the present invention provides an image generation method, system and storage medium based on artificial intelligence.

[0006] In a first aspect, the present invention provides an image generation method based on artificial intelligence, the method comprising the following steps:

[0007] Step 1, obtain a target image, extract a first facial region of a target person from the target image, and further obtain first key points of the first facial region;

[0008] Step 2, calculate a first facial turning parameter of the target person based on the first key points;

[0009] Step 3: Traverse the first storage module based on the first facial turning parameter to obtain the second facial turning parameter with the highest similarity to the first facial turning parameter;

[0010] Step 4: Extract the first template image corresponding to the second facial turning parameter from the first storage module based on the second facial turning parameter;

[0011] Step 5: Extract the first side line of the target image, and adjust the first template image based on the first side line and the first key points to generate a second template image;

[0012] Step 6: Synthesize the first facial area into the second template image to generate a fused image.

[0013] Specifically, Step 2 includes:

[0014] Step 21: Obtain a standard 3D face image from the second storage module, and extract the third key points of the standard 3D face image;

[0015] Step 22: Adjust the coordinates of the third key points in the standard 3D face image based on the first key points to generate a new standard 3D face image;

[0016] Step 23: Calculate the first facial turning parameter based on the first key points and the new standard 3D face image.

[0017] Specifically, Step 22 includes:

[0018] Step 221: Calculate the eye width values of the two eyes in the target image respectively based on the coordinates of the eye key points in the first key points, where the eye key points include the inner eye corners and the outer eye corners;

[0019] Step 222: Compare the two eye width values, and define the inner eye corner of the eye corresponding to the larger eye width value as the reference point;

[0020] Step 223: Project the third key points onto the target image using the linear transformation method, and define the projection points as the projected key points;

[0021] Step 224: Calculate the first coordinate difference between the reference point and the first projected key point, and calculate the second coordinate difference between the first specific key point in the first key points and the second projected key point, then calculate the first relative difference between the first coordinate difference and the second coordinate difference, and adjust the coordinates of the second projected key point and the key point corresponding to the second projected key point in the third key points respectively based on the first relative difference, where the first projected key point is the projected key point corresponding to the reference point, and the second projected key point is the projected key point corresponding to the first specific key point in the projected key points;

[0022] Step 225: Calculate the third coordinate difference between the second specific key point and the third projected key point in the first key points, and calculate the fourth coordinate difference between the third specific key point and the fourth projected key point in the first key points. Subsequently, calculate the second relative difference between the third coordinate difference and the fourth coordinate difference, and adjust the coordinates of the key point corresponding to the fourth projected key point in the third key points based on the second relative difference, where the third projected key point is the projected key point corresponding to the second specific key point among the projected key points, and the fourth projected key point is the projected key point corresponding to the third specific key point among the projected key points.

[0023] Specifically, in step 5, the adjustment of the first template image based on the first edge line and the first key points includes:

[0024] Step 51: Extract the second facial region of the template person from the first template image, and further obtain the second key points of the second facial region;

[0025] Step 52: Determine the transformation matrix for mapping the first feature key points in the first facial region to the key points corresponding to the first feature key points in the second facial region, where the first feature key points are the facial feature key points;

[0026] Step 53: Extract N first edge line key points from the first edge line, map the N first edge line key points onto the first template image based on the transformation matrix to obtain N second edge line key points, draw the second edge line of the first template image based on the N second edge line key points, intercept the region enclosed by the second edge line in the first template image, and define it as the intermediate template image;

[0027] Step 54: Outline the first facial edge line of the target person based on the second feature key points in the first facial region, and define the region enclosed by the first facial edge line and the first edge line in the target image as the first region image, where the second feature key points are the facial contour key points;

[0028] Step 55: Obtain the third feature key points in the second facial region, outline the second facial edge line of the template person based on the third feature key points, and define the region enclosed by the second facial edge line and the second edge line in the intermediate template image as the second region image, where the third feature key points are the facial contour key points;

[0029] Step 56: Perform a deformation process on the second region image based on the first region image to register the second region image with the first region image, and define the intermediate template image after the deformation process as the second template image.

[0030] Specifically, step 6 includes:

[0031] Step 611: Outline the first facial contour of the target person based on the second characteristic key points in the first facial region, and extract the first facial image, where the first facial image is the region enclosed by the first facial contour, and the second characteristic key points are the key points of the facial contour;

[0032] Step 612: Set the pixel values of all pixel points inside the first facial contour in the target image to 0, and set the pixel values of all pixel points outside the first facial contour in the target image to 1 to generate a mask image;

[0033] Step 613: Multiply the corresponding pixel points of the second template image and the mask image to obtain a product image;

[0034] Step 614: Extract the image outside the facial region of the template person in the product image and define it as the third template image;

[0035] Step 615: Synthesize the first facial image and the third template image to generate a fused image.

[0036] Specifically, before step 6, perform tone adjustment on the first facial region, including the following steps:

[0037] Step 621: Divide the pixels in the first facial region into multiple functional regions based on pixel values, and divide the pixels representing the same organ into the same functional region;

[0038] Step 622: Obtain the first specific functional region and draw the first RGB color histogram of the first specific functional region;

[0039] Step 623: Extract the second facial region of the template person from the first template image, and according to the method of step 621, obtain the second specific functional region in the second facial region, and further draw the second RGB color histogram of the second specific functional region, where the first specific functional region and the second specific functional region are the same functional region;

[0040] Step 624: Use the second RGB color histogram to correct the first RGB color histogram to generate a new first facial region.

[0041] Specifically, when there are multiple template images corresponding to the second facial turning parameter, step 4 includes:

[0042] Step 41: Draw the fourth RGB color histogram of the first facial region;

[0043] Step 42: Extract any one of the template images, extract the third facial region of the template person from any one of the template images, and draw the third RGB color histogram of the third facial region;

[0044] Step 43: Calculate the color similarity between the fourth RGB color histogram and the third RGB color histogram;

[0045] Step 44: After traversing all the template images, define the template image corresponding to the maximum color similarity as the first template image.

[0046] In a second aspect, the present invention also provides an artificial intelligence-based image generation system, which includes: an image acquisition module, a face parameter extraction module, a template selection module, a template adjustment module, and an image fusion module;

[0047] The image acquisition module is used to acquire a target image, extract the first facial area of the target person from the target image, and further acquire the first key points of the first facial area.

[0048] The face parameter extraction module is used to calculate the first facial turning parameter of the target person according to the first key points.

[0049] The template selection module is used to traverse the first storage module according to the first facial turning parameter, obtain the second facial turning parameter with the highest similarity to the first facial turning parameter, and based on the second facial turning parameter, extract the first template image corresponding to the second facial turning parameter from the first storage module.

[0050] The template adjustment module is used to extract the first side line of the target image, and adjust the first template image based on the first side line and the first key points to generate a second template image.

[0051] The image fusion module is used to synthesize the first facial area into the second template image to generate a fused image.

[0052] In a third aspect, the present invention provides a computer storage medium, which stores program instructions. When the program instructions run, they control the device where the computer storage medium is located to execute the artificial intelligence-based image generation method described in any one of the above.

[0053] The present invention discloses an image generation method, system and storage medium based on artificial intelligence. After obtaining a target image, the first key points of the facial area of the target person are extracted, and the facial turning parameters of the target person are calculated based on the first key points. Based on the facial turning parameters, a template image with a high matching degree with the facial orientation of the target person in the target image is selected. Subsequently, there is no need to adjust the facial feature positions of the target person due to inconsistent facial turning parameters, which improves the processing speed and the naturalness of the generated image. Then, while maintaining the integrity of the first template image, specific areas are adjusted based on the contour edge line of the target image and the first key points of the target person's face to generate a second template image that matches the facial area of the target person, and the first facial area is synthesized into the second template image, which improves the quality and authenticity of the generated image while generating a customized image without damaging the facial features. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on the provided drawings without creative efforts.

[0055] Figure 1 It is a flowchart of the image generation method based on artificial intelligence of the present invention;

[0056] Figure 2 It is a modular schematic diagram of the image generation system based on artificial intelligence of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0057] In order to make the purpose, technical solutions and advantages of the present invention clearer, the following will further elaborate on the present invention in combination with the drawings and embodiments. Obviously, the specific embodiments described here are only used to explain the present invention, which are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.

[0058] It should be noted that if there are descriptions such as "first" and "second" in the embodiments of the present invention, the descriptions of "first", "second", etc. are only for descriptive purposes and should not be construed as indicating or implying their relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions between various embodiments can be combined with each other, but it must be based on the ability of those of ordinary skill in the art to implement. When the combination of technical solutions results in contradictions or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0059] Figure 1 The figure shows a flowchart of an embodiment of an image generation method based on artificial intelligence provided by the present invention, and the flowchart specifically includes the following steps:

[0060] Step 1: Obtain a target image, extract the first facial region of the target person from the target image, and further obtain the first key points of the first facial region.

[0061] The first key points refer to the points used to mark the key positions in the target face image. Identifying the first key points and obtaining the coordinates of these key points simultaneously, so as to determine the key positions in the target face image according to these coordinates to achieve operations such as face extraction, alignment, and projection.

[0062] The first key points include the key points indicating facial shape features and facial feature features. Exemplarily, the key points of facial feature features in the first key points include the inner corners and outer corners of both eyes, the eyebrows, the peaks, and the tails of both eyebrows, the tip of the nose, both nostrils, both corners of the mouth, and the midpoint of the lip bow; the key points of facial shape features are the key points on the facial contour, including the tip of the chin, etc.

[0063] Step 2: Calculate the first facial turning parameter of the target person based on the first key points.

[0064] When shooting the target image, the target person shot is not necessarily a standard frontal image. In order to select a template image suitable for the target person, the first facial turning parameter of the target person is calculated preferentially to determine the facial orientation of the target person.

[0065] Specifically, Step 2 includes:

[0066] Step 21: Obtain a standard three-dimensional face image from the second storage module and extract the third key points of the standard three-dimensional face image.

[0067] Step 22: Adjust the coordinates of the third key points in the standard three-dimensional face image based on the first key points to generate a new standard three-dimensional face image.

[0068] Step 23: Calculate the first facial turning parameter based on the first key points and the new standard 3D face image.

[0069] The above standard 3D face image is a pre-stored general 3D face image. Since there are individual differences in the facial features of each person, it is not accurate enough to calculate the first facial turning parameter using the standard 3D face image. Therefore, before calculating the facial turning parameter, the standard 3D face image is adjusted based on the facial features of the target person in the target image. The calculation of the facial turning parameter can be achieved through existing technologies and will not be elaborated here.

[0070] Specifically, Step 22 includes:

[0071] Step 221: Based on the coordinates of the eye key points in the first key points, calculate the eye width values of the two eyes in the target image respectively, where the eye key points include the inner eye corners and the outer eye corners.

[0072] Step 222: Compare the two eye width values, and define the inner eye corner of the eye corresponding to the larger eye width value as the reference point.

[0073] Step 223: Project the third key point onto the target image using the linear transformation method, and define the projection point as the projected key point.

[0074] Step 224: Calculate the first coordinate difference between the reference point and the first projected key point, and calculate the second coordinate difference between the first specific key point and the second projected key point in the first key points. Then calculate the first relative difference between the first coordinate difference and the second coordinate difference. Based on the first relative difference, adjust the coordinates of the second projected key point and the key point corresponding to the second projected key point in the third key points, where the first projected key point is the projected key point corresponding to the reference point, and the second projected key point is the projected key point corresponding to the first specific key point in the projected key points.

[0075] Step 225: Calculate the third coordinate difference between the second specific key point and the third projected key point in the first key points, and calculate the fourth coordinate difference between the third specific key point and the fourth projected key point in the first key points. Then calculate the second relative difference between the third coordinate difference and the fourth coordinate difference. Based on the second relative difference, adjust the coordinates of the key point corresponding to the fourth projected key point in the third key points, where the third projected key point is the projected key point corresponding to the second specific key point in the projected key points, and the fourth projected key point is the projected key point corresponding to the third specific key point in the projected key points.

[0076] When adjusting the standard 3D face image, first roughly estimate the target face orientation based on the eye width, and define the inner eye corner on the other side of the face as the reference point, which can improve the adjustment accuracy of the standard 3D face image.

[0077] The third key points are perspective-projected onto the face image (i.e., the first facial region) of the target image by the Direct Linear Transform (DLT) method to obtain the projected key points corresponding to each third key point. After obtaining the projected key points, the coordinates of the third key points corresponding to the projected key points are adjusted according to the coordinate change amount (vector) between the projected key points and the corresponding first key points.

[0078] Preferably, the first specific key point is any one of the tip of the nose, the outer corner of the left eye, or the left nostril, and the second projected key point is the projected key point corresponding to any one of the tip of the nose, the outer corner of the left eye, or the left nostril among the third key points that corresponds to the first feature key point.

[0079] Exemplarily, when the reference point is the inner corner of the left eye, the first projected key point is the projected key point corresponding to the inner corner of the left eye among the third key points, the second specific key point is the tip of the nose, and the second projected key point is the projected key point corresponding to the tip of the nose among the third key points. When the second coordinate difference is greater than the first coordinate difference, it indicates that the height of the tip of the nose in the standard three-dimensional face image is lower than the height of the tip of the nose in the target face image. Then, based on the first relative difference, the tip of the nose in the standard three-dimensional face image is raised. When the second coordinate difference is less than the first coordinate difference, it indicates that the height of the tip of the nose in the standard three-dimensional face image is higher than the height of the tip of the nose in the target face image. Then, based on the first relative difference, the tip of the nose in the standard three-dimensional face image is lowered.

[0080] Preferably, the second specific key points are the tip of the nose, the midpoint of the lip bow, the tip of the chin, etc., and the third specific key points are the bilateral nostrils, the bilateral corners of the mouth, etc.

[0081] According to the technical solution of the present invention, the standard three-dimensional face image can be adjusted according to the facial features of the target face, so that the adjusted standard three-dimensional face image is close to the facial features of the target person, and further improves the calculation accuracy and accuracy of the first facial turning parameter.

[0082] Step 3: Traverse the first storage module based on the first facial turning parameter to obtain the second facial turning parameter with the highest similarity to the first facial turning parameter.

[0083] Calculate the Euclidean distance between the first facial turning parameter and any facial turning parameter. The smaller the Euclidean distance, the greater the similarity. Define the facial turning parameter with the highest similarity as the second facial turning parameter.

[0084] Step 4: Extract the first template image corresponding to the second facial turning parameter from the first storage module based on the second facial turning parameter.

[0085] The first storage module stores a template image and facial turning parameters corresponding to the template person in the template image. By selecting the template image corresponding to the second facial turning parameters based on the first facial turning parameters, a template image with a high matching degree to the facial orientation of the target person in the target image can be obtained, preventing the face image of the target person with a frontal facial orientation from being synthesized into the template image with a lateral facial orientation, or the face image of the target person with a lateral facial orientation from being synthesized into the template image with a frontal facial orientation, making the finally generated fused image more natural, realistic, and without distortion.

[0086] Specifically, when there are multiple template images corresponding to the second facial turning parameters, step 4 includes:

[0087] Step 41, draw the fourth RGB color histogram of the first facial region.

[0088] Step 42, extract any template image, extract the third facial region of the template person from any template image, and draw the third RGB color histogram of the third facial region.

[0089] Step 43, calculate the color similarity between the fourth RGB color histogram and the third RGB color histogram.

[0090] After traversing all the template images, define the template image corresponding to the maximum color similarity as the first template image.

[0091] When there are multiple optional template images, select the template image that is closest to the facial skin color of the target person in the target image, so that the skin color of the facial region in the finally fused image is more unified with the skin color of other regions, the overall tone of the image is more coordinated, and there is no sense of disharmony.

[0092] Step 5, extract the first edge line of the target image, and adjust the first template image based on the first edge line and the first key points to generate a second template image.

[0093] Specifically, in step 5, adjusting the first template image based on the first edge line and the first key points includes:

[0094] Step 51, extract the second facial region of the template person from the first template image, and further obtain the second key points of the second facial region.

[0095] Step 52, determine the transformation matrix that maps the first feature key points in the first facial region to the key points corresponding to the first feature key points in the second facial region, where the first feature key points are the key points of the facial features.

[0096] Step 53: Extract N first edge key points from the first edge. Based on the transformation matrix, map the N first edge key points onto the first template image to obtain N second edge key points. Draw the second edge of the first template image based on the N second edge key points, and intercept the area enclosed by the second edge in the first template image, which is defined as the intermediate template image.

[0097] Step 54: Outline the first facial edge of the target person based on the second feature key points in the first facial area, and define the area enclosed by the first facial edge and the first edge in the target image as the first area image, where the second feature key points are facial contour key points.

[0098] Step 55: Obtain the third feature key points in the second facial area. Outline the second facial edge of the template person based on the third feature key points, and define the area enclosed by the second facial edge and the second edge in the intermediate template image as the second area image, where the third feature key points are facial contour key points.

[0099] Step 56: Perform a deformation process on the second area image based on the first area image to register the second area image with the first area image, and define the intermediate template image after the deformation process as the second template image.

[0100] The second key points are the same as the first key points, including the key points indicating facial shape features and facial feature features.

[0101] Preferably, by comparing the coordinates of the first feature key points with the coordinates of the key points corresponding to the first feature key points in the second facial area, the transformation matrix is obtained using the least squares method, so that the coordinates of the first feature key points of the target person's face mapped by the above transformation matrix are as close as possible to the coordinates of the key points corresponding to the first feature key points on the template person's face.

[0102] The value of N is set according to the experience of those skilled in the art or according to the actual application scenario, and the embodiments of the present application do not limit this. The above first edge is the contour line of the target image. The first edge key points extracted from the first edge are preferably the 4 vertices on the first edge and the midpoints of each side (in this case, N takes the value of 8).

[0103] Based on the transformation matrix, map the first edge key points onto the first template image, and then obtain the second edge, and intercept the area enclosed by the second edge in the first template image, so as to obtain the image area corresponding to the whole target image in the first template image.

[0104] Preferably, the first facial boundary line is the contour line of the closed area (facial area) formed by connecting the second feature key point and the brow peak key point in the first key points, and the first area image is the image outside the facial area in the target image; the second facial boundary line is the contour line of the closed area (facial area) formed by connecting the third feature key point and the brow peak key point in the second facial area, and the second facial area is the image outside the facial area in the intermediate template image.

[0105] Preferably, the thin plate spline method is used to adjust the contour of the second area image so that the contour of the second area image is similar to or consistent with the contour of the first area image, that is, the facial area contour of the template person in the intermediate template image is similar to or consistent with the facial area contour of the target person in the target image.

[0106] According to the technical solution of the present invention, the template image is adjusted so that the facial area of the template person in the template image matches the facial area of the target person in the target image, and the two can be perfectly fused without adjusting the facial features of the target person, without damaging the facial features of the target person, and improving the quality and authenticity of the fused image.

[0107] Step 6: Synthesize the first facial area into the second template image to generate a fused image.

[0108] Specifically, step 6 includes:

[0109] Step 611: Outline the first facial boundary line of the target person based on the second feature key point in the first facial area, and extract the first facial image, where the first facial image is the area surrounded by the first facial boundary line, and the second feature key point is the facial contour key point.

[0110] Step 612: Set the pixel values of all pixel points inside the first facial boundary line in the target image to 0, and set the pixel values of all pixel points outside the first facial boundary line in the target image to 1 to generate a mask image.

[0111] Step 613: Multiply the corresponding pixel points of the second template image and the mask image to obtain a product image.

[0112] Step 614: Extract the image outside the facial area of the template person in the product image and define it as the third template image.

[0113] Step 615: Synthesize the first facial image and the third template image to generate a fused image.

[0114] The second template image obtained after adjustment, where the facial region of the template person matches the facial region of the target person in the target image. By using the mask image generated based on the first facial contour, the non-facial region image (i.e., the third template image) that matches the first facial image can be extracted.

[0115] After synthesizing the first facial image onto the third template image, perform a transition process on the splicing area of the two images to make the edge more natural and realistic.

[0116] Specifically, before step 6, perform tone adjustment on the first facial region, including the following steps:

[0117] Step 621: Divide the pixels in the first facial region into multiple functional regions based on pixel values, and divide the pixels representing the same organ into the same functional region.

[0118] Step 622: Obtain the first specific functional region and draw the first RGB color histogram of the first specific functional region.

[0119] Step 623: Extract the second facial region of the template person from the first template image. According to the method of step 621, obtain the second specific functional region in the second facial region, and further draw the second RGB color histogram of the second specific functional region, where the first specific functional region and the second specific functional region are the same functional region.

[0120] Step 624: Use the second RGB color histogram to correct the first RGB color histogram to generate a new first facial region.

[0121] Exemplarily, the multiple functional regions in the first facial region are eyebrows, eyes, lips, and facial skin.

[0122] Preferably, the first specific functional region and the second specific functional region are facial skin. Before image synthesis, calibrate the tone of the facial skin of the target person in the target image according to the tone of the facial skin of the template person in the template image, so that the skin color of the facial region in the final fused image is the same as or similar to the skin color of the facial region of the template person, making the overall tone of the image more coordinated.

[0123] Figure 2 Shown is a schematic structural diagram of an embodiment of an image generation system based on artificial intelligence provided by the present invention. As Figure 2 Shown, the system includes: an image acquisition module 101, a face parameter extraction module 102, a template selection module 103, a template adjustment module 104, and an image fusion module 105.

[0124] The image acquisition module 101 is configured to acquire a target image, extract a first facial region of a target person from the target image, and further acquire first key points of the first facial region.

[0125] The face parameter extraction module 102 is configured to calculate a first facial turning parameter of the target person according to the first key points.

[0126] The template selection module 103 is configured to traverse a first storage module according to the first facial turning parameter, acquire a second facial turning parameter with the highest similarity to the first facial turning parameter, and extract a first template image corresponding to the second facial turning parameter from the first storage module based on the second facial turning parameter.

[0127] The template adjustment module 104 is configured to extract a first side line of the target image, and adjust the first template image based on the first side line and the first key points to generate a second template image.

[0128] The image fusion module 105 is configured to synthesize the first facial region into the second template image to generate a fused image.

[0129] According to another aspect of the embodiments of the present invention, there is provided a computer storage medium storing program instructions, wherein when the program instructions run, they control a device where the computer storage medium is located to execute the artificial intelligence-based image generation method according to any one of the above.

[0130] It should be understood that although the steps in the flowcharts of the embodiments of the present invention are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise clearly stated in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in each embodiment may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least a part of other steps or sub-steps or stages of other steps.

[0131] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The above program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided in the present application can include non-volatile and / or volatile memories. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.

[0132] The above embodiments only express the preferred implementation modes of the present invention. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the patent of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can still be made, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention should be subject to the appended claims.

Claims

1. An image generation method based on artificial intelligence, characterized in that, Including: Step 1: Obtain a target image, extract the first facial region of the target person from the target image, and obtain the first key points of the first facial region, including the key points indicating facial shape features and facial feature features; Step 2: Calculate the first facial turning parameter of the target person based on the first key points; Step 3: Traverse the first storage module based on the first facial turning parameter to obtain the second facial turning parameter with the highest similarity to the first facial turning parameter; Step 4: Based on the second facial turning parameter, extract the first template image corresponding to the second facial turning parameter from the first storage module; Step 5: Extract the first border line of the target image, and adjust the first template image based on the first border line and the first key points to generate a second template image; including extracting the second facial region of the template person from the first template image and obtaining the second key points of the second facial region; determining the transformation matrix for mapping the first feature key points in the first facial region to the key points corresponding to the first feature key points in the second facial region, where the first feature key points are facial feature key points; Extract N first border line key points from the first border line, map the N first border line key points onto the first template image based on the transformation matrix to obtain N second border line key points, draw the second border line of the first template image based on the N second border line key points, intercept the region enclosed by the second border line in the first template image, and define it as the intermediate template image; Outline the first facial border line of the target person based on the second feature key points in the first facial region, and define the region enclosed by the first facial border line and the first border line in the target image as the first region image, where the second feature key points are facial contour key points; Obtain the third feature key points in the second facial region, outline the second facial border line of the template person based on the third feature key points, and define the region enclosed by the second facial border line and the second border line in the intermediate template image as the second region image, where the third feature key points are facial contour key points; Perform a deformation process on the second region image based on the first region image to register the second region image with the first region image, and define the intermediate template image after the deformation process as the second template image; Step 6: Synthesize the first facial region into the second template image to generate a fused image.

2. The method according to claim 1, wherein Step 2 includes: Step 21: Obtain a standard 3D face image from the second storage module and extract the third key points of the standard 3D face image; Step 22: Adjust the coordinates of the third key points in the standard 3D face image based on the first key points to generate a new standard 3D face image; Step 23: Calculate the first facial turning parameter based on the first key points and the new standard 3D face image.

3. The method according to claim 2, wherein Step 22 includes: Step 221: Based on the coordinates of the eye key points in the first key points, calculate the eye width values of the two eyes in the target image respectively, where the eye key points include the inner eye corner and the outer eye corner; Step 222: Compare the two eye width values, and define the inner eye corner of the eye corresponding to the larger eye width value as the reference point; Step 223: Project the third key points onto the target image using the linear transformation method, and define the projection points as the projection key points; Step 224: Calculate the first coordinate difference between the reference point and the first projected key point, and calculate the second coordinate difference between the first specific key point and the second projected key point among the first key points. Subsequently, calculate the first relative difference between the first coordinate difference and the second coordinate difference, and based on the first relative difference, adjust the coordinates of the key point corresponding to the second projected key point in the second projected key point and the third key point. The first projected key point is the projected key point corresponding to the reference point among the projected key points, and the second projected key point is the projected key point corresponding to the first specific key point among the projected key points; Step 225: Calculate the third coordinate difference between the second specific key point and the third projected key point among the first key points, and calculate the fourth coordinate difference between the third specific key point and the fourth projected key point among the first key points. Subsequently, calculate the second relative difference between the third coordinate difference and the fourth coordinate difference, and based on the second relative difference, adjust the coordinates of the key point corresponding to the fourth projected key point in the third key point. The third projected key point is the projected key point corresponding to the second specific key point among the projected key points, and the fourth projected key point is the projected key point corresponding to the third specific key point among the projected key points.

4. The method according to claim 3, characterized in that, Step 6 includes: Step 611: Outline the first facial contour of the target person based on the second feature key points in the first facial area, and extract the first facial image. The first facial image is the area enclosed by the first facial contour, and the second feature key points are the facial contour key points; Step 612: Set the pixel values of all pixel points inside the first facial contour in the target image to 0, and set the pixel values of all pixel points outside the first facial contour in the target image to 1 to generate a mask image; Step 613: Multiply the corresponding pixel points of the second template image and the mask image to obtain a product image; Step 614: Extract the image outside the facial area of the template person in the product image and define it as the third template image; Step 615: Synthesize the first facial image and the third template image to generate a fused image.

5. The method according to claim 4, characterized in that Before Step 6, perform hue adjustment on the first facial area, including the following steps: Step 621: Divide the pixels in the first facial area into multiple functional areas based on pixel values, and divide the pixels representing the same organ into the same functional area; Step 622: Obtain the first specific functional area and draw the first RGB color histogram of the first specific functional area; Step 623: Extract the second facial area of the template person from the first template image. According to the method in Step 621, obtain the second specific functional area in the second facial area and draw the second RGB color histogram of the second specific functional area. The first specific functional area and the second specific functional area are the same functional area; Step 624: Use the second RGB color histogram to correct the first RGB color histogram to generate a new first facial area.

6. The method according to claim 5, characterized in that, When there are multiple template images corresponding to the second facial turning parameter, Step 4 includes: Step 41: Draw the fourth RGB color histogram of the first facial area; Step 42: Extract any template image, extract the third facial region of the template person from the any template image, and draw the third RGB color histogram of the third facial region; Step 43: Calculate the color similarity between the fourth RGB color histogram and the third RGB color histogram; Step 44: After traversing all the template images, define the template image corresponding to the maximum color similarity as the first template image.

7. An artificial intelligence-based image generation system for implementing the method according to any one of claims 1 to 6, characterized in that, Including: An image acquisition module, a face parameter extraction module, a template selection module, a template adjustment module, and an image fusion module; The image acquisition module is configured to acquire a target image, extract the first facial region of the target person from the target image, and acquire the first key points of the first facial region; The face parameter extraction module is configured to calculate the first facial turning parameter of the target person according to the first key points; The template selection module is configured to traverse the first storage module according to the first facial turning parameter, acquire the second facial turning parameter with the highest similarity to the first facial turning parameter, and extract the first template image corresponding to the second facial turning parameter from the first storage module based on the second facial turning parameter; The template adjustment module is configured to extract the first border line of the target image, and adjust the first template image based on the first border line and the first key points to generate a second template image; The image fusion module is configured to synthesize the first facial region into the second template image to generate a fused image.

8. A computer storage medium, characterized in that, The computer storage medium stores program instructions, which control the device where the computer storage medium is located to execute the method according to any one of claims 1 to 6 when the program instructions are running.

Citation Information

Patent Citations

  • Face image generation method, face recognition model training method and corresponding apparatuses

    CN107451950A

  • Face image synthesis method and device

    CN112116548A

  • Image fusion method and device and computer storage medium

    CN108876718A

  • Glasses-wearing face image sample processing method and device, equipment and medium

    CN116740778A