Figure image stylization processing method and device, equipment and storage medium
By identifying and extracting the character information in the image to be processed, performing foreground image processing and using a preset style model for stylization, the problem of poor quality of the character stylized image in the prior art is solved, and the consistency of the number, gender and position of the characters is achieved, and the image quality is improved.
Patent Information
- Application Number
- CN202410224344.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-28
- Publication Date
- 2025-08-29
AI Technical Summary
When the existing image stylized processing method has a large number of targets in the target image, the characters in the generated character stylized image may have problems such as appearance deformation and quantity changes, resulting in poor image quality.
By obtaining the image to be processed and identifying the detection box parameters and character information of the characters, including quantity, gender and position, foreground image extraction and stylization processing are performed to ensure the consistency of the number, gender and position of the characters in the stylized image, and using a preset style model for stylization and image fusion.
It effectively avoids the number of characters, gender conversion and position disorder after stylized processing, and improves the effect of stylized processing of characters in the image.
Smart Images

Figure CN120563306A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method, apparatus, device and storage medium for stylized processing of character images. Background Art
[0002] The current image stylization processing method usually involves first performing matting on the image to be processed to obtain a target image and a background image, then performing stylization processing on the target image to obtain a stylized target image, and finally superimposing and fusing the stylized target image and the background image to obtain the final stylized image.
[0003] However, when the number of objects in the target image is large, the objects in the generated stylized image may have problems such as appearance deformation and number changes, which will result in poor quality of the generated stylized image corresponding to the image to be processed. Summary of the Invention
[0004] In order to solve the above technical problems, the present application provides a method, device, equipment and storage medium for stylized processing of character images, which can solve the problem of poor quality of generated stylized character images.
[0005] In a first aspect, the present application provides a method for stylizing a person image, comprising: obtaining an image to be processed, and identifying detection frame parameters and person information of a person in the image to be processed; the image to be processed includes at least one person; each person in the image to be processed corresponds to a person detection frame; the detection frame parameters include detection frame parameters corresponding to all person detection frames; the person information includes at least one of the number of people, the gender of the people, and the position of the people; performing foreground image extraction processing on the image to be processed according to the detection frame parameters to obtain a person foreground image; the person foreground image includes all people in the image to be processed; based on the guidance of the person information, performing person stylization processing on the person foreground image to obtain a person stylized image; the person information in the person stylized image is the same as the person information in the person foreground image; and fusing the person stylized image with the image to be processed to obtain a target stylized image.
[0006] In a second aspect, the present application provides a person image stylization processing device, including: an acquisition module, used to acquire an image to be processed, and identify the detection frame parameters and person information of the person in the image to be processed; the image to be processed includes at least one person; each person in the image to be processed corresponds to a person detection frame; the detection frame parameters include the detection frame parameters corresponding to all person detection frames; the person information includes at least one of the number of people, the gender of the people, and the position of the people; a processing module, used to perform foreground image extraction processing on the image to be processed according to the detection frame parameters to obtain a person foreground image; the person foreground image includes all people in the image to be processed; the processing module is also used to perform person stylization processing on the person foreground image based on the guidance of the person information to obtain a person stylized image; the person information in the person stylized image is the same as the person information in the person foreground image; a fusion module, used to fuse the person stylized image and the image to be processed to obtain a target stylized image.
[0007] In a third aspect, the present application provides an electronic device comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the method for stylizing a character image according to the first aspect is implemented.
[0008] In a fourth aspect, the present application provides a computer-readable storage medium, comprising: a computer program stored on the computer-readable storage medium, and when the computer program is executed by a processor, the method for stylizing a character image as described in the first aspect is implemented.
[0009] In a fifth aspect, the present application provides a vehicle, comprising: the device for stylizing a character image as in the second aspect, or the electronic device as in the third aspect.
[0010] In a sixth aspect, the present application provides a computer program product, comprising: when the computer program product is run on a computer, the computer is enabled to implement the method for stylizing a character image as in the first aspect.
[0011] The technical solution provided by this application has the following advantages over the existing technology: First, an image to be processed is acquired, and the detection frame parameters and person information of the person in the image to be processed are identified. Then, foreground image extraction processing is performed on the image to be processed based on the detection frame parameters to obtain a person foreground image. Finally, based on the person information, the person foreground image is subjected to person stylization processing to obtain a person stylized image, and the person stylized image is fused with the image to be processed to obtain a target stylized image. The person information includes at least one of the number of people, the gender of the people, and the position of the people. The person information in the stylized person image is the same as the person information in the person foreground image. In this way, when performing character stylization processing, the character information is added to the character stylization processing flow, and the number of characters before and after the character stylization processing is kept consistent, which can avoid the problem of the number of characters in the image changing after the image to be processed is stylized; the gender of the characters before and after the character stylization processing is kept consistent, which can avoid the problem of the gender of the characters in the image after the image to be processed is stylized; the position of the characters before and after the character stylization processing is kept consistent, which can avoid the problem of the position of the characters in the image being disordered or even deformed after the image to be processed is stylized; thereby improving the effect of the stylization processing of the characters in the image.
[0012] In this application, the names of the above-mentioned devices do not limit the devices or functional modules themselves. In actual implementation, these devices or functional modules may appear with other names. As long as the functions of each device or functional module are similar to those of this application, they fall within the scope of the claims of this application and their equivalents.
[0013] These and other aspects of the present application will become more readily apparent from the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0015] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0016] Figure 1 A schematic diagram of an application scenario of the method for stylizing a character image provided in an embodiment of the present application;
[0017] Figure 2 This is a flow chart of a method for stylizing a character image provided in an embodiment of the present application;
[0018] Figure 3 The second flowchart of the method for stylizing a character image provided in an embodiment of the present application;
[0019] Figure 4 A schematic diagram of an image to be processed provided in an embodiment of the present application;
[0020] Figure 5 The third flowchart of the method for stylizing a character image provided in an embodiment of the present application;
[0021] Figure 6 Flowchart 4 of the method for stylizing a character image provided in an embodiment of the present application;
[0022] Figure 7 Flowchart 5 of the method for stylizing a character image provided in an embodiment of the present application;
[0023] Figure 8 Flowchart 6 of the method for stylizing a character image provided in an embodiment of the present application;
[0024] Figure 9A This is one of the schematic diagrams of a person mask image provided in an embodiment of the present application;
[0025] Figure 9B This is the second schematic diagram of a person mask image provided in an embodiment of the present application;
[0026] Figure 9C The third schematic diagram of a person mask image provided in an embodiment of the present application;
[0027] Figure 9D A schematic diagram of a person foreground image provided in an embodiment of the present application;
[0028] Figure 10 Flowchart 7 of the method for stylizing a character image provided in an embodiment of the present application;
[0029] Figure 11 8. Flowchart 8 of the method for stylizing a character image provided in an embodiment of the present application;
[0030] Figure 12 A schematic structural diagram of a device for stylizing a human image provided in an embodiment of the present application;
[0031] Figure 13 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] In order to more clearly understand the above-mentioned objectives, features and advantages of the present application, the scheme of the present application will be further described below. It should be noted that, in the absence of conflict, the embodiments of the present application and the features therein can be combined with each other.
[0033] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application can also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present application, not all of the embodiments.
[0034] Figure 1 This is a schematic diagram of the scene architecture of the character image stylization processing method provided in the embodiment of this application. Figure 1 As shown, the scenario architecture provided by the embodiment of the present application includes: a server 100 and an electronic device 200.
[0035] The electronic device 200 provided in the embodiment of the present application can have various implementation forms, for example, it can be a mobile phone, a personal computer (PC), a smart TV, a laser projection device, a TV, a monitor, a wearable device, a vehicle-mounted device, an electronic table, etc.
[0036] In some embodiments, upon receiving the character image stylization processing instruction, the electronic device 200 may communicate data with the server 100. The electronic device 200 may be allowed to communicate with the server 100 via a local area network (LAN) or a wireless local area network (WLAN).
[0037] The server 100 may be a server that provides various services, such as a server that supports processing images acquired by the electronic device 200. The server may perform processing operations such as mask extraction and fusion on the received images, and feed back the processing results (e.g., stylized images) to the electronic device 200. The server 100 may be a single server cluster or multiple server clusters, and may include one or more types of servers.
[0038] The character image stylization processing device provided in the embodiment of the present application can be hardware or software. When the character image stylization processing device is hardware, it can be various electronic devices 200 with character image stylization processing functions, including but not limited to smart phones, TVs, tablet computers, smart watches, computers, AI devices, robots, smart vehicles, etc. When the character image stylization processing device is software, it can be installed in the electronic devices 200 listed above. It can be implemented as multiple software or software modules (for example, used to provide character image stylization processing services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0039] It should be noted that the character image stylization processing method provided in the embodiment of the present application can be executed by the server 100, or by the electronic device 200, or by the server 100 and the electronic device 200 together, and this application does not limit this.
[0040] Figure 2 A flow chart of the method for stylizing a character image provided in the embodiment of the present application is shown in FIG. Figure 2 As shown, the method for stylizing a character image may include the following steps.
[0041] S11 , obtaining an image to be processed, and identifying detection frame parameters and person information of a person in the image to be processed.
[0042] Among them, the image to be processed includes at least one person; each person in the image to be processed corresponds to a person detection frame; the detection frame parameters include the detection frame parameters corresponding to all person detection frames; the person information includes at least one of the number of people, the gender of the people, and the position of the people.
[0043] In some embodiments, as Figure 3 As shown, the method of obtaining the image to be processed and identifying the detection frame parameters and person information of the person in the image to be processed may include the following steps:
[0044] S111. Obtain an image to be processed.
[0045] The image to be processed includes at least one person.
[0046] Specifically, the method of obtaining the image to be processed can be to obtain the image to be processed from a related device, to download the image to be processed from the Internet, or to generate the image to be processed using a related algorithm, drawing software, etc., and this application does not limit this.
[0047] S112 , performing image detection on the person in the image to be processed using the target detection model, and obtaining detection frame parameters of the person detection frame corresponding to the person in the image to be processed.
[0048] The detection frame parameters include the number of detection frames. The target detection model is an algorithm that can detect people in the processed image, such as the YOLO algorithm, the region-based convolutional neural network (RCNN), and the high-resolution network (HRNet).
[0049] S113: Determine the number of detection frames as the number of people.
[0050] S114 , cropping a person image corresponding to each person from the image to be processed according to the detection frame parameters to obtain a plurality of person images.
[0051] Among them, the detection frame parameters may include the detection frame coordinates of the detection frame in the image to be processed, or the coordinates of a corner of the detection frame in the image to be processed and the side length of the detection frame. In this way, when cropping out the person image corresponding to each person from the image to be processed according to the detection frame parameters to obtain multiple person images, the position of the person in the person image to be processed can be determined based on the detection frame coordinates of the detection frame in the image to be processed, and then each person image can be cropped out according to the position of the person, or the position of the person in the person image to be processed can be determined based on the coordinates of a corner of the detection frame in the image to be processed (for example, the coordinates of the upper left corner) and the side length of the detection frame, and then the person image corresponding to each person can be cropped out from the image to be processed according to the position of the person to obtain multiple person images.
[0052] In some embodiments, the method of cropping at least one person image from the image to be processed according to the detection frame parameters can be to use an image segmentation algorithm (such as the GrabCut algorithm) or an image cropping tool to crop at least one person image from the image to be processed. This application does not limit this.
[0053] S115 , performing gender classification processing on the person images using a classification detection algorithm to obtain the gender corresponding to the person in each person image.
[0054] First, determine the classification detection algorithm.
[0055] Specifically, the classification detection algorithm is an algorithm that can identify the gender of a person in an image based on the image. It can be an algorithm, such as the GenderNet algorithm, the GenderSVM algorithm, etc.; it can also be a model trained according to a preset algorithm, such as a gender classifier trained using a machine learning algorithm, a gender classification model trained using a convolutional neural network (CNN), etc.
[0056] Afterwards, the character images are classified using a classification detection algorithm to obtain the gender of the character in each character image.
[0057] S116: Determine the target central axis of the image to be processed.
[0058] The target central axis is parallel to the height of the person in the image to be processed.
[0059] Specifically, an image to be processed may have multiple central axes. For example, Figure 4 There are two mutually perpendicular central axes A and B in the image to be processed, wherein the central axis A is parallel to the direction of the person in the image to be processed. Figure 4 The target central axis in is the central axis A.
[0060] S117 , determining the position of the person corresponding to the person detection frame in the image to be processed according to the relative position of the person detection frame and the target central axis.
[0061] In some embodiments, as Figure 5 As shown, the method of determining the position of the person corresponding to the person detection frame in the image to be processed according to the relative position of the person detection frame and the target central axis may include the following steps:
[0062] S1171. Determine the detection frame direction of each person detection frame based on the relative position of the person detection frame and the target central axis.
[0063] In some embodiments, as Figure 6 As shown, the method of determining the detection frame direction of each person detection frame according to the relative position of the person detection frame and the target central axis may include the following steps:
[0064] S11711. Determine whether the first detection frame is divided by the target central axis, and if the first detection frame is divided by the target central axis, execute step S11715; if the first detection frame is not divided by the target central axis, execute step S11712.
[0065] The first detection frame is a person detection frame corresponding to any person in the image to be processed.
[0066] In some embodiments, the method for determining whether the first detection frame is divided by the target central axis can be that the horizontal coordinate of the target central axis is greater than the minimum value of the horizontal coordinate of the first detection frame and less than the maximum value of the horizontal coordinate of the first detection frame; or, the vertical coordinate of the target central axis is greater than the minimum value of the vertical coordinate of the first detection frame and less than the maximum value of the vertical coordinate of the first detection frame, then it is determined that the first detection frame is divided by the target central axis.
[0067] For example, in Figure 4In the image to be processed shown, the person detection frame of the first person 51 is divided by the target central axis A; the person detection frame of the second person 52 and the person detection frame of the third person 53 are not divided by the target central axis A.
[0068] S11712. Determine whether the first detection frame is located on the left side of the target central axis, and when the first detection frame is on the left side of the target central axis, execute step S11714; when the first detection frame is not on the left side of the target central axis, execute step S11713.
[0069] In some embodiments, the method for determining whether the first detection frame is located on the left side of the target central axis can be to determine whether the first detection frame is located on the left side of the target central axis based on the predefined left and right directions and the detection frame coordinates of the first detection frame. For example, when the coordinate origin is as follows Figure 4 The intersection of the target central axis A and the central axis B is shown, and the direction of the letter B of the central axis B is the positive direction of the horizontal axis, the direction of the letter A of the target central axis A is the positive direction of the vertical axis, and the pre-defined left side is the negative direction of the horizontal axis. Then, according to the pre-defined left and right directions and the detection frame coordinates of the first detection frame, a method for determining whether the first detection frame is located on the left side of the target central axis can be: when the maximum value of the detection frame horizontal coordinate of the first detection frame is less than or equal to 0, determining that the first detection frame is located on the left side of the target central axis; when the minimum value of the detection frame horizontal coordinate of the first detection frame is greater than or equal to 0, determining that the first detection frame is located on the right side of the target central axis.
[0070] For example, in Figure 4 In the image to be processed, the person detection frame of the second person 52 is not divided by the target central axis A and is located to the right of the target central axis A; the person detection frame of the third person 53 is not divided by the target central axis A and is located to the left of the target central axis A. The left and right positions of the person detection frames relative to the target central axis are determined by the user. However, it is important to note that once this setting is in effect, it should not be changed during the stylization process of a person image. Otherwise, the recognition of the detection frame orientation will be affected, resulting in deviations in the recognition results.
[0071] S11713: Determine that the first detection frame is on the left side of the image to be processed.
[0072] For example, in Figure 4 In the image to be processed shown, the person detection frame of the third person 53 is not divided by the target central axis A and is located on the left side of the target central axis A, so it is determined that the person detection frame of the third person 53 is on the left side of the image to be processed.
[0073] S11714: Determine that the first detection frame is on the right side of the image to be processed.
[0074] For example, in Figure 4 In the image to be processed shown, the person detection frame of the second person 52 is not divided by the target central axis A and is located on the right side of the target central axis A, so it is determined that the person detection frame of the second person 52 is on the right side of the image to be processed.
[0075] S11715. Obtain the ratio between the length of the first line segment and the length of the second line segment.
[0076] Among them, the length of the first line segment is the length of the line segment located on the left side of the target central axis after the first detection frame is divided by the target central axis; the length of the second line segment is the length of the line segment located on the right side of the target central axis after the first detection frame is divided by the target central axis.
[0077] In some embodiments, the ratio of the length of the first line segment to the length of the second line segment can be calculated by first determining the length of the first line segment and the length of the second line segment based on the predefined left and right directions and the detection frame coordinates of the first detection frame. Then, the ratio of the length of the first line segment to the length of the second line segment is calculated. For example, when the coordinate origin is as follows Figure 4 The intersection of the target central axis A and the central axis B is shown, and the direction of the letter B of the central axis B is the positive direction of the horizontal axis, the direction of the letter A of the target central axis A is the positive direction of the vertical axis, and the pre-defined left side is the negative direction of the horizontal axis. Then, according to the pre-defined left and right directions and the detection frame coordinates of the first detection frame, the method for determining the length of the first line segment and the length of the second line segment can be: the absolute value of the minimum value of the horizontal coordinate of the first detection frame is determined as the length of the first line segment, and the maximum value of the horizontal coordinate of the first detection frame is determined as the length of the second line segment.
[0078] For example, in Figure 4 In the image to be processed shown, the person detection frame of the first person 51 is divided by the target central axis A, and the ratio between the length of the first line segment and the length of the second line segment in the person detection frame of the first person 51 is obtained; when the length of the first line segment in the person detection frame of the first person 51 is i, and the length of the second line segment in the person detection frame of the first person 51 is j, the ratio between the length of the first line segment and the length of the second line segment in the person detection frame of the first person 51 is i / j.
[0079] S11716. Determine whether the ratio is greater than a first threshold value, and if the ratio is greater than the first threshold value, execute step S11717; if the ratio is not greater than the first threshold value, execute step S11718.
[0080] The first threshold is preset, such as a default value or a value preset by relevant personnel based on actual conditions. For another example, the first threshold is 2. If the ratio is greater than 2, step S11717 is executed; if the ratio is not greater than 2, step S11718 is executed.
[0081] S11717: Determine that the first detection frame is on the left side of the image to be processed.
[0082] S11718. Determine whether the ratio is less than the second threshold, and when the ratio is less than the first threshold, execute step S11719; when the ratio is not less than the first threshold, execute step S11710.
[0083] The second threshold is preset, such as a default value or a value preset by relevant personnel based on actual circumstances. For example, the second threshold is 0.5. If the ratio is less than 0.5, step S11719 is executed. If the ratio is greater than or equal to the second threshold (e.g., 0.5) and less than or equal to the first threshold (e.g., 2), step S11710 is executed.
[0084] S11719: Determine that the first detection frame is on the right side of the image to be processed.
[0085] S11719: Determine whether the first detection frame is in the center of the image to be processed.
[0086] S1172. Determine the detection frame area of each person detection frame according to the detection frame coordinates, and sort the detection frames in descending order of the detection frame areas to obtain a sorting result.
[0087] First, the detection frame area of each person detection frame is determined according to the detection frame coordinates.
[0088] In some embodiments, the person detection frame is a rectangular detection frame. The method for determining the detection frame area of each person detection frame based on the detection frame coordinates can be to first use the difference between the maximum value and the minimum value of the horizontal coordinate as the first side length of the rectangular person detection frame, and the difference between the maximum value and the minimum value of the vertical coordinate as the second side length of the rectangular person detection frame, and then use the product of the first side length and the second side length as the detection frame area of the rectangular person detection frame.
[0089] Afterwards, the person detection frames are sorted in descending order according to the area of the detection frames to obtain the sorting results.
[0090] S1173. Determine the position and depth of each person detection frame in the image to be processed based on the sorting result and the detection frame direction.
[0091] In some embodiments, as Figure 7 As shown, the method of determining the position and depth of each person detection frame in the image to be processed according to the sorting result and the detection frame direction may include the following steps:
[0092] S11731. Determine the position depth of the second detection frame as the front row according to the principle that the closer the frame, the larger the frame.
[0093] The second detection frame is the person detection frame that ranks first in the sorting result.
[0094] S11732. Determine the first area, the second area, and the third area.
[0095] Among them, the first area is the area of the second detection frame; the second area is the area of the third detection frame, the detection frame direction of the third detection frame is different from that of the second detection frame, and the area of the third detection frame is the largest in the target direction, and the target direction is a direction different from the detection frame direction of the second detection frame; the third area is the average of the areas of all detection frames except the second detection frame.
[0096] Specifically, the first and second areas are determined in the same manner as the area of the person detection frame in step S1172, and are not further described here. The third area can be determined by first determining the area of each person detection frame, and then calculating the average area of all person detection frames except the second detection frame to obtain the third area.
[0097] S11733. Determine a first area difference and a second area difference based on the first area, the second area, and the third area.
[0098] The first area difference is the area difference between the second detection frame and the third detection frame, and the second area difference is the area difference between the third detection frame and the third area.
[0099] In some embodiments, the first area difference satisfies the formula The second area difference satisfies the formula Among them, K1 is used to represent the first area difference, K2 is used to represent the second area difference, A is used to represent the first area, B is used to represent the third area, and C is used to represent the second area.
[0100] S11734. Determine whether the first area difference is smaller than the second area difference, and if the first area difference is smaller than the second area difference, execute step S11735; if the first area difference is greater than or equal to the second area difference, execute step S11736.
[0101] S11735: Determine that the position depth of the third detection frame is the front row, and the position depths of the remaining detection frames are the back row.
[0102] The remaining detection frames include all person detection frames except the second detection frame and the third detection frame.
[0103] S11736: Determine that the position depths of the third detection frame and the remaining detection frames are all in the back row.
[0104] S1174. Determine the position of the person corresponding to each person detection frame in the image to be processed according to the detection frame direction and position depth.
[0105] For example, in Figure 4 In the image to be processed shown, the detection frame direction of the person detection frame of the first person 51 is the right side, and the position depth is the back row, then the person position of the first person 51 in the image to be processed is determined to be the right back row; the detection frame direction of the person detection frame of the second person 52 is the right side, and the position depth is the back row, then the person position of the second person 52 in the image to be processed is determined to be the right back row; the detection frame direction of the person detection frame of the third person 53 is the left side, and the position depth is the front row, then the person position of the third person 53 in the image to be processed is determined to be the left front row.
[0106] In the above scheme, the number of people, gender and position of people in the image to be processed can be identified, so that in the subsequent process of stylizing the person foreground image, the number of people, gender and position of people in the stylized person stylized image can be controlled according to the number of people, gender and position of people in the image to be processed, thereby achieving the limitation of the number of people, gender and position of people in the stylized person stylized image and improving the quality of the generated person stylized image.
[0107] S12. Perform foreground image extraction processing on the image to be processed according to the detection frame parameters to obtain a person foreground image.
[0108] The person foreground image includes all the persons in the image to be processed.
[0109] In some embodiments, as Figure 8 As shown, the method of performing foreground image extraction processing on the image to be processed according to the detection frame parameters to obtain the person foreground image may include the following steps:
[0110] S121 . Perform mask processing on the image to be processed according to the detection frame parameters to obtain at least one person mask image.
[0111] Among them, each person in the image to be processed corresponds to a person mask image, and the size of each person mask image is the same as the size of the image to be processed. After masking, the background of the mask image is pure black and the foreground is the person image. For example, Figure 9A Based on Figure 4 The first person in 51, Figure 4 After performing mask processing, a person mask image corresponding to the first person 51 is obtained; Figure 9B Based on Figure 4 The second character 52, Figure 4 After performing mask processing, a character mask image corresponding to the second character 52 is obtained; Figure 9C Based on Figure 4 The third person in 53, Figure 4 After the masking process is performed, a person mask image corresponding to the third person 53 is obtained.
[0112] Specifically, a method for performing masking on a person in a person image to be processed based on the detection frame parameters to obtain at least one person mask image may be to input the detection frame parameters and the image to be processed into a pre-trained person mask model to perform masking on the person in the person image to be processed, to obtain at least one person mask image. For example, a SAM model.
[0113] S122 : performing mask fusion processing on the image to be processed and at least one person mask image to obtain a person foreground image.
[0114] The person foreground image includes all the persons in the image to be processed.
[0115] In some embodiments, as Figure 10 As shown, the method of performing mask fusion processing on the image to be processed and at least one person mask image to obtain the person foreground image may include the following steps:
[0116] S1221 , performing mask binarization processing on each person mask image to obtain an original person mask of the person mask image.
[0117] Among them, in the original person mask, the mask value of the person area is 1, and the mask value of the non-person area is 0.
[0118] S1222: Perform a first summing process on the mask value at each position of the original person mask to obtain an overall person mask.
[0119] Among them, the first summing process includes: adding the mask values at the first position of all original character masks to obtain the mask value at the first position of the overall character mask; the first position is any position in the summed mask, and the summed mask includes the original character mask and the overall character mask.
[0120] S1223 , performing a first product process on the overall person mask and the value at each position in the image to be processed to obtain a person foreground image.
[0121] Among them, the numerical value includes pixel value and mask value; the first product processing includes: taking the product of the pixel value at the second position in the image to be processed and the mask value at the second position in the overall character mask as the pixel value at the second position in the character foreground image; the second position is any position in the first product image, and the first product image includes the overall character mask, the image to be processed and the character foreground image.
[0122] Specifically, the image to be processed and at least one person mask image can be subjected to mask fusion processing according to the first formula to obtain a person foreground image. F j Used to represent the pixel value at the jth position in the person foreground image, IMG j It is used to represent the pixel value at the jth position in the image to be processed, M ij It is used to represent the mask value of the i-th person mask image in at least one person mask image at the j-th position. Figure 9D According to the first formula: Figure 4 The image to be processed in Figure 9A The person mask image corresponding to the first person 51 in Figure 9B The character mask image corresponding to the second character 52 in Figure 9C The person mask image corresponding to the third person 53 is subjected to mask fusion processing to obtain a person foreground image.
[0123] In the above scheme, the image to be processed and at least one person mask image are fused into a person foreground image, so that when the person stylization processing is performed subsequently, all the people in the person foreground image can be stylized at one time, which simplifies the person stylization processing process.
[0124] S14. Based on the guidance of the character information, perform character stylization processing on the character foreground image to obtain a character stylized image.
[0125] The person information in the person stylized image is the same as the person information in the person foreground image.
[0126] In some embodiments, based on guidance from person information, a person foreground image is subjected to person stylization processing to obtain a stylized person image. This can be done by inputting the number of people, their gender, their position, and the person foreground image into a preset style model, performing person stylization processing on the person foreground image, and controlling the stylized person image to satisfy at least one of the following conditions during the person stylization process to obtain the stylized person image. The conditions include: the number of people in the stylized person image is the same as the number of people in the person foreground image; the gender of the people in the stylized person image is the same as the gender of the people in the person foreground image; and the position of the people in the stylized person image is the same as the position of the people in the person foreground image. The preset style model is pre-trained based on historical person foreground images and stylized person images corresponding to the historical person foreground images, and is used to transform the people in the person foreground image into a specific style.
[0127] In the above scheme, in the process of using a preset style model to perform character stylization on a character foreground image, the number of characters, the gender of characters, and the position of characters can be used to limit the number of characters, the gender of characters, and the position of characters in the stylized character stylized image, so as to avoid problems such as missing characters, multiple people, or gender changes of characters, or changes in the position of characters, thereby improving the quality of the generated character stylized image.
[0128] In some embodiments, the method for stylizing a person image further includes controlling the similarity between the stylized image and the foreground image within a preset range during the process of stylizing the person image based on the person information and the foreground image. Specifically, the method adjusts a similarity strength parameter for the stylization process, and based on the guidance of the person information and the adjusted similarity strength parameter, performs stylization on the foreground image to obtain a stylized person image. The similarity strength parameter is used to control the similarity between the images before and after the stylization process.
[0129] For example, in the process of performing stylized processing on a person foreground image using a stable diffusion model, the denosing strength parameter of the stable diffusion model can be adjusted, and the person foreground image can be stylized based on the person information and the adjusted denosing strength parameter to obtain a stylized person image. Specifically, the denosing strength parameter of the stable diffusion model can be controlled within a parameter range to control the stylization degree of the person in the person foreground image, thereby achieving the purpose of controlling the similarity between the stylized person image and the person foreground image within a preset range.
[0130] For the stable diffusion model, the larger the denosing strength parameter, the higher the stylization level of the corresponding person foreground image, and the lower the similarity between the stylized person image and the person foreground image. The smaller the denosing strength parameter, the lower the stylization level of the corresponding person foreground image, and the higher the similarity between the stylized person image and the person foreground image. The parameter range and preset range can be the default value or a value set by relevant personnel based on actual conditions. For example, the parameter range can be 0.2-0.4, or the denosing strength parameter can be directly set to 0.3.
[0131] In the above scheme, during the process of stylizing the person foreground image, the similarity between the image after stylization and the person foreground image can be controlled by adjusting the similarity strength parameter, thereby reducing the possibility of image deformation or distortion after the stylized image is processed, and further improving the effect of the stylized processing.
[0132] S15: Fusing the character stylized image with the image to be processed to obtain a target stylized image.
[0133] In some embodiments, as Figure 11 As shown, the method of fusing the character stylized image and the image to be processed to obtain the target stylized image may include the following steps:
[0134] S151 . Perform style binarization processing on the stylized character image to obtain a style character mask corresponding to the stylized character image.
[0135] In the style character mask, pixel values greater than the pixel threshold are assigned a mask value of 1, while pixel values less than or equal to the pixel threshold are assigned a mask value of 0. The pixel threshold is a preset value, such as a default value or a value set by a person based on actual circumstances. For example, the pixel threshold is 10.
[0136] Specifically, a stylized character image can be subjected to style binarization processing to obtain a stylized character mask corresponding to the stylized character image. The stylized character image can be first subjected to grayscale conversion processing using an image conversion algorithm to obtain a grayscale image corresponding to the stylized character image. The mask values at positions where the pixel values in the grayscale image are greater than a pixel threshold are then set to 1, and the mask values at positions where the pixel values are less than or equal to the pixel threshold are set to 0, thereby obtaining a stylized character mask corresponding to the stylized character image.
[0137] Among them, the image conversion algorithm can convert the image into a single-channel grayscale image, for example, pixel value weighted average method, pixel value average method, brightness conversion method, etc.
[0138] S152: Invert the mask values of all positions in the style character mask to obtain a background mask.
[0139] The mask values at the same position in the background mask and the style figure mask are opposite. For example, when the mask value at the pth position in the style figure mask is 1, the mask value at the pth position in the background mask is 0; when the mask value at the oth position in the style figure mask is 0, the mask value at the oth position in the background mask is 1.
[0140] S153 , performing a second product process on the background mask and the value at each position in the image to be processed to obtain a background image.
[0141] Among them, the second product processing includes: taking the product of the pixel value at the third position in the image to be processed and the mask value at the third position in the background mask as the pixel value at the third position in the background image; the third position is any position in the second product image, and the second product image includes the background mask, the image to be processed and the background image.
[0142] S154 , performing a third product process on the values at each position in the stylized character image and the stylized character mask to obtain a target stylized image.
[0143] Among them, the third product processing includes: taking the product of the pixel value at the fourth position in the character stylized image and the mask value at the fourth position in the style character mask as the pixel value at the fourth position in the target stylized image; the fourth position is any position in the third product image, and the third product image includes the character stylized image, the style character mask and the target stylized image.
[0144] S155 , performing a second summing process on the values at each position in the background image and the target stylized image to obtain a stylized image.
[0145] The sum of the pixel value at the fifth position in the background image and the pixel value at the fifth position in the target stylized image is used as the pixel value at the fifth position in the stylized image; the fifth position is any position in the summed image, and the summed image includes the background image, the target stylized image, and the stylized image.
[0146] Specifically, the stylized image of the character and the image to be processed can be subjected to style fusion processing according to the second formula to obtain a stylized image. q =IMG q ×(1-M q )+S q ×M q , R q Used to represent the pixel value at the qth position in the stylized image, IMG q It is used to represent the pixel value at the qth position in the image to be processed, M q Used to represent the mask value at the qth position in the character mask, S q It is used to represent the pixel value at the qth position in the stylized character image. In this way, the stylized character image is first binarized to obtain a character mask corresponding to the stylized character image. Then, the character mask, the stylized character image, and the character image to be processed are subjected to a two-level fusion process according to the second formula to obtain a stylized image. This can reduce the amount of computation and improve processing efficiency.
[0147] In the above scheme, a processing method first obtains a processing image and identifies the detection frame parameters and person information of the person in the processing image. Then, foreground image extraction is performed on the processing image based on the detection frame parameters to obtain a person foreground image. Finally, based on the person information, person stylization is performed on the person foreground image to obtain a person stylized image. The person stylized image is then fused with the processing image to obtain a target stylized image. The person information includes at least one of the number of people, their gender, and their position. The person information in the stylized person image is the same as that in the person foreground image. Thus, during the person stylization process, the person information is incorporated into the person stylization process to maintain the same number of people before and after the stylization process, thereby avoiding the problem of a change in the number of people in the processing image after stylization. Maintaining the same gender before and after the stylization process avoids the problem of gender switching in the processing image after stylization. Maintaining the same position before and after the stylization process avoids the problem of people being misplaced or even deformed in the processing image after stylization. This improves the effectiveness of the person stylization process in the image.
[0148] In the embodiment of the present application, the functional modules of the character image stylization processing device can be divided according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical functional division. In actual implementation, there may be other division methods.
[0149] like Figure 12 As shown, an embodiment of the present application provides a schematic structural diagram of a person image stylization processing device 90. The person image stylization processing device 90 includes an acquisition module 91, a processing module 92 and a fusion module 93.
[0150] An acquisition module 91 is used to acquire an image to be processed and identify detection frame parameters and character information of characters in the image to be processed; the image to be processed includes at least one character; each character in the image to be processed corresponds to a character detection frame; the detection frame parameters include detection frame parameters corresponding to all character detection frames; the character information includes at least one of the number of characters, the gender of the characters, and the position of the characters; a processing module 92 is used to perform foreground image extraction processing on the image to be processed according to the detection frame parameters to obtain a character foreground image; the character foreground image includes all characters in the image to be processed; the processing module 92 is also used to perform character stylization processing on the character foreground image based on the guidance of the character information to obtain a character stylized image; the character information in the character stylized image is the same as the character information in the character foreground image; a fusion module 93 is used to fuse the character stylized image with the image to be processed to obtain a target stylized image.
[0151] In some embodiments, the acquisition module 91 is specifically used to: use the target detection model to perform image detection on the person in the image to be processed, and obtain the detection frame parameters of the person detection frame corresponding to the person in the image to be processed; the detection frame parameters include the number of detection frames; and the number of detection frames is determined as the number of people; according to the detection frame parameters, the person images corresponding to each person are cropped out from the image to be processed to obtain multiple person images; use the classification detection algorithm to perform gender classification processing on the person images to obtain the person gender corresponding to the person in each person image; determine the target central axis of the image to be processed; the target central axis is parallel to the direction of the height of the person in the image to be processed; according to the relative position of the person detection frame and the target central axis, determine the person position of the person corresponding to the person detection frame in the image to be processed.
[0152] In some embodiments, the processing module 92 is specifically used to: perform mask processing on the image to be processed according to the detection frame parameters to obtain at least one person mask image; each person in the image to be processed corresponds to a person mask image; and perform mask fusion processing on the image to be processed and at least one person mask image to obtain a person foreground image.
[0153] In some embodiments, the size of each character mask image is the same as the size of the image to be processed; the processing module 92 is specifically used to: perform mask binarization processing on each character mask image to obtain the original character mask of the character mask image; wherein, in the original character mask, the mask value of the character area is 1, and the mask value of the non-character area is 0; perform a first summation processing on the mask value at each position of the original character mask to obtain the overall character mask; the first summation processing includes: adding the mask values at the first position of all the original character masks to obtain the mask value at the first position of the overall character mask; the first The position is any position in the sum mask, and the sum mask includes the original person mask and the overall person mask; the first product processing is performed on the values at each position in the overall person mask and the image to be processed to obtain the person foreground image; the values include pixel values and mask values; the first product processing includes: taking the product of the pixel value at the second position in the image to be processed and the mask value at the second position in the overall person mask as the pixel value at the second position in the person foreground image; the second position is any position in the first product image, and the first product image includes the overall person mask, the image to be processed, and the person foreground image.
[0154] In some embodiments, processing module 92 is specifically configured to input the number of characters, genders, positions of characters, and a character foreground image into a preset style model, perform character stylization processing on the character foreground image, and, during the character stylization processing, control the stylized character image to meet at least one of the following conditions to obtain a stylized character image; the conditions include: the number of characters in the stylized character image is the same as the number of characters in the character foreground image; the genders of the characters in the stylized character image are the same as the genders of the characters in the character foreground image; and the positions of the characters in the stylized character image are the same as the positions of the characters in the character foreground image.
[0155] In some embodiments, the processing module 92 is specifically used to: adjust the similarity strength parameter of the stylized processing; the similarity strength parameter is used to control the similarity of the image before and after the character stylized processing; based on the guidance of the character information and the adjusted similarity strength parameter, the character foreground image is subjected to character stylized processing to obtain a character stylized image.
[0156] In some embodiments, the fusion module 93 is specifically used to: perform style binarization processing on the stylized character image to obtain a style character mask corresponding to the stylized character image; wherein, in the style character mask, the mask value at the position where the pixel value is greater than the pixel threshold is 1, and the mask value at the position where the pixel value is less than or equal to the pixel threshold is 0; invert the mask values at all positions in the style character mask to obtain a background mask; the background mask is opposite to the mask value at the same position in the style character mask; perform a second product processing on the background mask and the values at each position in the image to be processed to obtain a background image; the second product processing includes: taking the product of the pixel value at a third position in the image to be processed and the mask value at the third position in the background mask as the pixel value at the third position in the background image; the third position is any position in the second product image, and the second product image includes the background mask, the image to be processed, and the background image; A third product processing is performed on the numerical values at each position in the character stylized image and the style character mask to obtain a target stylized image; the third product processing includes: taking the product of the pixel value at the fourth position in the character stylized image and the mask value at the fourth position in the style character mask as the pixel value at the fourth position in the target stylized image; the fourth position is any position in the third product image, and the third product image includes the character stylized image, the style character mask and the target stylized image; a second summation processing is performed on the numerical values at each position in the background image and the target stylized image to obtain a target stylized image; taking the sum of the pixel value at the fifth position in the background image and the pixel value at the fifth position in the target stylized image as the pixel value at the fifth position in the stylized image; the fifth position is any position in the summed image, and the summed image includes the background image, the target stylized image and the stylized image.
[0157] The character image stylization processing device 90 provided in this embodiment can execute the character image stylization processing method provided in the above method embodiment. Its implementation principle and technical effects are similar to those of the above method and will not be repeated here.
[0158] Figure 13 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0159] like Figure 13 As shown, an embodiment of the present application provides an electronic device, comprising: a processor 1201, a memory 1202, and a computer program stored in the memory 1202 and executable on the processor 1201. When executed by the processor 1201, the computer program implements each process of the method for stylizing a human image in the above-described method embodiment. The same technical effects can be achieved, and to avoid repetition, the details are not repeated here.
[0160] An embodiment of the present application provides a computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the various processes of the character image stylization processing method in the above-mentioned method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0161] The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0162] An embodiment of the present application provides a vehicle, comprising: a character image stylization processing device as in the above-mentioned device embodiment, or an electronic device as in the above-mentioned device embodiment. The character image stylization processing device or electronic device in the vehicle can execute each process of the character image stylization processing method in the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0163] An embodiment of the present application provides a computer program product, which stores a computer program. When the computer program is executed by a processor, it implements the various processes of the character image stylization processing method in the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0164] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.
[0165] In this application, the processor may be a central processing unit (CPU), 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.
[0166] In this application, memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0167] In this application, computer-readable media includes permanent and non-permanent, removable and non-removable storage media. Storage media can be implemented by any method or technology to store information, and the information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0168] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0169] The foregoing description is intended only to provide specific embodiments of the present application, which will enable those skilled in the art to understand and implement the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments described herein, but is intended to be construed in the broadest manner consistent with the principles and novel features disclosed herein.
Claims
1. A method for stylizing a character image, characterized in that: Acquire an image to be processed, and identify detection frame parameters and person information of a person in the image to be processed; the image to be processed includes at least one person; each person in the image to be processed corresponds to a person detection frame; the detection frame parameters include detection frame parameters corresponding to all person detection frames; the person information includes at least one of the number of people, the gender of the people, and the position of the people; Performing foreground image extraction processing on the image to be processed according to the detection frame parameters to obtain a person foreground image; the person foreground image includes all the people in the image to be processed; Based on the guidance of the character information, the character foreground image is subjected to character stylization processing to obtain a character stylized image; the character information in the character stylized image is the same as the character information in the character foreground image; The character stylized image and the image to be processed are fused to obtain a target stylized image.
2. The method for stylizing a character image according to claim 1, wherein: Identifying detection frame parameters and person information of a person in the image to be processed, including: Performing image detection on the person in the image to be processed using the target detection model, obtaining detection frame parameters of the person detection frame corresponding to the person in the image to be processed; the detection frame parameters include the number of detection frames; and determining the number of detection frames as the number of people; cropping a person image corresponding to each person from the image to be processed according to the detection frame parameters to obtain a plurality of person images; Performing gender classification processing on the person images using a classification detection algorithm to obtain the gender corresponding to the person in each person image; Determining a target central axis of the image to be processed; wherein the target central axis is parallel to a direction of a height of a person in the image to be processed; According to the relative position of the person detection frame and the target central axis, the person position of the person corresponding to the person detection frame in the image to be processed is determined.
3. The method for stylizing a character image according to claim 1, wherein: The step of performing foreground image extraction processing on the image to be processed according to the detection frame parameters to obtain a person foreground image includes: Performing mask processing on the image to be processed according to the detection frame parameters to obtain at least one person mask image; each person in the image to be processed corresponds to a person mask image; The image to be processed and the at least one person mask image are subjected to mask fusion processing to obtain a person foreground image.
4. The method for stylizing a character image according to claim 3, wherein: The size of each person mask image is the same as the size of the image to be processed, and the image to be processed and the at least one person mask image are subjected to mask fusion processing to obtain a person foreground image, including: Performing mask binarization processing on each person mask image to obtain an original person mask of the person mask image; wherein the mask value of the person area in the original person mask is 1, and the mask value of the non-person area is 0; A first summing process is performed on the mask value at each position of the original character mask to obtain an overall character mask; the first summing process includes: adding the mask values at the first position of all the original character masks to obtain the mask value at the first position of the overall character mask; the first position is any position in the summed mask, and the summed mask includes the original character masks and the overall character mask; A first product processing is performed on the overall person mask and the numerical value at each position in the image to be processed to obtain a person foreground image; the numerical value includes a pixel value and a mask value; the first product processing includes: taking the product of the pixel value at the second position in the image to be processed and the mask value at the second position in the overall person mask as the pixel value at the second position in the person foreground image; the second position is any position in the first product image, and the first product image includes the overall person mask, the image to be processed and the person foreground image.
5. The method for stylizing a character image according to claim 1, wherein: The step of performing character stylization processing on the character foreground image based on the guidance of the character information to obtain a character stylized image includes: The number of characters, the genders of the characters, the positions of the characters, and the character foreground image are input into a preset style model, the character foreground image is subjected to character stylization processing, and during the character stylization processing, the image after the character stylization processing is controlled to meet at least one of the following conditions to obtain a character stylized image; the conditions include: the number of characters in the character stylized image is the same as the number of characters in the character foreground image; the genders of the characters in the character stylized image are the same as the genders of the characters in the character foreground image; and the positions of the characters in the character stylized image are the same as the positions of the characters in the character foreground image.
6. The method for stylizing a character image according to any one of claims 1 to 5, wherein: The step of performing character stylization processing on the character foreground image based on the guidance of the character information to obtain a character stylized image includes: Adjusting a similarity strength parameter of the stylized processing; the similarity strength parameter is used to control the similarity of the image before and after the stylized processing of the character; Based on the guidance of the character information and the adjusted similarity strength parameter, character stylization processing is performed on the character foreground image to obtain a character stylized image.
7. The method for stylizing a character image according to claim 1, wherein: The fusing the stylized character image and the image to be processed to obtain a target stylized image includes: Performing style binarization processing on the stylized character image to obtain a style character mask corresponding to the stylized character image; wherein, in the style character mask, a mask value at a position where a pixel value is greater than a pixel threshold is 1, and a mask value at a position where a pixel value is less than or equal to the pixel threshold is 0; Inverting the mask values at all positions in the style character mask to obtain a background mask; the background mask is opposite to the mask value at the same position in the style character mask; performing a second product process on the values at each position in the background mask and the image to be processed to obtain a background image; the second product process includes: multiplying the pixel value at a third position in the image to be processed by the mask value at the third position in the background mask as the pixel value at the third position in the background image; the third position is any position in the second product image, and the second product image includes the background mask, the image to be processed, and the background image; performing a third product process on the values at each position in the stylized character image and the stylized character mask to obtain a target stylized image; the third product process includes: multiplying the pixel value at a fourth position in the stylized character image by the mask value at the fourth position in the stylized character mask as the pixel value at the fourth position in the target stylized image; the fourth position is any position in the third product image, and the third product image includes the stylized character image, the stylized character mask, and the target stylized image; A second summation process is performed on the values at each position in the background image and the target stylized image to obtain a target stylized image; the sum of the pixel value at the fifth position in the background image and the pixel value at the fifth position in the target stylized image is used as the pixel value at the fifth position in the stylized image; the fifth position is any position in the summed image, and the summed image includes the background image, the target stylized image, and the stylized image.
8. A device for stylizing a character image, characterized in that: include: an acquisition module, configured to acquire an image to be processed and identify detection frame parameters and person information of a person in the image to be processed; the image to be processed includes at least one person; each person in the image to be processed corresponds to a person detection frame; the detection frame parameters include detection frame parameters corresponding to all person detection frames; the person information includes at least one of the number of people, the gender of the people, and the position of the people; A processing module is used to perform foreground image extraction processing on the image to be processed according to the detection frame parameters to obtain a person foreground image; the person foreground image includes all the people in the image to be processed; The processing module is further configured to perform character stylization processing on the character foreground image based on the guidance of the character information to obtain a character stylized image; the character information in the character stylized image is the same as the character information in the character foreground image; The fusion module is used to fuse the stylized character image with the image to be processed to obtain a target stylized image.
9. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the method for stylizing a character image according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that include: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for stylizing a human image according to any one of claims 1 to 7 is implemented.