Image stylization processing method, system, terminal device and storage medium

By normalizing the target style image and image transformation, combined with histogram matching of Gaussian differential graphs, output style images are generated, which solves the problem that the stylized image face is much different from the person in the existing technology, and improves the accuracy of image stylization.

CN114004739BActive Publication Date: 2025-03-28XIAMEN MEITUZHIJIA TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111316004.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-08
Publication Date
2025-03-28
Estimated Expiration
2041-11-08

AI Technical Summary

Technical Problem

In the existing image stylization process, the stylized image face is much different from the person, resulting in low accuracy of image stylization.

Method used

By normalizing the target style image, a first position guide map is generated; the point correspondence between the target style image and the image to be stylized is obtained, and image transformation is performed to obtain the second position guide map; the Gaussian difference map of the to stylized is obtained and the target style image is obtained, and the second appearance guide map is obtained through the style coordinate query.

Benefits of technology

There is no need to stylize images based on generative adversarial networks, which prevents the stylized image face from being different from the person, and improves the accuracy of image stylization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114004739B_ABST
    Figure CN114004739B_ABST
Patent Text Reader

Abstract

The present invention provides an image stylization processing method, system, terminal device and storage medium, the method comprising: generating a first position guide map according to the normalization result of a target style image; performing image transformation on the first position guide map according to the point correspondence between the target style image and the image to be stylized to obtain a second position guide map; performing histogram matching according to the first appearance guide map, the Gaussian difference map of the image to be stylized and the target style image to obtain a second appearance guide map; performing style coordinate query according to the first position guide map, the second position guide map, the first position guide map and the second position guide map to obtain an output style image. The present invention performs style coordinate query through the first position guide map, the second position guide map, the first position guide map and the second position guide map to obtain an output style image corresponding to the image to be stylized, without the need to perform image stylization based on a generative adversarial network, thereby improving the accuracy of image stylization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to an image stylization processing method, system, terminal device and storage medium. Background Art

[0002] In real-life applications, there are many different imaging modes and corresponding style images for different purposes. However, in order to meet certain image application requirements or user usage requirements, images need to be style-converted. That is, using image stylization processing technology, users can convert real images into images of specified styles by specifying the target style.

[0003] In the existing image stylization processing process, image stylization is performed based on the generative adversarial network method. However, the existing generative adversarial network training process requires a large amount of paired training data, which is difficult to obtain and has a high cost. In addition, the existing pictures generated based on unpaired training data are often easy to change the user's facial features, making the face of the image stylized based on the generative adversarial network very different from the person himself, reducing the accuracy of image stylization. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide an image stylization processing method, system, terminal device and storage medium, aiming to solve the problem of low image stylization accuracy caused by the large difference between the stylized image face and the original face in the existing image stylization processing process.

[0005] The embodiment of the present invention is implemented as follows: a method for image stylization processing, the method comprising:

[0006] Normalizing the target style image, and generating a first position guide map according to the normalization result;

[0007] Acquire a point correspondence relationship between the target style image and the image to be stylized, and perform image transformation on the first position guidance map according to the point correspondence relationship to obtain a second position guidance map;

[0008] Obtaining Gaussian difference maps of the image to be stylized and the target style image respectively, and obtaining an appearance guidance map of the target style image to obtain a first appearance guidance map;

[0009] Performing histogram matching according to the first appearance guide map, the image to be stylized, and the Gaussian difference map of the target style image to obtain a second appearance guide map;

[0010] A style coordinate query is performed according to the first position guide map, the second position guide map, the first appearance guide map, and the second appearance guide map to obtain an output style image.

[0011] Furthermore, generating a first position guide map according to the normalization result includes:

[0012] According to the normalization result, the normalized x-coordinate of each pixel position coordinate in the target style image is determined as the red channel of the position guidance map, the normalized y-coordinate is determined as the green channel, and the blue channel is set to zero to obtain the first position guidance map.

[0013] Furthermore, the obtaining of Gaussian difference images of the image to be stylized and the target style image respectively includes:

[0014] Performing grayscale processing on the image to be stylized and the target style image respectively to obtain a first grayscale image and a second grayscale image;

[0015] Performing Gaussian blur on the first grayscale image and the second grayscale image respectively to obtain a first Gaussian blurred image and a second Gaussian blurred image;

[0016] The difference between the first Gaussian blur image and the first grayscale image is obtained to obtain a first Gaussian difference image, and the difference between the second Gaussian blur image and the second grayscale image is obtained to obtain a second Gaussian difference image.

[0017] Furthermore, performing histogram matching on the first appearance guide map, the image to be stylized, and the Gaussian difference map of the target style image to obtain a second appearance guide map includes:

[0018] Using the first Gaussian difference map as a template, the second Gaussian difference map is used to determine a guide map transformation matrix between the image to be stylized and the target style image;

[0019] The first appearance guidance map is subjected to matrix transformation according to the determined guidance map transformation matrix to obtain the second appearance guidance map.

[0020] Furthermore, performing style coordinate query according to the first position guide map, the second position guide map, the first appearance guide map, and the second appearance guide map to obtain an output style image includes:

[0021] The first position guide map, the second position guide map, the first position guide map and the second position guide map are matched with a pre-stored style coordinate query table, and the output style image is generated according to the matched coordinates.

[0022] Furthermore, the method further comprises:

[0023] A position search is performed according to the target style image, the first position guide map, the first appearance guide map and a preset query radius, and the style coordinate query table is generated according to the position search result.

[0024] Furthermore, the obtaining of the point correspondence between the target style image and the image to be stylized includes:

[0025] Performing face point detection on the target style image and the image to be stylized respectively to obtain a first face point set and a second face point set;

[0026] Fitting the first face point set and the second face point set to obtain the point correspondence relationship.

[0027] Another object of an embodiment of the present invention is to provide an image stylization processing system, the system comprising:

[0028] A normalization module, used to normalize the target style image and generate a first position guide map according to the normalization result;

[0029] An image transformation module, used to obtain a point correspondence relationship between the target style image and the image to be stylized, and perform image transformation on the first position guidance map according to the point correspondence relationship to obtain a second position guidance map;

[0030] A difference map acquisition module, used to respectively acquire Gaussian difference maps of the image to be stylized and the target style image, and acquire an appearance guidance map of the target style image to obtain a first appearance guidance map;

[0031] a histogram matching module, configured to perform histogram matching on the first appearance guide map, the image to be stylized, and the Gaussian difference map of the target style image to obtain a second appearance guide map;

[0032] A coordinate query module is used to perform style coordinate query according to the first position guide map, the second position guide map, the first appearance guide map and the second appearance guide map to obtain an output style image.

[0033] Another object of an embodiment of the present invention is to provide a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0034] Another object of an embodiment of the present invention is to provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0035] In the embodiment of the present invention, by normalizing the target style image, a first position guide map corresponding to the target style image can be effectively generated based on the normalization result; by obtaining the point correspondence between the target style image and the image to be stylized, image transformation is performed on the first position guide map based on the point correspondence, so as to effectively obtain the second position guide map corresponding to the image to be stylized; by performing histogram matching on the first appearance guide map, the image to be stylized and the Gaussian difference map of the target style image, the second appearance guide map corresponding to the image to be stylized can be effectively obtained; by performing style coordinate query on the first position guide map, the second position guide map, the first position guide map and the second position guide map, the output style image of the image to be stylized under the style corresponding to the target style image can be obtained; the embodiment of the present invention does not need to perform image stylization based on a generative adversarial network, thus preventing the phenomenon that the face of the stylized image is greatly different from the person himself, and improving the accuracy of image stylization. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 is a flowchart of an image stylization processing method provided by a first embodiment of the present invention;

[0037] Figure 2 is a flowchart of an image stylization processing method provided by a second embodiment of the present invention;

[0038] Figure 3 is a schematic diagram of the structure of an image stylization processing system provided by a third embodiment of the present invention;

[0039] Figure 4 It is a schematic diagram of the structure of a terminal device provided in the fourth embodiment of the present invention. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0041] In order to illustrate the technical solution of the present invention, a specific embodiment is provided below for illustration.

[0042] Embodiment 1

[0043] See also Figure 1 , is a flowchart of an image stylization processing method provided by the first embodiment of the present invention. The image stylization processing method can be applied to any terminal device. The image stylization processing method includes the steps of:

[0044] Step S10, normalizing the target style image, and generating a first position guide map according to the normalization result;

[0045] The target style image can be set and selected according to the requirements. The target style image is the image style currently selected by the user, that is, the user hopes to convert the image to be stylized into the style of the target style image. In this step, the maximum and minimum normalization algorithm can be used to calculate the pixel value of each pixel in the target style image to obtain the normalization result;

[0046] Optionally, generating a first position guide map according to the normalization result includes:

[0047] According to the normalization result, the normalized x-coordinate of each pixel position coordinate in the target style image is determined as the red channel of the position guidance map, the normalized y-coordinate is determined as the green channel, and the blue channel is set to zero, so as to obtain the first position guidance map;

[0048] Among them, assuming that the width and height of the target style image are w and h respectively, then the first position guide image First position guide map The x and y in the figure are the horizontal and vertical coordinates of each pixel in the target style image after normalization.

[0049] Step S20, obtaining a point correspondence relationship between the target style image and the image to be stylized, and performing image transformation on the first position guidance map according to the point correspondence relationship to obtain a second position guidance map;

[0050] Among them, the point correspondence is used to characterize the mapping relationship or fitting relationship between the key points of the target style image and the image to be stylized. The key point can be a facial key point or a skeleton key point. For example, when the image to be stylized is a facial image, that is, when the user needs to stylize the face in the stylized image, then the key point is a facial key point. When the image to be stylized is a body image, that is, when the user needs to stylize the body in the stylized image, then the key point is a skeleton key point.

[0051] Optionally, in this step, obtaining the point correspondence between the target style image and the image to be stylized includes:

[0052] Performing face point detection on the target style image and the image to be stylized respectively to obtain a first face point set and a second face point set;

[0053] Among them, by performing face point detection on the target style image and the image to be stylized respectively, the coordinate sets of face points in the target style image and the image to be stylized can be effectively extracted to obtain the first face point set and the second face point set;

[0054] The first face point set and the second face point set are fitted to obtain the point correspondence relationship, wherein, by fitting the first face point set and the second face point set, the point correspondence relationship of the face points between the target style image and the image to be stylized can be effectively obtained.

[0055] Step S30, respectively obtaining Gaussian difference maps of the image to be stylized and the target style image, and obtaining an appearance guidance map of the target style image to obtain a first appearance guidance map;

[0056] The Gaussian difference map is used to represent the difference in pixel values ​​between the corresponding image after Gaussian blurring and the original image. In this step, the first appearance guidance map is obtained by obtaining the image identifier of the target style image and matching the image identifier of the target style image with the pre-stored guidance map query table. The guide map query table stores the correspondence between different image identifiers and corresponding appearance guide maps.

[0057] Step S40, performing histogram matching according to the first appearance guide map, the image to be stylized and the Gaussian difference map of the target style image to obtain a second appearance guide map;

[0058] The histogram matching is used to determine the first appearance guide map and the second appearance guide map according to the corresponding relationship between the Gaussian difference map between the image to be stylized and the target style image. The guide map correspondence relationship between the two is determined, and the first appearance guide map is transformed based on the determined guide map correspondence relationship to obtain a second appearance guide map.

[0059] Step S50, performing style coordinate query according to the first position guide map, the second position guide map, the first appearance guide map, and the second appearance guide map to obtain an output style image;

[0060] Among them, through the first position guide map and the second position guide map The first position guide map and the second position guide map perform style coordinate query to obtain an output style image of the image to be stylized under the style corresponding to the target style image. This embodiment does not need to use a generative adversarial network for image stylization, which prevents the phenomenon of large errors in facial images caused by using a generative adversarial network for image stylization. This embodiment can well preserve the facial features, so that the stylized face still looks like the original.

[0061] Optionally, in this step, performing a style coordinate query according to the first position guide map, the second position guide map, the first appearance guide map, and the second appearance guide map to obtain an output style image includes:

[0062] The first position guide map, the second position guide map, the first position guide map and the second position guide map are matched with a pre-stored style coordinate query table, and the output style image is generated according to the matched coordinates, wherein the style coordinate query table stores the correspondence between different first position guide maps, second position guide maps, first position guide maps, second position guide maps and corresponding output style images.

[0063] Furthermore, the method further includes: performing a position search according to the target style image, the first position guide map, the first appearance guide map and a preset query radius, and generating a style coordinate query table according to the position search results, wherein the method used for performing the position search according to the target style image, the first position guide map, the first appearance guide map and the preset query radius is:

[0064] for x=0 to 256: / / pos red

[0065] for y=0 to 255: / / pos green

[0066] for z=0 to 255: / / app gray

[0067]

[0068]

[0069]

[0070] LUT is a style coordinate lookup table.

[0071] Furthermore, after obtaining the stylized output style image transferred from the target style map, if only the face area of ​​the image to be stylized needs to be stylized, the face mask in the image to be stylized can be obtained based on any face segmentation algorithm to limit the stylized area.

[0072] Specifically, in this embodiment, the target style image S is input, and the image to be stylized T S , the first position guide map First appearance guide map Second position guide map And the second appearance guide map The style coordinate lookup table LUT generated in advance, threshold t;

[0073] Output: stylized output style image T S

[0074] for each pixel p∈T S :

[0075] if T S [p] is empty:

[0076]

[0077] for each pixel q∈S:

[0078] if T S [p+qu * ]is empty:

[0079]

[0080] if e <t:

[0081] T S [p+qu * ]=S[q]

[0082] At this point, the stylized output style image transferred from the target style image S can be obtained.

[0083] In this embodiment, by normalizing the target style image, a first position guide map corresponding to the target style image can be effectively generated based on the normalization result, by obtaining the point correspondence between the target style image and the image to be stylized, and performing image transformation on the first position guide map based on the point correspondence, the second position guide map corresponding to the image to be stylized can be effectively obtained, and by performing histogram matching on the first appearance guide map, the image to be stylized and the Gaussian difference map of the target style image, the second appearance guide map corresponding to the image to be stylized can be effectively obtained, and by performing style coordinate query on the first position guide map, the second position guide map, the first position guide map and the second position guide map, the output style image of the image to be stylized under the style corresponding to the target style image can be obtained. The embodiment of the present invention does not need to perform image stylization based on a generative adversarial network, which prevents the phenomenon that the face of the stylized image is greatly different from the person himself, and improves the accuracy of image stylization.

[0084] Embodiment 2

[0085] See also Figure 2 , is a flow chart of an image stylization processing method provided by a second embodiment of the present invention, and this embodiment is used to further refine step S30, including the steps of:

[0086] Step S31, performing grayscale processing on the image to be stylized and the target style image respectively to obtain a first grayscale image and a second grayscale image;

[0087] Among them, grayscale processing is the process of converting a color image into a grayscale image. The color image is divided into three components, R, G, and B, which respectively show various colors such as red, green, and blue. Grayscale processing is the process of making the R, G, and B components of the color equal. In this step, there are three ways to grayscale the stylized image and the target style image:

[0088] 1) Maximum value method: Make the converted R, G, B values ​​equal to the maximum value of the three values ​​before conversion, that is:

[0089] R = G = B = max (R, G, B)

[0090] Among them, the grayscale image converted by this method has higher brightness.

[0091] 2) Average value method: Make the values ​​of R, G, and B after conversion equal to the average values ​​of R, G, and B before conversion, that is:

[0092] R=G=B=(R+G+B) / 3

[0093] Among them, the grayscale image converted by this method is softer.

[0094] 3) Weighted average method: according to certain weights, the values ​​of R, G, and B are weighted averaged.

[0095] Step S32, performing Gaussian blur on the first grayscale image and the second grayscale image respectively to obtain a first Gaussian blurred image and a second Gaussian blurred image;

[0096] The Gaussian blur is used to set the pixel value of each pixel in the first grayscale image and the second grayscale image to the average value of its surrounding pixels, so as to obtain the first Gaussian blur image and the second Gaussian blur image.

[0097] Step S33, obtaining a difference between the first Gaussian blur image and the first grayscale image to obtain a first Gaussian difference image, and obtaining a difference between the second Gaussian blur image and the second grayscale image to obtain a second Gaussian difference image;

[0098] The first Gaussian difference image is obtained by performing a difference calculation on the first Gaussian blur image and the first grayscale image, and the second Gaussian difference image is obtained by performing a difference calculation on the second Gaussian blur image and the second grayscale image.

[0099] Optionally, in this step, for step S40, performing histogram matching according to the first appearance guidance map, the image to be stylized, and the Gaussian difference map of the target style image to obtain the second appearance guidance map includes:

[0100] Using the first Gaussian difference map as a template, the second Gaussian difference map is used to determine a guide map transformation matrix between the image to be stylized and the target style image;

[0101] Performing a matrix transformation on the first appearance guidance map according to the determined guidance map transformation matrix to obtain the second appearance guidance map;

[0102] Among them, let the histogram of the first appearance guide map be The probability density function of the gray level is The cumulative distribution function of the gray level is The histogram of the second appearance guide map is The probability density function of the gray level is The cumulative distribution function of the gray level is in:

[0103]

[0104]

[0105]

[0106] The above can obtain the equalized histogram Hist of the first appearance guide map and the second appearance guide map e :

[0107]

[0108]

[0109] According to the equalization histogram Hist e , determined by arrive A guide map transformation matrix is ​​determined, and a matrix transformation is performed on the first appearance guide map according to the determined guide map transformation matrix to obtain a second appearance guide map after histogram matching.

[0110] In this embodiment, by performing grayscale processing on the image to be stylized and the target style image respectively, a first grayscale image and a second grayscale image are obtained, which facilitates subsequent Gaussian blur processing of the first grayscale image and the second grayscale image. By performing Gaussian blur on the first grayscale image and the second grayscale image respectively, a first Gaussian blur image and a second Gaussian blur are obtained. Based on the first Gaussian blur image and the second Gaussian blur, a Gaussian difference image corresponding to the image to be stylized and the target style image can be effectively obtained.

[0111] Embodiment 3

[0112] See also Figure 3, is a schematic diagram of the structure of an image stylization processing system 100 provided in the third embodiment of the present invention, comprising: a normalization module 10, an image transformation module 11, a difference map acquisition module 12, a histogram matching module 13 and a coordinate query module 14, wherein:

[0113] The normalization module 10 is used to perform normalization processing on the target style image and generate a first position guide map according to the normalization result.

[0114] Among them, the normalization module 10 is also used to: according to the normalization result, determine the normalized x coordinate of each pixel position coordinate in the target style image as the red channel of the position guidance map, determine the normalized y coordinate as the green channel, and set the blue channel to zero to obtain the first position guidance map.

[0115] The image transformation module 11 is used to obtain the point correspondence relationship between the target style image and the image to be stylized, and perform image transformation on the first position guidance map according to the point correspondence relationship to obtain a second position guidance map.

[0116] The image transformation module 11 is further used to: perform face point detection on the target style image and the image to be stylized respectively to obtain a first face point set and a second face point set;

[0117] Fitting the first face point set and the second face point set to obtain the point correspondence relationship.

[0118] The difference map acquisition module 12 is used to respectively acquire Gaussian difference maps of the image to be stylized and the target style image, and acquire an appearance guidance map of the target style image to obtain a first appearance guidance map.

[0119] The difference image acquisition module 12 is further used to: perform grayscale processing on the image to be stylized and the target style image respectively to obtain a first grayscale image and a second grayscale image;

[0120] Performing Gaussian blur on the first grayscale image and the second grayscale image respectively to obtain a first Gaussian blurred image and a second Gaussian blurred image;

[0121] The difference between the first Gaussian blur image and the first grayscale image is obtained to obtain a first Gaussian difference image, and the difference between the second Gaussian blur image and the second grayscale image is obtained to obtain a second Gaussian difference image.

[0122] The histogram matching module 13 is used to perform histogram matching according to the first appearance guide map, the image to be stylized and the Gaussian difference map of the target style image to obtain a second appearance guide map.

[0123] The histogram matching module 13 is further used to: use the first Gaussian difference map as a template to determine a guide map transformation matrix between the image to be stylized and the target style image;

[0124] The first appearance guidance map is subjected to matrix transformation according to the determined guidance map transformation matrix to obtain the second appearance guidance map.

[0125] The coordinate query module 14 is configured to perform style coordinate query based on the first position guide map, the second position guide map, the first appearance guide map, and the second appearance guide map to obtain an output style image.

[0126] The coordinate query module 14 is further used to match the first position guide map, the second position guide map, the first position guide map and the second position guide map with a pre-stored style coordinate query table, and generate the output style image according to the matched coordinates.

[0127] Optionally, the coordinate query module 14 is further used to: perform a position search according to the target style image, the first position guide map, the first appearance guide map and a preset query radius, and generate the style coordinate query table according to the position search result.

[0128] In this embodiment, by normalizing the target style image, a first position guide map corresponding to the target style image can be effectively generated based on the normalization result. By obtaining the point correspondence between the target style image and the image to be stylized, the first position guide map is transformed based on the point correspondence, and the second position guide map corresponding to the image to be stylized can be effectively obtained. By performing histogram matching on the first appearance guide map, the image to be stylized and the Gaussian difference map of the target style image, the second appearance guide map corresponding to the image to be stylized can be effectively obtained. By performing style coordinate query on the first position guide map, the second position guide map, the first position guide map and the second position guide map, an output style image of the image to be stylized under the style corresponding to the target style image can be obtained. In this embodiment of the present invention, there is no need to perform image stylization based on a generative adversarial network, which prevents the phenomenon that the face of the stylized image is greatly different from the person himself, and improves the accuracy of image stylization.

[0129] Embodiment 4

[0130] Figure 4 2 is a block diagram of a terminal device 2 provided in the fourth embodiment of the present application. Figure 4As shown, the terminal device 2 of this embodiment includes: a processor 20, a memory 21, and a computer program 22 stored in the memory 21 and executable on the processor 20, such as a program of the image stylization processing method. When the processor 20 executes the computer program 22, the steps in each embodiment of the above-mentioned image stylization processing method are implemented, such as Figure 1 S10 to S50 as shown, or Figure 2 Alternatively, the processor 20 implements the above when executing the computer program 22 Figure 3 The functions of each unit in the corresponding embodiment are, for example, Figure 3 For details on the functions of units 10 to 14 shown, please refer to Figure 3 The relevant descriptions in the corresponding embodiments are not repeated here.

[0131] Exemplarily, the computer program 22 may be divided into one or more units, which are stored in the memory 21 and executed by the processor 20 to complete the present application. The one or more units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 22 in the terminal device 2. For example, the computer program 22 may be divided into a normalization module 10, an image transformation module 11, a difference map acquisition module 12, a histogram matching module 13, and a coordinate query module 14, and the specific functions of each unit are as described above.

[0132] The terminal device may include, but is not limited to, a processor 20 and a memory 21. Those skilled in the art will appreciate that Figure 3 It is only an example of the terminal device 2 and does not constitute a limitation of the terminal device 2. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device may also include input and output devices, network access devices, buses, etc.

[0133] The processor 20 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0134] The memory 21 may be an internal storage unit of the terminal device 2, such as a hard disk or memory of the terminal device 2. The memory 21 may also be an external storage device of the terminal device 2, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 2. Further, the memory 21 may also include both an internal storage unit and an external storage device of the terminal device 2. The memory 21 is used to store the computer program and other programs and data required by the terminal device. The memory 21 may also be used to temporarily store data that has been output or is to be output.

[0135] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0136] If the integrated module is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Among them, the computer-readable storage medium can be non-volatile or volatile. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in computer-readable storage media can be appropriately increased or decreased according to the requirements of legislation and patent practices in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practices, computer-readable storage media do not include electrical carrier signals and telecommunication signals.

[0137] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for image stylization processing, characterized in that: The method comprises: Normalizing the target style image, and generating a first position guide map according to the normalization result; Acquire a point correspondence relationship between the target style image and the image to be stylized, and perform image transformation on the first position guidance map according to the point correspondence relationship to obtain a second position guidance map; Obtain Gaussian difference images of the image to be stylized and the target style image respectively, and obtain an appearance guidance map of the target style image to obtain a first appearance guidance map, match the image identifier of the target style image with a pre-stored guidance map query table to obtain a first appearance guidance map , the guide map query table stores the correspondence between different image identifiers and corresponding appearance guide maps; Performing histogram matching according to the first appearance guide map, the image to be stylized, and the Gaussian difference map of the target style image to obtain a second appearance guide map; Performing a style coordinate query according to the first position guide map, the second position guide map, the first appearance guide map, and the second appearance guide map to obtain an output style image; The obtaining Gaussian difference images of the image to be stylized and the target style image respectively includes: Performing grayscale processing on the image to be stylized and the target style image respectively to obtain a first grayscale image and a second grayscale image; Performing Gaussian blurring on the first grayscale image and the second grayscale image respectively to obtain a first Gaussian blurred image and a second Gaussian blurred image; Obtaining a difference between the first Gaussian blur image and the first grayscale image to obtain a first Gaussian difference image, and obtaining a difference between the second Gaussian blur image and the second grayscale image to obtain a second Gaussian difference image; The performing histogram matching according to the first appearance guide map, the image to be stylized and the Gaussian difference map of the target style image to obtain a second appearance guide map includes: Using the first Gaussian difference map as a template, the second Gaussian difference map is used to determine a guide map transformation matrix between the image to be stylized and the target style image; Performing a matrix transformation on the first appearance guidance map according to the determined guidance map transformation matrix to obtain the second appearance guidance map; The width and height of the target style image are w and h respectively, then the first position guide image (x, y) = (x / w *255, y / h * 255, 0) , first position guide map The x and y in (x, y) are the horizontal and vertical coordinates of each pixel in the target style image after normalization.

2. The image stylization processing method according to claim 1, characterized in that: Generating a first position guide map according to the normalization result includes: According to the normalization result, the normalized x-coordinate of each pixel position coordinate in the target style image is determined as the red channel of the position guidance map, the normalized y-coordinate is determined as the green channel, and the blue channel is set to zero to obtain the first position guidance map.

3. The image stylization processing method according to claim 1, characterized in that: The performing style coordinate query according to the first position guide map, the second position guide map, the first appearance guide map, and the second appearance guide map to obtain an output style image includes: The first position guide map, the second position guide map, the first position guide map and the second position guide map are matched with a pre-stored style coordinate query table, and the output style image is generated according to the matched coordinates.

4. The image stylization processing method according to claim 3, characterized in that: The method further comprises: A position search is performed according to the target style image, the first position guide map, the first appearance guide map and a preset query radius, and the style coordinate query table is generated according to the position search result.

5. The image stylization processing method according to any one of claims 1 to 4, characterized in that: The obtaining of the point correspondence between the target style image and the image to be stylized includes: Performing face point detection on the target style image and the image to be stylized respectively to obtain a first face point set and a second face point set; Fitting the first face point set and the second face point set to obtain the point correspondence relationship.

6. An image stylization processing system, characterized in that: The system comprises: A normalization module, used to normalize the target style image and generate a first position guide map according to the normalization result; An image transformation module, used to obtain a point correspondence relationship between the target style image and the image to be stylized, and perform image transformation on the first position guidance map according to the point correspondence relationship to obtain a second position guidance map; A difference map acquisition module is used to respectively acquire Gaussian difference maps of the image to be stylized and the target style image, and acquire an appearance guidance map of the target style image to obtain a first appearance guidance map, and match the image identifier of the target style image with a pre-stored guidance map query table to obtain a first appearance guidance map , the guide map query table stores the correspondence between different image identifiers and corresponding appearance guide maps; a histogram matching module, configured to perform histogram matching on the first appearance guide map, the image to be stylized, and the Gaussian difference map of the target style image to obtain a second appearance guide map; a coordinate query module, configured to perform a style coordinate query based on the first position guide map, the second position guide map, the first appearance guide map, and the second appearance guide map to obtain an output style image; The difference image acquisition module is also used to: perform grayscale processing on the image to be stylized and the target style image respectively to obtain a first grayscale image and a second grayscale image; Performing Gaussian blurring on the first grayscale image and the second grayscale image respectively to obtain a first Gaussian blurred image and a second Gaussian blurred image; Obtaining a difference between the first Gaussian blur image and the first grayscale image to obtain a first Gaussian difference image, and obtaining a difference between the second Gaussian blur image and the second grayscale image to obtain a second Gaussian difference image; The histogram matching module is further used to: determine a guide map transformation matrix between the image to be stylized and the target style image by using the first Gaussian difference map as a template and the second Gaussian difference map; Performing a matrix transformation on the first appearance guidance map according to the determined guidance map transformation matrix to obtain the second appearance guidance map; The width and height of the target style image are w and h respectively, then the first position guide image (x, y) = (x / w *255, y / h * 255, 0) , first position guide map The x and y in (x, y) are the horizontal and vertical coordinates of each pixel in the target style image after normalization.

7. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Generating a stylized image or stylized animation by matching semantic features via an appearance guide, a segmentation guide, and a positional guide

    US20180350030A1