Image processing method, device, storage medium, electronic equipment and product

By using the image pre-synthesis area of ​​the preset image template in image processing to determine and process the target image content, the problem of poor image processing effects in the existing technology is solved, and accurate fusion of image content and effect improvement are achieved.

CN116797500BActive Publication Date: 2024-09-06TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210259239.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-14
Publication Date
2024-09-06
Estimated Expiration
2042-03-14

AI Technical Summary

Technical Problem

Existing image processing solutions cannot accurately and effectively integrate the contents of the template and the image file to be processed, resulting in poor image processing results.

Method used

By obtaining the image pre-synthesis area in the preset image template, it is determined whether the target image file contains content that meets the synthesis requirements, and synthesis pre-processing and content compensation synthesis processing are performed to generate a fused target image.

Benefits of technology

It achieves accurate and effective integrated integration of image files to be processed and preset image template content, improves image processing effects, avoids blind synthesis of templates and image content, and simplifies user operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116797500B
    Figure CN116797500B
Patent Text Reader

Abstract

The present application discloses an image processing method, device, storage medium, electronic device and product, which relates to the field of computer technology. The present application can be applied to the technical fields such as artificial intelligence, map vehicle network and blockchain, and the method comprises: obtaining a preset image template, which includes an image pre-synthesis area and template image content; determining a target image file to be processed; judging whether the target image file includes the target image content to be processed that meets the requirements of synthesizing a predetermined type of image content; if the target image file includes the target image content to be processed, performing synthesis pre-processing on the target image content to be processed in the target image file to generate an image to be synthesized with only the target image content to be processed; performing content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area to generate a target image that fuses the template image content and the target image content to be processed. The present application can improve the image processing effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an image processing method, device, storage medium, electronic equipment and product. Background Art

[0002] Image processing is the task of post-processing the target image file to be processed, such as post-processing the images in the mobile phone album. At present, there is a method of simply overlaying the template image style on the image to be processed in the image to be processed. If the image to be processed contains the target image content, the current solution will simply and blindly overlay a template image style on the image to be processed. The image style in the template and the target image content will be obviously isolated from each other, which is equivalent to adding a mask special effect, and it is impossible to achieve the integrated fusion effect of the target image content in the image style.

[0003] Therefore, under the current image processing scheme, it is impossible to accurately and effectively integrate the fusion template and the content in the image file to be processed, and there is a problem of poor image processing effect. Summary of the invention

[0004] The embodiments of the present application provide an image processing method and related devices, which can achieve accurate and effective integrated fusion of the target image file to be processed and the content in the preset image template, effectively improving the image processing effect.

[0005] To solve the above technical problems, the present application provides the following technical solutions:

[0006] According to one embodiment of the present application, an image processing method includes: obtaining a preset image template, wherein the preset image template includes an image pre-synthesis area and template image content, wherein the image pre-synthesis area is used to synthesize a predetermined type of image content; determining a target image file to be processed; judging whether the target image file includes target image content to be processed that meets the requirements for synthesizing the predetermined type of image content; if the target image file includes the target image content to be processed, performing synthesis pre-processing on the target image content to be processed in the target image file to generate an image to be synthesized that only contains the target image content to be processed; performing content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area to generate a target image that fuses the template image content and the target image content to be processed.

[0007] According to one embodiment of the present application, an image processing device includes: a template acquisition module, which is used to acquire a preset image template, wherein the preset image template includes an image pre-synthesis area and template image content, and the image pre-synthesis area is used to synthesize a predetermined type of image content; an image acquisition module, which is used to determine a target image file to be processed; a content judgment module, which is used to judge whether the target image file includes target image content to be processed that meets the requirements for synthesizing the predetermined type of image content; an image processing module, which is used to perform synthesis pre-processing on the target image content to be processed in the target image file if the target image file includes the target image content to be processed, so as to generate an image to be synthesized in which only the target image content to be processed exists; and an image synthesis module, which is used to perform content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area, so as to generate a target image that fuses the template image content and the target image content to be processed.

[0008] In some embodiments of the present application, the image acquisition module is used to: in response to a selection operation on a candidate image, determine the candidate image selected by the selection operation as a target image file to be processed; the content judgment module is used to: obtain image description information corresponding to the target image file; and determine, based on the image description information, whether the target image file includes target image content to be processed that meets the requirements for synthesizing the predetermined type of image content.

[0009] In some embodiments of the present application, the candidate image includes the target image file, and the device also includes an information extraction module, including: a content feature extraction unit, used to extract image content features from the candidate image; a content feature recognition unit, used to perform feature joint recognition processing based on the image content features to obtain image description information corresponding to the candidate image, and the image description information is used to indicate whether the image file includes target image content to be processed that meets the requirements for synthesizing the predetermined type of image content.

[0010] In some embodiments of the present application, the content feature extraction unit is used to: input the candidate image into a content feature extraction model for content feature extraction processing to obtain the image content features; the content feature recognition unit is used to: input the image content features into a content feature recognition model for feature joint recognition processing to obtain the image description information.

[0011] In some embodiments of the present application, the content feature extraction unit includes: a segmentation subunit, used to cross-segment the candidate image according to a predetermined segmentation strategy to obtain at least two sub-images with overlapping parts; a feature extraction subunit, used to input at least two of the sub-images into the content feature extraction model to perform local content feature extraction processing to obtain the image content features.

[0012] In some embodiments of the present application, the segmentation subunit is used to: detect the aspect ratio of the candidate image; if the aspect ratio is higher than a predetermined threshold, cross-segment the candidate image according to a predetermined segmentation strategy to obtain at least two sub-images with overlapping parts.

[0013] In some embodiments of the present application, the image processing module includes: a detection unit, used to detect and process the target image content to be processed in the target image file to obtain contour information of the target image content to be processed; a preprocessing unit, used to extract the target image content to be processed from the target image file based on the contour information to obtain the image to be synthesized containing only the target image content to be processed.

[0014] In some embodiments of the present application, the contour information is a mask image; the detection unit is used to: input the target image file into an image segmentation extraction model to perform content segmentation detection processing to obtain the mask image corresponding to the content of the target image to be processed.

[0015] In some embodiments of the present application, the preprocessing unit is used to: perform mask overlay operation on the mask image and the target image file to obtain the image to be synthesized, wherein the image to be synthesized includes a content area corresponding to the content of the target image to be processed, and the area outside the content area in the image to be synthesized is a transparent area.

[0016] In some embodiments of the present application, the detection unit is used to: perform size transformation processing on the target image file to obtain a transformed image of the target size; input the transformed image into the image segmentation and extraction model to perform content segmentation detection processing to obtain the mask image corresponding to the content of the target image to be processed; the preprocessing unit is used to: transform the size of the mask image to the size corresponding to the target image file to obtain the transformed mask image; perform filtering and noise reduction processing on the transformed mask image to obtain the target mask image; perform mask superposition operation processing on the target mask image and the target image file to obtain the image to be synthesized.

[0017] In some embodiments of the present application, the image synthesis module includes a first synthesis unit, which is used to: obtain a preset content synthesis strategy corresponding to the preset image template; perform content compensation processing on the image to be synthesized and the template image content according to the content compensation information in the preset content synthesis strategy to obtain the compensated image to be synthesized and the template image content; and perform image synthesis on the compensated image to be synthesized and the template image content in the image pre-synthesis area.

[0018] In some embodiments of the present application, the image synthesis module includes a second synthesis unit, which is used to: obtain image feature information of the image to be synthesized, and obtain preset description information of the image pre-synthesis area; perform analysis and processing based on the image feature information and the preset description information to obtain an image synthesis strategy that matches the preset image template and the image to be synthesized; perform content compensation processing on the image to be synthesized and the template image content according to the content compensation information in the image synthesis strategy to obtain the compensated image to be synthesized and the template image content; and perform image synthesis on the compensated image to be synthesized and the template image content in the image pre-synthesis area.

[0019] According to another embodiment of the present application, an image processing method includes: displaying an image synthesis interface, wherein a preset image template is displayed in the image synthesis interface, wherein the preset image template includes an image pre-synthesis area and template image content, wherein the image pre-synthesis area is used to synthesize a predetermined type of image content; in response to a synthesis operation in the image synthesis interface, displaying a synthesized target image, wherein the target image is generated by performing content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area, wherein the image to be processed is generated by performing synthesis preprocessing on the target image content to be processed in the target image file, wherein only the target image content to be processed exists in the image to be processed, and the target image content to be processed meets the requirements for synthesizing the predetermined type of image content.

[0020] According to another embodiment of the present application, an image processing device includes: a template display module for displaying an image synthesis interface, in which a preset image template is displayed, and the preset image template includes an image pre-synthesis area and template image content, and the image pre-synthesis area is used to synthesize a predetermined type of image content; a target image synthesis module for displaying a synthesized target image in response to a synthesis operation in the image synthesis interface, wherein the target image is generated by performing content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area, and the image to be processed is generated by performing synthesis preprocessing on the target image content to be processed in the target image file, and only the target image content to be processed exists in the image to be processed, and the target image content to be processed meets the requirements for synthesizing the predetermined type of image content.

[0021] In some embodiments of the present application, the target image synthesis module includes: a selection interface trigger unit, used to display an image file selection interface in response to a synthesis trigger operation for the preset image template in the image synthesis interface; and a synthesis trigger unit, used to display the synthesized target image in response to a synthesis trigger operation for the target image file in the image file selection interface.

[0022] In some embodiments of the present application, the synthesis trigger unit is used to: in response to a selection operation for a candidate image in the image file selection interface, prominently display the target image file, wherein the target image file is the candidate image selected by the selection operation; and in response to a synthesis trigger operation in the image file selection interface, display the synthesized target image.

[0023] According to another embodiment of the present application, a computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of a computer, the computer executes the method described in the embodiment of the present application.

[0024] According to another embodiment of the present application, an electronic device includes: a memory storing a computer program; and a processor reading the computer program stored in the memory to execute the method described in the embodiment of the present application.

[0025] According to another embodiment of the present application, a computer program product or a computer program includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in various optional implementations described in the embodiments of the present application.

[0026] In an embodiment of the present application, a preset image template is obtained, wherein the preset image template includes an image pre-synthesis area and template image content, wherein the image pre-synthesis area is used to synthesize a predetermined type of image content; a target image file to be processed is determined; it is determined whether the target image file includes target image content to be processed that meets the requirements for synthesizing the predetermined type of image content; if the target image file includes the target image content to be processed, synthesis pre-processing is performed on the target image content to be processed in the target image file to generate an image to be synthesized in which only the target image content to be processed exists; content compensation synthesis processing is performed on the image to be synthesized in the image pre-synthesis area to generate a target image that fuses the template image content and the target image content to be processed.

[0027] In this way, a pre-synthesis area for synthesizing a predetermined type of image content is set in the preset image template. When processing the image, it is first determined whether the target image file includes the target image content to be processed that meets the requirements for synthesizing the predetermined type of image content. If the target image file includes the target image content to be processed, further processing is performed to avoid blind synthesis of the template and the content of the target image file to be processed, thereby improving the synthesis accuracy. Further, during the synthesis processing, the target image file is subjected to synthesis pre-processing to generate a to-be-synthesized image that only has the predetermined type of to-be-processed target image content. Further, in the image pre-synthesis area, the to-be-synthesized image is subjected to content compensation synthesis processing to generate the target image. The template image content in the preset image template and the to-be-processed target image content can be adaptively fused into a whole to generate the target image, thereby avoiding the effect of the two being independent and unfused due to simply adding mask processing. Furthermore, the present application realizes the accurate and effective integrated fusion of the target image file to be processed and the content in the preset image template, thereby effectively improving the image processing effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0029] Figure 1 A schematic diagram of a system to which an embodiment of the present application can be applied is shown.

[0030] FIG. 2A to FIG. 2C A diagram showing the terminal interface changes during a scene image processing process is shown.

[0031] Figure 3 A flowchart of an image processing method according to an embodiment of the present application is shown.

[0032] Figure 4 A flowchart of an image processing method according to another embodiment of the present application is shown.

[0033] Figure 5 A feature recognition flow chart according to an embodiment of the present application is shown.

[0034] Figure 6 A flowchart of an image compression process according to an embodiment of the present application is shown.

[0035] Figure 7 A flowchart of image segmentation according to an embodiment of the present application is shown.

[0036] Figure 8A flowchart of image extraction according to an embodiment of the present application is shown.

[0037] Fig. 9 A schematic diagram of image synthesis according to an embodiment of the present application is shown.

[0038] Fig.10 A flowchart of an image processing process in a scenario is shown.

[0039] Fig.11 A block diagram of an image processing device according to another embodiment of the present application is shown.

[0040] Fig.12 A block diagram of an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0041] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0042] It can be understood that in the specific implementation of the present application, related data such as the target image file to be processed are involved. When the above embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0043] Figure 1 FIG. 1 is a schematic diagram showing a system 100 to which an embodiment of the present application can be applied. Figure 1 As shown, the system 100 may include a server 101 and / or a terminal 102 .

[0044] Server 101 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms.

[0045] The terminal 102 can be any device, including but not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, VR / AR devices, smart watches, computers, etc.

[0046] In one implementation of this example, the terminal 102 or the server 101 may: obtain a preset image template, wherein the preset image template includes an image pre-synthesis area and template image content, wherein the image pre-synthesis area is used to synthesize a predetermined type of image content; determine a target image file to be processed; determine whether the target image file includes target image content to be processed that meets the requirements for synthesizing the predetermined type of image content; if the target image file includes the target image content to be processed, perform synthesis pre-processing on the target image content to be processed in the target image file to generate an image to be synthesized that only contains the target image content to be processed; perform content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area to generate a target image that merges the template image content and the target image content to be processed.

[0047] In another implementation of this example, when a user uses a terminal to synthesize a target image, the terminal 102 can: display an image synthesis interface, in which a preset image template is displayed, wherein the preset image template includes an image pre-synthesis area and a template image content, and the image pre-synthesis area is used to synthesize a predetermined type of image content; in response to a synthesis operation in the image synthesis interface, a synthesized target image is displayed, wherein the target image is generated by performing content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area, and the image to be processed is generated by performing synthesis pre-processing on the target image content to be processed in the target image file, and only the target image content to be processed exists in the image to be processed, and the target image content to be processed meets the requirements for synthesizing the predetermined type of image content.

[0048] In one scenario, see FIG. 2A to FIG. 2C The terminal interface changes shown in the figure, the user uses the terminal (for example Figure 1 The terminal 102 shown in the figure synthesizes the target image. In this scenario, the predetermined type of image content is "character image content of character type", and the target image content to be processed is "character image content to be processed". It can be understood that the predetermined type in other scenarios can be animal type, vehicle type, etc.

[0049] In this scenario, first, refer to Figure 2A , displaying the “image synthesis interface”. Specifically, the user can open, for example, Figure 2A The "Image Synthesis Interface" corresponding to the "Entry 2-Sub-Entry iC Function Entrance" of the "Image Synthesis Interface" displays at least one preset image template. The user can select a preset image template in the "Image Synthesis Interface" by performing synthesis trigger operations such as clicking or long pressing, and the terminal obtains the preset image template selected by the user in response to the selection operation.

[0050] The preset image template selected by the user in this scenario is as follows Figure 2A The template of the user CCC selected in the box, where the image pre-synthesis area can be as follows Figure 2A The template of user CCC includes a predetermined area of ​​a human-shaped area, and the predetermined area can be used to synthesize character image content of a character type, and the template image content can be content in an area outside the predetermined area.

[0051] Then, the terminal can respond to the synthesis operation in the image synthesis interface and display the synthesized target image, which is generated by the terminal in the background in the image pre-synthesis area by performing content compensation synthesis processing on the image to be synthesized, and the image to be processed is generated by synthesizing the "image content to be processed" in the target image file by pre-processing, and the image to be processed only contains "image content to be processed", and the "image content to be processed" meets the requirements of synthesizing "image content of the character type". The terminal can display the synthesized target image in the target interface.

[0052] Among them, combined Figure 2B In one manner, in response to a synthesis operation in an image synthesis interface, displaying a synthesized target image may include: in response to a synthesis trigger operation for a preset image template in the image synthesis interface, displaying an image file selection interface; in response to a synthesis trigger operation for a target image file in the image file selection interface, displaying the synthesized target image.

[0053] Specifically, in this scenario, the user triggers the synthesis operation of the preset image template, for example, the user Figure 2A Click "Make the same" under the template of user CCC (i.e. the selected preset image template), and after the terminal application detects the synthesis trigger operation for the preset image template, it can trigger the jump to the following Figure 2B The image file selection interface shown, and then, the terminal "displays the image file selection interface". The image file selection interface can display the "target image file" in a specific location (such as an album or folder, etc.) or the "target image file" collected by real-time shooting or the like.

[0054] Among them, in one mode, in response to a synthesis trigger operation for a target image file in an image file selection interface, displaying a synthesized target image can include: in response to a selection operation for a candidate image in the image file selection interface, highlighting and displaying the target image file, the target image file being the candidate image selected by the selection operation; in response to a synthesis trigger operation in the image file selection interface, displaying the synthesized target image.

[0055] At least one candidate image can be displayed in the image file selection interface. In the image file selection interface, the user can select a candidate image by clicking on the candidate image or performing other selection operations as needed. Then, the terminal determines the candidate image selected by the selection operation as the target image file to be processed. The target image file can be highlighted in the image file selection interface by deepening the brightness of the target image file or selecting a frame for the target image file.

[0056] The user can trigger a synthesis trigger operation for a target image file in the image file selection interface, wherein the synthesis trigger operation for the target image file, for example, the user can trigger a synthesis trigger operation for a target image file in the image file selection interface. Figure 2B The trigger operation of clicking "OK" in the image file selection interface shown is understood to be a synthesis trigger operation that can be set as required. After the synthesis trigger operation for the target image file is detected in the terminal, the target image can be synthesized in the background and displayed in the target interface.

[0057] Among them, when the terminal synthesizes the target image in the background, the terminal can specifically: determine whether the target image file includes the character image content to be processed that meets the requirements of the character image content of the synthesized character type; if the target image file includes the character image content to be processed, then perform synthesis preprocessing on the character image content to be processed in the target image file to generate an image to be synthesized that only contains the character image content to be processed; perform content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area to generate a target image that integrates the template image content and the character image content to be processed.

[0058] After the target image is synthesized in the terminal, it can be stored in a predetermined location and displayed on the target page. In this scenario, Figure 2C The target image is displayed in the "Edit" interface shown, and the user can further edit the target image in the "Edit" interface.

[0059] Figure 3 The flowchart of the image processing method according to an embodiment of the present application is schematically shown. The execution subject of the image processing method can be any terminal, such as Figure 1 Terminal 102 is shown.

[0060] like Figure 3 As shown, the image processing method may include steps S210 to S250.

[0061] Step S210, obtaining a preset image template, wherein the preset image template includes an image pre-synthesis area and template image content, and the image pre-synthesis area is used to synthesize a predetermined type of image content;

[0062] Step S220, determining the target image file to be processed;

[0063] Step S230, determining whether the target image file includes target image content to be processed that meets the requirements for synthesizing a predetermined type of image content;

[0064] Step S240, if the target image file includes the target image content to be processed, then perform synthesis preprocessing on the target image content to be processed in the target image file to generate a to-be-synthesized image containing only the target image content to be processed;

[0065] Step S250 , performing content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area to generate a target image that fuses the content of the template image and the content of the target image to be processed.

[0066] The preset image template is a preset image template used to synthesize other images. The preset image template includes an image pre-synthesis area, and the contour shape of the image pre-synthesis area can be laid out as required. The image pre-synthesis area can be used to synthesize a predetermined type of image content, such as image content of a predetermined creature or a predetermined object. The preset image template can be obtained from a predetermined location, for example, a preset image template can be selected from an image processing application.

[0067] For an example, see Figure 2A , users can open the application in e.g. Figure 2A The "Entry 2-Sub-Entry iC Function Entrance" corresponds to the "Image Synthesis Interface", and at least one preset image template is displayed in the "Image Synthesis Interface". The user can select a preset image template in the "Image Synthesis Interface" by clicking or long pressing the synthesis trigger operation, and then the terminal obtains the preset image template selected by the user in response to the selection operation. The preset image template selected by the user is as follows. Figure 2A The template of the user CCC selected in the box, where the image pre-synthesis area can be as follows Figure 2A The template of user CCC includes a predetermined area of ​​a human-shaped area, and the predetermined area can be used to synthesize character image content of a character type, and the template image content can be content in an area outside the predetermined area.

[0068] The target image file to be processed is an image that needs secondary processing. The target image file to be processed can be determined from a specific location, such as a picture selected by a user from a terminal photo album.

[0069] In one example, a user can trigger a terminal to start Figure 2B The image file selection interface shown in the figure can display "target image files" in a specific location (such as an album or folder) or "target image files" collected by real-time shooting or other methods. The user can trigger a synthesis trigger operation for the target image file in the image file selection interface. For example, the user can Figure 2BClick "OK" in the image file selection interface shown to trigger the synthesis trigger operation. After the synthesis trigger operation for the target image file is detected in the terminal, the target image can be synthesized in the background.

[0070] When synthesizing a target image, the terminal first determines whether the target image file includes target image content to be processed that meets the requirements for synthesizing a predetermined type of image content, for example, determines whether the target image file includes target image content to be processed that meets the requirements for synthesizing the image content of a predetermined organism or a predetermined object.

[0071] If the target image file includes the target image content to be processed, the target image content to be processed in the target image file is pre-synthesized to generate a to-be-synthesized image containing only the target image content to be processed, and the to-be-synthesized image contains only the target image content to be processed and does not contain any other content. Furthermore, in the image pre-synthesis area, the to-be-synthesized image is subjected to content compensation synthesis processing, and the adaptive synthesis processing of the two image contents can be effectively performed to generate a target image that fuses the template image content and the target image content to be processed.

[0072] In this way, based on steps S210 to S250, a pre-synthesis area for synthesizing a predetermined type of image content is set in the preset image template. During image processing, it is first determined whether the target image file includes the target image content to be processed that meets the requirements for synthesizing the predetermined type of image content. If the target image file includes the target image content to be processed, further processing is performed to avoid blind synthesis of the template and the content of the target image file to be processed, thereby improving synthesis accuracy. Further, during synthesis processing, the target image file is subjected to synthesis pre-processing to generate a to-be-synthesized image that only has the predetermined type of to-be-processed target image content. Further, in the image pre-synthesis area, the to-be-synthesized image is subjected to synthesis processing for content compensation to generate the target image. The template image content in the preset image template and the to-be-processed target image content can be adaptively fused into a whole to generate the target image, thereby avoiding the effect of the two being independent and unfused due to simply adding mask processing. Furthermore, the present application realizes the accurate and effective integrated fusion of the target image file to be processed and the content in the preset image template, thereby effectively improving the image processing effect.

[0073] See also Figure 4 The following describes the specific process of each step performed when performing image processing.

[0074] In step S210, a preset image template is obtained, wherein the preset image template includes an image pre-synthesis area and template image content, and the image pre-synthesis area is used to synthesize a predetermined type of image content.

[0075] The preset image template can be obtained from a predetermined location. For example, a preset image template can be selected from an image processing application, and the selected preset image template can be obtained from the cloud or the terminal locally.

[0076] The preset image template may include at least one, and each preset image template may include at least one image pre-synthesis area and template image content. The area shape and size of the at least one image pre-synthesis area included in each preset image template may be the same or different, and the template image content is the content of the area outside the image pre-synthesis area.

[0077] In step S220, a target image file to be processed is obtained.

[0078] The target image file to be processed can be obtained from a specific location (such as an album or folder, etc.) at a fixed time or in real time according to user operation, or the terminal can obtain it autonomously. In some methods, the target image file to be processed can be a picture stored in a folder designated by the user as the target image file to be processed, and in some methods, the target image file to be processed can be a picture of a candidate image selected by the user in real time from the terminal album according to the demand.

[0079] In step S230, it is determined whether the target image file includes target image content to be processed that meets the requirement of synthesizing a predetermined type of image content.

[0080] In one method, it is possible to determine, based on preset image description information, whether the target image file includes target image content to be processed that meets the requirements for synthesizing a predetermined type of image content; in another method, real-time content detection can be performed on the target image file to determine whether the target image file includes target image content to be processed that meets the requirements for synthesizing a predetermined type of image content.

[0081] In one embodiment, step S220, determining the target image file to be processed, includes: in response to a selection operation on a candidate image, determining the candidate image selected by the selection operation as the target image file to be processed; step S230, judging whether the target image file includes target image content to be processed that meets the requirements for synthesizing a predetermined type of image content, includes: obtaining image description information corresponding to the target image file; and determining, based on the image description information, whether the target image file includes target image content to be processed that meets the requirements for synthesizing a predetermined type of image content.

[0082] The candidate image is at least one candidate image, such as an image in the local photo album of the terminal. The user can select one or at least two candidate images from the candidate images by clicking or other selection operations, and the terminal determines the candidate images selected by the selection operation as the target image files to be processed.

[0083] Furthermore, in response to the selection operation, the terminal can obtain image description information corresponding to the selected target image file from the information storage location in the database, and the image description information is preset. Based on the image description information, it is possible to efficiently and accurately determine whether the target image file includes target image content to be processed that meets the requirements for synthesizing the predetermined type of image content without performing content detection. If the image description information indicates that the candidate image includes target image content to be processed that meets the requirements for synthesizing the predetermined type of image content, the successful synthesis of the target image file and the template can be guaranteed.

[0084] In one embodiment, the candidate image includes a target image file to be processed. In step S220, before obtaining the target image file to be processed, it also includes step S200: extracting image content features from the candidate image; performing feature joint recognition processing based on the image content features to obtain image description information corresponding to the candidate image, and the image description information is used to indicate whether the image file includes target image content to be processed that meets the requirements for synthesizing a predetermined type of image content.

[0085] By extracting image content features and performing joint recognition processing on candidate images, image description information can be accurately obtained, and the image description information is used to indicate that the candidate image includes a predetermined type of target image content. Furthermore, it is pre-acquired whether the candidate image includes the target image content. When selecting the target image file to be processed from the candidate images, it can be accurately and efficiently determined whether the selected image includes the target image content.

[0086] For an example, see Figure 5 The predetermined type of image content is the character image content corresponding to the character type, and the image content features are as follows: Figure 5 The features of the left eye, right eye, nose, left half of the mouth, right half of the mouth, etc. selected in the middle image can be accurately determined by the joint recognition of these image content features. Figure 5 The facial image framed in the right image of the image can then be accurately generated to indicate whether the image file includes the target image content to be processed that meets the requirements of the synthetic character type.

[0087] In one embodiment, in step S200, image content features are extracted from the candidate image, including step S201: inputting the candidate image into a content feature extraction model for content feature extraction processing to obtain image content features; in step S200, feature joint recognition processing is performed based on the image content features to obtain image description information corresponding to the candidate image, including step S202: inputting the image content features into a content feature recognition model for feature joint recognition processing to obtain image description information.

[0088] The content feature extraction model is a feature extraction model based on deep learning, which can be used to extract image content features from an image. In one implementation of this embodiment, the content feature extraction model is an intelligent model for feature extraction obtained by training MNN (Mobile Neural Network, a lightweight deep neural network inference engine) through deep learning of image features (referred to as MNN feature extraction model), which can effectively extract image content features on the terminal side.

[0089] The content feature recognition model is a feature recognition model based on deep learning, which can be used to identify what type of image content the image content features belong to. In one implementation of this embodiment, the content feature recognition model is an intelligent model for feature alignment and recognition obtained by MNN (Mobile Neural Network, a lightweight deep neural network inference engine) through deep learning training of image features (referred to as MNN feature recognition model), which can effectively recognize image content features on the terminal side.

[0090] In this embodiment, a dual solution of feature extraction and recognition is implemented through a content feature extraction model and a content feature recognition model, thereby ensuring the accuracy of the extracted image description information.

[0091] It can be understood that in another implementation, the content feature extraction processing in step S201 and the image content feature recognition processing in step S202 can be performed based on a content recognition model, such as an MNN (Mobile Neural Network, a lightweight deep neural network inference engine) that is an intelligent model for feature extraction and recognition obtained through deep learning training of portrait features.

[0092] In one embodiment, step S201, inputting the candidate image into the content feature extraction model for content feature extraction processing to obtain image content features, includes step S2011: inputting the candidate image into the content feature extraction model for content feature extraction processing to obtain image content features. In this embodiment, the candidate image is directly input into the feature content feature extraction model to extract image content features.

[0093] In one embodiment, step S201, inputting the candidate image into a content feature extraction model for content feature extraction processing to obtain image content features, includes: step S2012, cross-segmenting the candidate image according to a predetermined segmentation strategy to obtain at least two sub-images with overlapping parts; step S2013, inputting at least two sub-images into a content feature extraction model for local content feature extraction processing to obtain image content features.

[0094] The predetermined segmentation strategy may be a strategy indicating the size, number and overlapped area size of the segmented sub-images. The candidate image is cross-segmented according to the predetermined segmentation strategy, and the candidate image may be cross-segmented into at least two sub-images with overlapping parts according to the strategy information of the size, number and overlapped area size of the segmented sub-images.

[0095] Based on at least two overlapping sub-images, local content feature extraction can be performed from the local candidate image corresponding to each sub-image, so as to avoid the failure to extract features when there are defects in the candidate image. In addition, if there are overlapping parts between the sub-images, it is possible to avoid recognition errors caused by feature segmentation.

[0096] See also Figure 6 Taking the content feature extraction model as MNN (Mobile Neural Network, a lightweight deep neural network inference engine) and the intelligent model for feature extraction obtained through deep learning of portrait features (referred to as MNN feature extraction model) as an example, Figure 6 The candidate image on the left side needs to be compressed into a 320*320 square image when input into the MNN feature extraction model. After compression, the features such as the left eye, right eye, and nose will be compressed and deformed, and the model will not be able to extract the features during recognition.

[0097] For further information, see Figure 7 ,Will Figure 6 The candidate image on the left side is cross-segmented to obtain Figure 7 The three overlapping sub-images shown on the right have an aspect ratio of 4:3. When the sub-images are input into the MNN feature extraction model, they can still accurately extract features after being compressed into a 320*320 square graphic.

[0098] In one embodiment, step S2012, the candidate image is cross-segmented according to a predetermined segmentation strategy to obtain at least two sub-images with overlapping portions: the aspect ratio of the candidate image is detected; if the aspect ratio is higher than a predetermined threshold, the candidate image is cross-segmented according to a predetermined segmentation strategy to obtain at least two sub-images with overlapping portions.

[0099] By detecting the aspect ratio of the candidate image, if the aspect ratio is higher than a predetermined threshold, the candidate image is cross-segmented according to a predetermined segmentation strategy. Figure 6 The cross segmentation process is performed only when the aspect ratio of the candidate image on the left side is higher than a predetermined threshold, which can avoid useless segmentation operations and improve image processing efficiency.

[0100] In step S240, if the target image file includes the target image content to be processed, synthesis preprocessing is performed on the target image content to be processed in the target image file to generate an image to be synthesized containing only the target image content to be processed.

[0101] In one embodiment, step S240, performing synthesis preprocessing on the target image content to be processed in the target image file to generate an image to be synthesized containing only the target image content to be processed, includes: step S241, performing detection processing on the target image content to be processed in the target image file to obtain contour information of the target image content to be processed; step S242, extracting the target image content to be processed from the target image file based on the contour information to obtain an image to be synthesized containing only the target image content to be processed.

[0102] For example, if the content of the target image to be processed is a person image of the target person, and the contour information is information that can describe the contour of the person image, the person image can be extracted from the target image file to be processed based on the detected contour information to generate an image to be synthesized that only contains the person image.

[0103] In one embodiment, the contour information is a mask image; step S241, detecting and processing the target image content to be processed in the target image file to obtain the contour information of the target image content to be processed, including: inputting the target image file into the image segmentation extraction model to perform content segmentation detection processing to obtain the mask image corresponding to the target image content to be processed.

[0104] The image segmentation and extraction model is an image segmentation model based on deep learning, which can be used to segment images and generate mask images. In one implementation of this embodiment, the image segmentation and extraction model is an intelligent model (referred to as the MNN segmentation and extraction model) for segmenting images and generating mask images obtained by training MNN (Mobile Neural Network, a lightweight deep neural network inference engine) through deep learning of image features, which can be used to segment images and generate mask images on the terminal side.

[0105] The target image file to be processed is input into the image segmentation extraction model. The image segmentation model can detect and segment the target image content and generate a mask image corresponding to the target image content. The mask image is as follows: Figure 8 As shown in the image X3, the content area corresponding to the target image content is non-zero pixels, while the area outside the content area is zero pixels.

[0106] In one embodiment, step S242 extracts the content of the target image to be processed from the target image file based on the contour information to obtain an image to be synthesized that only contains the content of the target image to be processed, including: performing a mask overlay operation on the mask image and the target image file to obtain the image to be synthesized, wherein the image to be synthesized includes a content area corresponding to the content of the target image to be processed, and the area outside the content area in the image to be synthesized is a transparent area.

[0107] The pixels in the content area corresponding to the target image to be processed in the mask image are non-zero pixels, while the area outside the content area is zero pixels. The mask image and the target image file to be processed are subjected to mask superposition operation to obtain the image to be synthesized. The image to be synthesized includes the content area corresponding to the target image content. The area outside the content area in the image to be synthesized is a transparent area. When the image to be synthesized is synthesized into a preset image template, it is only fused to the target image content.

[0108] In one embodiment, a target image file is input into an image segmentation and extraction model for content segmentation detection processing to obtain a mask image corresponding to the content of the target image to be processed, including: performing a size transformation processing on the target image file to obtain a transformed image of the target size; inputting the transformed image into an image segmentation and extraction model for content segmentation detection processing to obtain a mask image corresponding to the content of the target image to be processed; performing a mask superposition operation processing on the mask image and the target image file to obtain an image to be synthesized, including: transforming the size of the mask image to a size corresponding to the target image file to obtain a transformed mask image; performing filtering and noise reduction processing on the transformed mask image to obtain a target mask image; performing a mask superposition operation processing on the target mask image and the target image file to obtain an image to be synthesized.

[0109] According to the adaptation requirements of the image segmentation and extraction model, the target image file to be processed is resized to obtain a transformed image of the target size. Then, the transformed image is detected using the image segmentation and extraction model to accurately obtain a mask image corresponding to the target image content.

[0110] For example, see Figure 8 The target image file X1 to be processed is compressed into a transformed image X2 of 320*320 through size transformation, and then input into the MNN segmentation and extraction model for detection processing. The MNN segmentation and extraction model can detect the character image content from the transformed image X2 and segment it to generate a mask image X3.

[0111] The size of the mask image is transformed to the size corresponding to the target image file to obtain the transformed mask image. For example, Figure 8 The middle mask image X3 is transformed to the original image size, that is, the size corresponding to the target image file to be processed, to obtain a transformed mask image X4.

[0112] The transformed mask image is filtered and denoised to obtain the target mask image. Figure 8 The transformed mask image X4 is subjected to filtering and denoising processing (eg, 5-median median filtering and denoising may be used) to obtain a target mask image X5.

[0113] The target mask image and the target image file to be processed are processed by mask superposition operation to obtain the image to be synthesized. Figure 8 The target mask image X5 and the target image file X1 to be processed are processed by mask superposition operation to obtain the image X6 to be synthesized.

[0114] By enlarging the mask image to the size of the original image, some jagged edges will be generated. By filtering and denoising the transformed mask image, the edges can be smoothed, and then the edges of the target image content in the synthesized image are smoothed, which can ensure the image synthesis effect.

[0115] In step S250, content compensation synthesis processing is performed on the image to be synthesized in the image pre-synthesis area to generate a target image that fuses the content of the template image and the content of the target image to be processed.

[0116] The image synthesis strategy (including the preset content synthesis strategy and the personalized image synthesis strategy) may include the adjustment compensation strategy information of the size, brightness, pixel color, etc. of the image to be synthesized and / or the template image content, as well as the placement position of the image to be synthesized or the alignment method of the image to be synthesized and the template image content after compensation. After determining the matching image synthesis strategy, the image to be synthesized may be subjected to content compensation synthesis processing in the image pre-synthesis area according to the image synthesis strategy to generate a target image that effectively integrates the template image content and the target image content to be processed.

[0117] See also Fig. 9 The image to be synthesized M1 can be processed by content compensation synthesis in the image pre-synthesis area of ​​the preset image template M2 through tools such as a brush and a drawing board, and the character image in the image to be synthesized M1 is drawn on the preset image template M2 to obtain a fused target image M3.

[0118] In one embodiment, step S250, performing content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area includes: obtaining a preset content synthesis strategy corresponding to a preset image template; performing content compensation processing on the image to be synthesized and the template image content according to the content compensation information in the preset content synthesis strategy to obtain the compensated image to be synthesized and the template image content; and performing image synthesis on the compensated image to be synthesized and the template image content in the image pre-synthesis area.

[0119] In this embodiment, a preset content synthesis strategy corresponding to a preset image template is obtained as an image synthesis strategy, and content compensation processing of size, brightness, pixel color, etc. of the image to be synthesized and the template image content is performed according to the adjustment compensation strategy information of the size, brightness, pixel color, etc. of the image to be synthesized and / or the template image content in the preset content synthesis strategy. Then, in the image pre-synthesis area, according to the placement position of the image to be synthesized in the preset content synthesis strategy or the alignment method of the image to be synthesized and the template image content after compensation, etc., the compensated image to be synthesized is synthesized with the template image content, so that image synthesis can be efficiently performed to generate a target image.

[0120] In one embodiment, step S250, performing content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area includes: obtaining image feature information of the image to be synthesized, and obtaining preset description information of the image pre-synthesis area; performing analysis and processing based on the image feature information and the preset description information to obtain an image synthesis strategy that matches the preset image template and the image to be synthesized; performing content compensation processing on the image to be synthesized and the template image content according to the content compensation information in the image synthesis strategy to obtain the compensated image to be synthesized and the template image content; performing image synthesis on the compensated image to be synthesized and the template image content in the image pre-synthesis area.

[0121] In this embodiment, the personalized image synthesis strategy obtained by analyzing and processing the image feature information and the preset description information can further adaptively fuse the two to generate the target image. The image feature information can be information such as the size, color, and brightness of the target image content extracted from the image to be synthesized. The preset description information of the image pre-synthesis area is preset information for describing the area, and the preset description information may include information such as the size, color, and brightness of the area.

[0122] The method of analyzing and processing according to the image feature information and the preset description information may include: searching for a strategy that matches both the image feature information and the preset description information from at least one preset strategy as an image synthesis strategy that matches the preset image template and the image to be synthesized.

[0123] The method of performing analysis and processing based on image feature information and preset description information may also include: inputting the image feature information and the preset description information into a pre-trained deep learning-based strategy analysis model, which can perform analysis and processing to output a predicted strategy label, and from at least one candidate strategy, a candidate strategy that matches the predicted strategy label can be queried as an image synthesis strategy that matches the preset image template and the image to be synthesized.

[0124] According to the adjustment compensation strategy information of the size, brightness, pixel color, etc. of the image to be synthesized and / or the template image content in the image synthesis strategy, the image to be synthesized and the template image content are content compensated in terms of size, brightness, pixel color, etc. Then, in the image pre-synthesis area, according to the placement position of the image to be synthesized in the image synthesis strategy or the alignment method of the image to be synthesized and the template image content after compensation, the compensated image to be synthesized is synthesized with the template image content.

[0125] The above-mentioned embodiment is further described below in conjunction with a process of performing image processing in an application scenario. Fig.10 The overall flow chart of image processing in this scenario is shown.

[0126] See also Fig.10 The overall process of image processing in this scenario may include steps S310 to S311.

[0127] In step S310, a preset image template is obtained, wherein the preset image template includes an image pre-synthesis area and template image content, wherein the image pre-synthesis area is used to synthesize a predetermined type of image content, which is a character image content of a character type in this scene.

[0128] Specifically, an image synthesis interface may be displayed in the terminal, in which a preset image template is displayed. The preset image template includes an image pre-synthesis area and template image content. The image pre-synthesis area is used to synthesize character image content of a character type.

[0129] See also Figure 2A , users can open in the app, for example Figure 2A The "Image Synthesis Interface" corresponding to the "Entry 2-Sub-Entry iC Function Entrance" of the "Image Synthesis Interface" displays at least one preset image template. The user can select a preset image template in the "Image Synthesis Interface" by performing synthesis trigger operations such as clicking or long pressing, and the terminal obtains the preset image template selected by the user in response to the selection operation.

[0130] The preset image template selected by the user in this scenario is as follows Figure 2A The template of the user CCC selected in the box, where the image pre-synthesis area can be as follows Figure 2A The template of user CCC includes a predetermined area of ​​a human-shaped area, and the predetermined area can be used to synthesize character image content of a character type, and the template image content can be content in an area outside the predetermined area.

[0131] In step S320, a candidate image is selected, that is, a target image file to be processed is determined, including: in response to a selection operation on a candidate image, the candidate image selected by the selection operation is determined as the target image file to be processed.

[0132] Specifically, in response to a synthesis trigger operation for a preset image template in the image synthesis interface, an image file selection interface can be displayed in the terminal, and at least one candidate image can be displayed in the image file selection interface. In the image file selection interface, the user can select a candidate image by clicking on the candidate image or other selection operations as needed. Then, the terminal determines the candidate image selected by the selection operation as the target image file to be processed. The target image file can be highlighted and displayed in the image file selection interface by deepening the brightness of the target image file or selecting a frame for the target image file.

[0133] For example, if a user Figure 2A Click "Make the same" under the preset image template selected in the trigger to trigger the synthesis trigger operation for the preset image template, and the trigger terminal jumps to a specific location (such as an album or folder, etc.) Figure 2B In the image file selection interface shown, the user selects a candidate image as a target image file in the image interface and clicks “OK” to trigger a synthesis trigger operation for the target image file.

[0134] Steps S330 to S340 are to determine whether the target image file includes target image content to be processed that meets the requirements for synthesizing a predetermined type of image content. In this scenario, the predetermined type of target image content is "character image content of character type".

[0135] In step S330, the recognition result of the image database is read. Specifically, the image description information corresponding to the target image file is obtained. Figure 2B , in response to a user in e.g. Figure 2B After the synthesis trigger operation for the target image file is triggered by clicking “OK” or other methods on the picture interface shown, the terminal can obtain the image description information stored in association with the target image file from the picture database.

[0136] Step S340, determining whether the target image file contains character image content. Specifically, determining whether the target image file contains the target image content to be processed that meets the requirements for synthesizing the predetermined type of image content according to the image description information, that is, determining whether the image description information indicates whether the target image file contains the target image content to be processed that meets the requirements for synthesizing the character type of character image content.

[0137] If so, that is, if the target image file includes the target image content to be processed, the process proceeds to step S350 to step S380.

[0138] If not, for example, the image description information is not obtained, go to step S390.

[0139] In step S350 to step S380, synthesis preprocessing is performed on the target image content to be processed in the target image file to generate a to-be-synthesized image containing only the target image content to be processed.

[0140] In step S350, the MNN segmentation and extraction model is used to extract the mask image. That is, the target image content to be processed in the target image file is detected and processed to obtain the contour information of the target image content to be processed, which specifically includes: inputting the target image file into the image segmentation and extraction model (the MNN segmentation and extraction model in this scenario) to perform content segmentation detection processing to obtain the mask image corresponding to the target image content to be processed.

[0141] In step S360, filter and smooth the edges. Specifically, if the target image file is input into the image segmentation and extraction model for content segmentation detection processing to obtain the mask image corresponding to the content of the target image to be processed, the step includes: performing a size transformation processing on the target image file to obtain a transformed image of the target size; inputting the transformed image into the image segmentation and extraction model for content segmentation detection processing to obtain the mask image corresponding to the content of the target image to be processed. Then, the size of the mask image is further transformed to the size corresponding to the target image file to obtain the transformed mask image; and filtering and denoising processing is performed on the transformed mask image to obtain the target mask image.

[0142] In step S370, masks are superimposed to obtain the image to be synthesized.

[0143] Specifically, the target image content to be processed is extracted from the target image file based on the contour information to obtain an image to be synthesized containing only the target image content to be processed, including: performing mask overlay operation on the mask image and the target image file to obtain the image to be synthesized, wherein the image to be synthesized includes a content area corresponding to the target image content to be processed, and the area outside the content area in the image to be synthesized is a transparent area.

[0144] In addition, if the target mask image is obtained by executing step S360, the target mask image and the target image file are subjected to mask superposition operation processing to obtain the image to be synthesized.

[0145] The mask overlay operation can use the mask overlay algorithm of opencv to extract the area of ​​the original image.

[0146] Step S380, after the aforementioned steps S370 to S370, an image to be synthesized having only the content of the target image to be processed is obtained.

[0147] Step S390, synthesize the template and the image. Specifically, in the image pre-synthesis area, the image to be synthesized is subjected to content compensation synthesis processing to generate a target image that fuses the template image content and the target image content to be processed. After synthesizing the target image in the terminal, it can be stored in a predetermined location and displayed on the target page. In this scenario, Figure 2C The target image is displayed in the "Edit" interface shown, and the user can further edit the target image in the "Edit" interface.

[0148] After step S340, proceed to step S390.

[0149] In step S390, the MNN feature extraction model is used to extract the features of the character image.

[0150] That is, extracting image content features from the candidate image, specifically including: inputting the candidate image into a content feature extraction model (such as an MNN feature extraction model) to perform content feature extraction processing to obtain image content features.

[0151] In step S3100, determine whether it is a person image feature.

[0152] That is, the image description information is obtained by performing recognition processing based on the image content features, specifically including: inputting the image content features into the content feature recognition model for feature joint recognition processing to obtain the image description information. The image description information is used to indicate whether the candidate image includes the target image content to be processed that meets the requirements for synthesizing the predetermined type of image content (i.e., the character image content of the character type).

[0153] See also Figure 5 The predetermined type of image content is the character image content corresponding to the character type, and the image content features are as follows: Figure 5 The left eye, right eye, nose, left half of the mouth, right half of the mouth and other character image features selected in the middle image of the image can be identified through the joint recognition of these image content features. Figure 5 The image features of the person framed in the image on the right side of the image can be used to generate image description information indicating that the candidate image includes the target image content to be processed that meets the requirements for synthesizing a predetermined type of image content (i.e., person image content of the person type).

[0154] After step S3100, if yes, that is, if the image description information indicates that the candidate image includes target image content to be processed that meets the requirements for synthesizing a predetermined type of image content (that is, character image content of a character type), then step S350 and step S3111 can be entered.

[0155] In step S3111, the image description information is stored in the database.

[0156] After step S3100, if no, for example, no image content feature is extracted or it is determined that the extracted image content feature is not a person image feature, then proceed to step S3112.

[0157] In step S3112, it is detected whether the candidate image is a long image. Specifically, the aspect ratio of the candidate image is detected, and if the aspect ratio is higher than a predetermined threshold, it is a long image, otherwise it is not a long image.

[0158] If yes, then go to step S3113. If no, then go to step S3114.

[0159] In step S3113, the image is cut into sub-images. Specifically, the candidate image is cross-segmented according to a predetermined segmentation strategy to obtain at least two sub-images with overlapping parts. Then, step S390 is entered to input at least two sub-images into a content feature extraction model (such as an MNN feature extraction model) to perform local content feature extraction processing to obtain image content features. For example, if Figure 6 If the aspect ratio of the candidate image on the left is higher than a predetermined threshold, the candidate image is segmented. Figure 7 ,Will Figure 6 The candidate image on the left is segmented and obtained Figure 7 The three overlapping sub-images shown on the right side of the figure have an aspect ratio of 4:3. The sub-images are compressed into 320*320 tensors and then input into the MNN feature extraction model for content feature extraction. Then, the process proceeds to step S3110.

[0160] In step S3114, it is determined that no person image content exists in the candidate picture.

[0161] In this scenario, by applying the aforementioned embodiments of the present application, the following beneficial effects can be achieved:

[0162] The preset image template and the character image content can be adaptively fused to generate the target image as a whole, which can avoid the effect of the two being independent and unfused due to simply adding mask processing, and effectively improve the image processing effect. It simplifies the user's operation of cutting out and editing during image fusion, and improves the user's utilization rate and user experience of the entire function. The dual model processing solution of feature extraction and recognition ensures the accuracy of identifying the character image content. Through the recognition technology of long image segmentation, the overall recognition accuracy is increased, avoiding the situation where some character image features are misjudged.

[0163] In order to better implement the image processing method provided in the embodiment of the present application, the embodiment of the present application also provides an image processing device based on the above image processing method. The meanings of the terms are the same as those in the above image processing method, and the specific implementation details can refer to the description in the method embodiment. Fig.11A block diagram of an image processing device according to an embodiment of the present application is shown.

[0164] like Fig.11 As shown, the image processing device 400 may include a template acquisition module 410 , an image acquisition module 420 , a content determination module 430 , an image processing module 440 and an image synthesis module 450 .

[0165] The template acquisition module 410 can be used to acquire a preset image template, wherein the preset image template includes an image pre-synthesis area and a template image content, wherein the image pre-synthesis area is used to synthesize a predetermined type of image content; the image acquisition module 420 can be used to determine a target image file to be processed; the content judgment module 430 can be used to judge whether the target image file includes target image content to be processed that meets the requirements for synthesizing the predetermined type of image content; the image processing module 440 can be used to perform synthesis pre-processing on the target image content to be processed in the target image file if the target image file includes the target image content to be processed, so as to generate an image to be synthesized that only contains the target image content to be processed; the image synthesis module 450 can be used to perform content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area, so as to generate a target image that fuses the template image content and the target image content to be processed.

[0166] In some embodiments of the present application, the image acquisition module is used to: in response to a selection operation on a candidate image, determine the candidate image selected by the selection operation as a target image file to be processed; the content judgment module is used to: obtain image description information corresponding to the target image file; and determine, based on the image description information, whether the target image file includes target image content to be processed that meets the requirements for synthesizing the predetermined type of image content.

[0167] In some embodiments of the present application, the candidate image includes the target image file, and the device also includes an information extraction module, including: a content feature extraction unit, used to extract image content features from the candidate image; a content feature recognition unit, used to perform feature joint recognition processing based on the image content features to obtain image description information corresponding to the candidate image, and the image description information is used to indicate whether the image file includes target image content to be processed that meets the requirements for synthesizing the predetermined type of image content.

[0168] In some embodiments of the present application, the content feature extraction unit is used to: input the candidate image into a content feature extraction model for content feature extraction processing to obtain the image content features; the content feature recognition unit is used to: input the image content features into a content feature recognition model for feature joint recognition processing to obtain the image description information.

[0169] In some embodiments of the present application, the content feature extraction unit includes: a segmentation subunit, used to cross-segment the candidate image according to a predetermined segmentation strategy to obtain at least two sub-images with overlapping parts; a feature extraction subunit, used to input at least two of the sub-images into the content feature extraction model to perform local content feature extraction processing to obtain the image content features.

[0170] In some embodiments of the present application, the segmentation subunit is used to: detect the aspect ratio of the candidate image; if the aspect ratio is higher than a predetermined threshold, cross-segment the candidate image according to a predetermined segmentation strategy to obtain at least two sub-images with overlapping parts.

[0171] In some embodiments of the present application, the image processing module includes: a detection unit, used to detect and process the target image content to be processed in the target image file to obtain contour information of the target image content to be processed; a preprocessing unit, used to extract the target image content to be processed from the target image file based on the contour information to obtain the image to be synthesized containing only the target image content to be processed.

[0172] In some embodiments of the present application, the contour information is a mask image; the detection unit is used to: input the target image file into an image segmentation extraction model to perform content segmentation detection processing to obtain the mask image corresponding to the content of the target image to be processed.

[0173] In some embodiments of the present application, the preprocessing unit is used to: perform mask overlay operation on the mask image and the target image file to obtain the image to be synthesized, wherein the image to be synthesized includes a content area corresponding to the content of the target image to be processed, and the area outside the content area in the image to be synthesized is a transparent area.

[0174] In some embodiments of the present application, the detection unit is used to: perform size transformation processing on the target image file to obtain a transformed image of the target size; input the transformed image into the image segmentation and extraction model to perform content segmentation detection processing to obtain the mask image corresponding to the content of the target image to be processed; the preprocessing unit is used to: transform the size of the mask image to the size corresponding to the target image file to obtain the transformed mask image; perform filtering and noise reduction processing on the transformed mask image to obtain the target mask image; perform mask superposition operation processing on the target mask image and the target image file to obtain the image to be synthesized.

[0175] In some embodiments of the present application, the image synthesis module includes a first synthesis unit, which is used to: obtain a preset content synthesis strategy corresponding to the preset image template; perform content compensation processing on the image to be synthesized and the template image content according to the content compensation information in the preset content synthesis strategy to obtain the compensated image to be synthesized and the template image content; and perform image synthesis on the compensated image to be synthesized and the template image content in the image pre-synthesis area.

[0176] In some embodiments of the present application, the image synthesis module includes a second synthesis unit, which is used to: obtain image feature information of the image to be synthesized, and obtain preset description information of the image pre-synthesis area; perform analysis and processing based on the image feature information and the preset description information to obtain an image synthesis strategy that matches the preset image template and the image to be synthesized; perform content compensation processing on the image to be synthesized and the template image content according to the content compensation information in the image synthesis strategy to obtain the compensated image to be synthesized and the template image content; and perform image synthesis on the compensated image to be synthesized and the template image content in the image pre-synthesis area.

[0177] According to another embodiment of the present application, an image processing device includes: a template display module for displaying an image synthesis interface, in which a preset image template is displayed, and the preset image template includes an image pre-synthesis area and template image content, and the image pre-synthesis area is used to synthesize a predetermined type of image content; a target image synthesis module for displaying a synthesized target image in response to a synthesis operation in the image synthesis interface, wherein the target image is generated by performing content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area, and the image to be processed is generated by performing synthesis preprocessing on the target image content to be processed in the target image file, and only the target image content to be processed exists in the image to be processed, and the target image content to be processed meets the requirements for synthesizing the predetermined type of image content.

[0178] In some embodiments of the present application, the target image synthesis module includes: a selection interface trigger unit, used to display an image file selection interface in response to a synthesis trigger operation for the preset image template in the image synthesis interface; and a synthesis trigger unit, used to display the synthesized target image in response to a synthesis trigger operation for the target image file in the image file selection interface.

[0179] In some embodiments of the present application, the synthesis trigger unit is used to: in response to a selection operation for a candidate image in the image file selection interface, prominently display the target image file, wherein the target image file is the candidate image selected by the selection operation; and in response to a synthesis trigger operation in the image file selection interface, display the synthesized target image.

[0180] Furthermore, in one embodiment of the present application, an image processing device includes: a template display module, which is used to display an image synthesis interface, in which a preset image template is displayed, and the preset image template includes an image pre-synthesis area and a template image content, and the image pre-synthesis area is used to synthesize a predetermined type of image content; a target image synthesis module, which is used to display a synthesized target image in response to a synthesis operation in the image synthesis interface, wherein the target image is generated by performing content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area, and the image to be processed is generated by performing synthesis preprocessing on the target image content to be processed in the target image file, and only the target image content to be processed exists in the image to be processed, and the target image content to be processed meets the requirements for synthesizing the predetermined type of image content.

[0181] In some embodiments of the present application, the target image synthesis module includes: a selection interface trigger unit, used to display an image file selection interface in response to a synthesis trigger operation for the preset image template in the image synthesis interface; and a synthesis trigger unit, used to display the synthesized target image in response to a synthesis trigger operation for the target image file in the image file selection interface.

[0182] In some embodiments of the present application, the synthesis trigger unit is used to: in response to a selection operation for a candidate image in the image file selection interface, prominently display the target image file, wherein the target image file is the candidate image selected by the selection operation; and in response to a synthesis trigger operation in the image file selection interface, display the synthesized target image.

[0183] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.

[0184] In addition, an embodiment of the present application further provides an electronic device, which may be a terminal or a server. Fig.12As shown, it shows a schematic diagram of the structure of the electronic device involved in the embodiment of the present application, specifically:

[0185] The electronic device may include components such as a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, a power supply 503, and an input unit 504. Those skilled in the art will appreciate that Fig.12 The electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0186] The processor 501 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire computer device. By running or executing software programs and / or modules stored in the memory 502, and calling data stored in the memory 502, it executes various functions of the computer device and processes data, thereby detecting the electronic device. Optionally, the processor 501 may include one or more processing cores; preferably, the processor 501 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user pages and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 501.

[0187] The memory 502 can be used to store software programs and modules. The processor 501 executes various functional applications and data processing by running the software programs and modules stored in the memory 502. The memory 502 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 502 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 502 may also include a memory controller to provide the processor 501 with access to the memory 502.

[0188] The electronic device also includes a power supply 503 for supplying power to each component. Preferably, the power supply 503 can be logically connected to the processor 501 through a power management system, so as to manage charging, discharging, power consumption and other functions through the power management system. The power supply 503 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators and other arbitrary components.

[0189] The electronic device may further include an input unit 504, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0190] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 501 in the electronic device will load the executable files corresponding to the processes of one or more computer programs into the memory 502 according to the following instructions, and the processor 501 will run the computer programs stored in the memory 502, thereby realizing various functions of the aforementioned embodiments of the present application, such as the processor 501 may execute:

[0191] Acquire a preset image template, wherein the preset image template includes an image pre-synthesis area and template image content, wherein the image pre-synthesis area is used to synthesize a predetermined type of image content; determine a target image file to be processed; determine whether the target image file includes target image content to be processed that meets the requirements for synthesizing the predetermined type of image content; if the target image file includes the target image content to be processed, perform synthesis pre-processing on the target image content to be processed in the target image file to generate an image to be synthesized that only contains the target image content to be processed; perform content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area to generate a target image that fuses the template image content and the target image content to be processed.

[0192] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0193] To this end, an embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored. The computer program can be loaded by a processor to execute the steps in any method provided in the embodiment of the present application.

[0194] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0195] Since the computer program stored in the computer-readable storage medium can execute the steps in any method provided in the embodiments of the present application, the beneficial effects that can be achieved by the method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0196] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional implementations in the above embodiments of the present application.

[0197] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.

[0198] It should be understood that the present application is not limited to the embodiments that have been described above and shown in the accompanying drawings, but various modifications and changes may be made without departing from the scope thereof.

Claims

1. An image processing method, characterized in that: include: Acquire a preset image template, wherein the preset image template includes an image pre-synthesis area and template image content, wherein the image pre-synthesis area is used to synthesize image content of a predetermined type, and the template image content is content of an area outside the image pre-synthesis area; Determine the target image file to be processed; Determining whether the target image file includes target image content to be processed that meets the requirement of synthesizing the predetermined type of image content; If the target image file includes the target image content to be processed, detecting and processing the target image content to be processed in the target image file to obtain contour information of the target image content to be processed; Extracting the to-be-processed target image content from the target image file based on the contour information, and obtaining an image to be synthesized that only contains the to-be-processed target image content; The image to be synthesized is subjected to content compensation synthesis processing in the image pre-synthesis area to generate a target image that fuses the template image content and the target image content to be processed, wherein the content compensation synthesis processing of the image to be synthesized in the image pre-synthesis area includes: obtaining image feature information of the image to be synthesized, and obtaining preset description information of the image pre-synthesis area, the image feature information includes size, color and brightness information of the target image content extracted from the image to be synthesized, the preset description information includes preset size, color and brightness information for describing the image pre-synthesis area, analyzing and processing are performed according to the image feature information and the preset description information to obtain an image synthesis strategy that matches the preset image template and the image to be synthesized, performing content compensation processing on the image to be synthesized and the template image content according to the content compensation information in the image synthesis strategy to obtain the compensated image to be synthesized and the template image content, and performing image synthesis on the compensated image to be synthesized and the template image content in the image pre-synthesis area.

2. The method according to claim 1, characterized in that: The step of determining the target image file to be processed comprises: In response to a selection operation on a candidate image, determining the candidate image selected by the selection operation as a target image file to be processed; The determining whether the target image file includes the target image content to be processed that meets the requirement of synthesizing the predetermined type of image content includes: Obtaining image description information corresponding to the target image file; According to the image description information, it is determined whether the target image file includes target image content to be processed that meets the requirement of synthesizing the predetermined type of image content.

3. The method according to claim 1, characterized in that The candidate images include the target image file. Before obtaining the target image file to be processed, the method further includes: extracting image content features from the candidate images; Feature joint recognition processing is performed based on the image content features to obtain image description information corresponding to the candidate image, wherein the image description information is used to indicate whether the image file includes target image content to be processed that meets the requirements for synthesizing the predetermined type of image content.

4. The method according to claim 3, characterized in that The extracting the image content feature from the candidate image comprises: Inputting the candidate image into a content feature extraction model to perform content feature extraction processing to obtain the image content feature; The performing feature joint recognition processing based on the image content features to obtain image description information corresponding to the candidate image includes: The image content features are input into a content feature recognition model for feature joint recognition processing to obtain the image description information.

5. The method according to claim 4, characterized in that The step of inputting the candidate image into a content feature extraction model to perform content feature extraction processing to obtain the image content feature comprises: Cross-segmenting the candidate image according to a predetermined segmentation strategy to obtain at least two sub-images with overlapping parts; At least two of the sub-images are input into the content feature extraction model to perform local content feature extraction processing to obtain the image content features.

6. The method according to claim 5, characterized in that The step of cross-segmenting the candidate image according to a predetermined segmentation strategy to obtain at least two sub-images with overlapping parts includes: Detecting the aspect ratio of the candidate image; If the aspect ratio is higher than a predetermined threshold, the candidate image is cross-segmented according to a predetermined segmentation strategy to obtain at least two sub-images with overlapping portions.

7. The method according to claim 1, characterized in that The contour information is a mask image; the detecting and processing of the target image content to be processed in the target image file to obtain the contour information of the target image content to be processed includes: The target image file is input into the image segmentation and extraction model for content segmentation detection processing to obtain the mask image corresponding to the content of the target image to be processed.

8. The method according to claim 7, characterized in that The step of extracting the target image content to be processed from the target image file based on the contour information to obtain the image to be synthesized having only the target image content to be processed includes: The mask image and the target image file are processed by mask superposition operation to obtain the image to be synthesized, wherein the image to be synthesized includes a content area corresponding to the content of the target image to be processed, and the area outside the content area in the image to be synthesized is a transparent area.

9. The method according to claim 8, characterized in that The step of inputting the target image file into an image segmentation and extraction model for content segmentation detection processing to obtain the mask image corresponding to the content of the target image to be processed includes: Performing a size conversion process on the target image file to obtain a converted image of the target size; Inputting the transformed image into the image segmentation and extraction model to perform content segmentation detection processing to obtain the mask image corresponding to the content of the target image to be processed; The step of performing mask superposition operation on the mask image and the target image file to obtain the image to be synthesized includes: Transforming the size of the mask image to a size corresponding to the target image file to obtain a transformed mask image; Performing filtering and noise reduction processing on the transformed mask image to obtain a target mask image; The target mask image and the target image file are subjected to mask superposition operation processing to obtain the image to be synthesized.

10. The method according to claim 1, characterized in that The performing content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area includes: Obtaining a preset content synthesis strategy corresponding to the preset image template; According to the content compensation information in the preset content synthesis strategy, the content of the image to be synthesized and the template image are subjected to content compensation processing to obtain the compensated content of the image to be synthesized and the template image; In the image pre-synthesis area, the compensated image to be synthesized is synthesized with the template image content.

11. An image processing method, characterized in that: include: Display an image synthesis interface, wherein a preset image template is displayed in the image synthesis interface, wherein the preset image template includes an image pre-synthesis area and template image content, wherein the image pre-synthesis area is used to synthesize a predetermined type of image content, and the template image content is the content of an area outside the image pre-synthesis area; In response to the synthesis operation in the image synthesis interface, the synthesized target image is displayed, the target image is generated by performing content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area, the image to be synthesized is generated by detecting and processing the content of the target image to be processed in the target image file, obtaining contour information of the content of the target image to be processed, and extracting the content of the target image to be processed from the target image file based on the contour information, the image to be processed only contains the content of the target image to be processed, and the content of the target image to be processed meets the requirements for synthesizing the predetermined type of image content, and the generation method of the target image includes: obtaining image feature information of the image to be synthesized, and obtaining the image feature information of the image to be synthesized. Preset description information of a pre-synthesis area, wherein the image feature information includes size, color and brightness information of a target image content extracted from an image to be synthesized, the preset description information includes preset size, color and brightness information for describing the image pre-synthesis area, analyzing and processing are performed according to the image feature information and the preset description information to obtain an image synthesis strategy that matches the preset image template and the image to be synthesized, performing content compensation processing on the image to be synthesized and the template image content according to the content compensation information in the image synthesis strategy to obtain the compensated image to be synthesized and the template image content, and performing image synthesis on the compensated image to be synthesized and the template image content in the image pre-synthesis area.

12. The method according to claim 11, characterized in that The step of displaying the synthesized target image in response to the synthesis operation in the image synthesis interface includes: In response to a synthesis triggering operation for the preset image template in the image synthesis interface, displaying an image file selection interface; In response to a synthesis triggering operation on the target image file in the image file selection interface, a synthesized target image is displayed.

13. The method according to claim 11, characterized in that The displaying of the synthesized target image in response to the synthesis triggering operation for the target image file in the image file selection interface comprises: In response to a selection operation on a candidate image in the image file selection interface, highlighting and displaying the target image file, the target image file being the candidate image selected by the selection operation; In response to a synthesis triggering operation in the image file selection interface, a synthesized target image is displayed.

14. An image processing device, characterized in that: include: A template acquisition module, used to acquire a preset image template, wherein the preset image template includes an image pre-synthesis area and template image content, wherein the image pre-synthesis area is used to synthesize a predetermined type of image content, and the template image content is content of an area outside the image pre-synthesis area; An image acquisition module, used for determining a target image file to be processed; A content determination module, used for determining whether the target image file includes target image content to be processed that meets the requirement of synthesizing the predetermined type of image content; an image processing module, configured to, if the target image file includes the target image content to be processed, detect the target image content to be processed in the target image file to obtain contour information of the target image content to be processed, extract the target image content to be processed from the target image file based on the contour information, and obtain an image to be synthesized containing only the target image content to be processed; An image synthesis module is used to perform content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area to generate a target image that fuses the template image content and the target image content to be processed. The content compensation synthesis processing on the image to be synthesized in the image pre-synthesis area includes: obtaining image feature information of the image to be synthesized, and obtaining preset description information of the image pre-synthesis area, wherein the image feature information includes size, color and brightness information of the target image content extracted from the image to be synthesized, and the preset description information includes preset size, color and brightness information for describing the image pre-synthesis area; analyzing and processing are performed according to the image feature information and the preset description information to obtain an image synthesis strategy that matches the preset image template and the image to be synthesized; performing content compensation processing on the image to be synthesized and the template image content according to the content compensation information in the image synthesis strategy to obtain the compensated image to be synthesized and the template image content; and performing image synthesis on the compensated image to be synthesized and the template image content in the image pre-synthesis area.

15. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor of a computer, the computer is caused to execute the method according to any one of claims 1 to 13.

16. An electronic device, characterized in that: include: a memory storing a computer program; A processor reads a computer program stored in a memory to execute the method according to any one of claims 1 to 13.

17. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method of any one of claims 1 to 13 is implemented.