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

By identifying and removing text materials and target object areas in advertising images, a deconstructed image template is generated, which solves the problem of low advertising template generation efficiency in the existing technology and achieves more efficient advertising material generation.

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

Patent Information

Application Number
CN202410725233.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-09-27

AI Technical Summary

Technical Problem

When generating advertising templates using existing technology, it requires a lot of manpower and time to decompose advertising images into different layers, resulting in low generation efficiency.

Method used

By identifying the text material and target object in the image, removing the text material and determining the area of ​​the target object, an image template is generated, so that the text material and target object are in a deconstructed state for subsequent replacement to generate a new image.

Benefits of technology

It improves the efficiency of image template generation. Compared with the method of decomposing layers, it reduces manual operation time and improves the efficiency of batch generation of advertising materials.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118710773A
    Figure CN118710773A
Patent Text Reader

Abstract

The invention provides an image processing method and device, electronic equipment, a computer readable storage medium and a computer program product, and the method comprises the steps: obtaining a to-be-processed image comprising a target object and a text material, carrying out the text material recognition of the to-be-processed image, and obtaining the distribution of the text material in the to-be-processed image; based on the distribution of the text materials in the to-be-processed image, removing the text materials in the to-be-processed image to obtain an intermediate image corresponding to the to-be-processed image; performing position detection on the target object in the intermediate image to obtain an area where the target object is located in the intermediate image; generating an image template corresponding to the to-be-processed image based on the distribution of the text material in the to-be-processed image, the intermediate image and the area where the target object is located; wherein the text material and the target object in the image template are in a deconstruction state, and the image template is used for generating a new image after replacing the target object or the text material. Therefore, the generation efficiency of the image template can be improved.
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, electronic device, computer-readable storage medium, and computer program product. Background Art

[0002] When generating advertising templates, related technologies mostly use the layer function of image editing software to decompose the advertising image into different layers, each layer representing an independent element, such as a text layer, a picture layer, a background layer, etc., and then adjust the order, transparency, blending mode and other properties of the layers to achieve rapid modification and customization of the advertisement. However, such a method requires a lot of manpower and time to deconstruct the advertising image to generate the advertising template, which results in low efficiency in generating the advertising template. Summary of the invention

[0003] The embodiments of the present application provide an image processing method, device, electronic device, computer-readable storage medium, and computer program product, which can improve the efficiency of generating image templates.

[0004] The technical solution of the embodiment of the present application is implemented as follows:

[0005] The present application provides an image processing method, the method comprising:

[0006] Acquire an image to be processed including a target object and text material, and perform text material recognition on the image to be processed to obtain the distribution of the text material in the image to be processed;

[0007] Based on the distribution of the text material in the image to be processed, removing the text material in the image to be processed to obtain an intermediate image corresponding to the image to be processed;

[0008] Performing position detection on the target object in the intermediate image to obtain an area where the target object is located in the intermediate image;

[0009] Based on the distribution of the text material in the image to be processed, the intermediate image and the area where the target object is located, an image template corresponding to the image to be processed is generated;

[0010] The text material and the target object in the image template are in a deconstructed state, and the image template is used to generate a new image after replacing the target object or the text material.

[0011] The present application provides an image processing device, the device comprising:

[0012] A recognition module is used to obtain an image to be processed including a target object and text material, and perform text material recognition on the image to be processed to obtain the distribution of the text material in the image to be processed;

[0013] A removal module, used for removing the text material in the image to be processed based on the distribution of the text material in the image to be processed, so as to obtain an intermediate image corresponding to the image to be processed;

[0014] A detection module, used to detect the position of the target object in the intermediate image to obtain an area where the target object is located in the intermediate image;

[0015] A generation module is used to generate an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image and the area where the target object is located; wherein the text material and the target object in the image template are in a deconstructed state, and the image template is used to generate a new image after replacing the target object or the text material.

[0016] In the above scheme, the recognition module is further used to perform text recognition on the image to be processed to obtain the text material of the image to be processed; and perform position analysis on the text material to obtain the distribution of the text material in the image to be processed.

[0017] In the above scheme, the removal module is used to remove the text material in the image to be processed based on the distribution of the text material in the image to be processed to obtain a text-free image; and to repair the area of ​​the text-free image where the text material is removed to obtain an intermediate image corresponding to the image to be processed.

[0018] In the above scheme, the removal module is also used to determine the associated area of ​​the area where the text material is removed in the text-free image, and obtain pixel information of the associated area; based on the pixel information, the area where the text material is removed in the image to be processed is reconstructed to obtain an intermediate image corresponding to the image to be processed.

[0019] In the above scheme, the detection module is also used to obtain the description information of the image to be processed, and the description information is used to describe the target object in the image to be processed; based on the description information, the target object in the intermediate image is located to obtain the position of the target object in the intermediate image; based on the position of the target object in the intermediate image, a bounding box of the target object is generated; wherein the bounding box is used to indicate the area where the target object in the intermediate image is located; the generation module is also used to generate an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image and the bounding box.

[0020] In the above scheme, the device also includes an analysis module, which is used to analyze the target object to obtain the size of the target object in the intermediate image; the detection module is also used to generate a bounding box of the target object based on the position of the target object in the intermediate image and the size of the target object in the intermediate image.

[0021] In the above scheme, the device also includes a segmentation module, which is used to segment the intermediate image with the bounding box as an anchor point to obtain a mask image of the target object; wherein the mask image is used to indicate the area where the target object is located in the intermediate image; the generation module is also used to generate an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image and the mask image.

[0022] In the above scheme, the device also includes a detection module, which is used to perform edge detection on the target object based on the mask image to obtain target pixel points in the mask image; wherein the target pixel point is a pixel point whose grayscale difference with at least one adjacent pixel point is greater than a difference threshold; line growth is performed based on the target pixel point to obtain an object frame of the target object, and the object frame is used to indicate the shape of the target object; based on the object frame, a target mask image of the target object is generated, and the target mask image is used to indicate the area where the target object is located in the intermediate image; the generation module is also used to generate an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image and the target mask image.

[0023] In the above scheme, the detection module is also used to expand the target pixel point to obtain multiple extension points; wherein the extension point is a pixel point whose similarity with the target pixel point reaches a similarity threshold; the target pixel point is connected with the multiple extension points to obtain an object frame of the target object.

[0024] In the above scheme, the generation module is also used to transform the text material in the image to be processed based on the distribution of the text material in the image to be processed to obtain editable text corresponding to the text material; based on the area where the target object is located, obtain the mask image corresponding to the target object; and fuse the editable text, the intermediate image and the mask image to obtain an image template corresponding to the image to be processed.

[0025] In the above scheme, the target object includes an advertising object, the image to be processed is an advertising image including the advertising object, the text material includes an advertising text material, the recognition module is further used to obtain an advertising image including the advertising object and the advertising text material, and perform text material recognition on the advertising image including the advertising object to obtain the distribution of the advertising text material in the advertising image; the removal module is further used to remove the advertising text material in the advertising image based on the distribution of the advertising text material in the advertising image to obtain an intermediate image corresponding to the advertising image; the detection module is further used to perform position detection on the advertising object in the intermediate image to obtain the area where the advertising object is located in the intermediate image; the generation module is further used to generate an advertising template corresponding to the advertising image based on the distribution of the advertising text material in the advertising image, the intermediate image corresponding to the advertising image, and the area where the advertising object is located.

[0026] An embodiment of the present application provides an electronic device, including:

[0027] A memory for storing executable instructions;

[0028] The processor is used to implement the image processing method provided in the embodiment of the present application when executing the executable instructions stored in the memory.

[0029] An embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will execute the image processing method provided by the embodiment of the present application.

[0030] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instruction from the computer-readable storage medium, and the processor executes the computer executable instruction, so that the electronic device performs the image processing method provided in the embodiment of the present application.

[0031] The embodiments of the present application have the following beneficial effects:

[0032] First, the text material recognition is performed on the image to be processed including the target object and the text material to obtain the distribution of the text material in the image to be processed, and then based on the distribution of the text material in the image to be processed, the text material in the image to be processed is removed to obtain the intermediate image corresponding to the image to be processed, and then the area where the target object is located in the intermediate image is determined, so as to generate an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image and the area where the target object is located. In this way, after determining the distribution of the text material in the image to be processed, the text material is directly removed based on the distribution of the text material in the image to be processed to obtain the intermediate image, and then the image template is generated in combination with the distribution of the text material in the image to be processed, the intermediate image and the area where the target object is located, which improves the efficiency of generating image templates compared to the solution in the related art that requires decomposing the advertising image into different layers to generate advertising templates. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 is a schematic diagram of the architecture of an image processing system 100 provided in an embodiment of the present application;

[0034] Figure 2 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0035] Figure 3 is a flowchart of an image processing method provided in an embodiment of the present application;

[0036] Figure 4 is a schematic diagram of an image to be processed provided by an embodiment of the present application;

[0037] Figure 5 is a schematic diagram of the distribution of text materials in an image to be processed provided by an embodiment of the present application;

[0038] Figure 6 is a flowchart of a process for determining an intermediate image corresponding to an image to be processed provided by an embodiment of the present application;

[0039] Figure 7 is a schematic diagram of a text-free image provided in an embodiment of the present application;

[0040] Figure 8 is a schematic diagram of an intermediate image provided in an embodiment of the present application;

[0041] Fig. 9 is a flowchart of a process for determining an area where a target object is located in an intermediate image provided by an embodiment of the present application;

[0042] Fig.10 is a schematic diagram of a bounding box of a target object provided in an embodiment of the present application;

[0043] Fig.11 is a schematic diagram of a mask image of a target object provided in an embodiment of the present application;

[0044] Fig.12 is a schematic diagram of a target mask image of a target object provided in an embodiment of the present application;

[0045] Fig.13 is a schematic diagram of a process of generating an image template provided in an embodiment of the present application;

[0046] Fig.14 is a schematic diagram of a process of generating an image template provided in an embodiment of the present application;

[0047] Fig.15 is a schematic diagram of a target image template provided in an embodiment of the present application;

[0048] Fig.16 is a flowchart of an image processing method provided in an embodiment of the present application;

[0049] Fig.17 It is a technical architecture diagram of an advertising creative template deconstruction method based on AI integration provided in an embodiment of the present application;

[0050] Fig.18 It is a process diagram of the advertising creative template deconstruction method based on AI integration provided in an embodiment of the present application. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0052] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0053] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0054] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0055] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0056] 1) Client, also known as the user end, refers to the program corresponding to the server that provides local services to users. Except for some applications that can only run locally, it is generally installed on an ordinary client and needs to cooperate with the server to run, that is, it requires corresponding servers and service programs in the network to provide corresponding services. In this way, specific communication connections need to be established on the client and server sides to ensure the normal operation of the application.

[0057] 2) Photoshop Document (PSD) is a file format designed specifically for Photoshop. It is used to store and edit various image elements such as images, layers, filters, masks, texts, effects, etc. It allows users to create complex multi-layered, high-resolution images in Photoshop software. Using the PSD format, users can save and retain all editing and design information of the image for future modification, editing or adjustment.

[0058] 3) Optical Character Recognition (OCR), which is used to recognize and extract text information from images or scanned documents and convert them into editable electronic text format.

[0059] 4) Object Detection aims to identify specific objects in images or videos and determine their locations. This task usually includes two main aspects: object recognition and object localization. Object recognition refers to identifying the categories of objects present in an image, such as identifying cats, dogs, cars, etc. in an image. Object localization refers to determining the location of each identified object in the image, and a bounding box is usually used to describe the location of the object.

[0060] 5) Image Inpainting refers to the process of restoring an image by filling in missing parts or damaged areas. This technology is often used to restore old photos, remove undesirable content in images (such as watermarks, objects, etc.), or reconstruct images in digital image processing. The goal of these technologies is to fill in the missing parts as accurately as possible so that the restored image looks natural and coherent, and the traces of restoration are visually undetectable.

[0061] 6) Image Segment refers to the process of dividing a digital image into multiple regions or objects with semantic information. This technology has a wide range of applications in the fields of computer vision and image processing. Image segmentation can be performed based on different features, including color, texture, edges, etc. It can be used to identify and locate objects, regions or features in an image, thus providing a basis for image understanding, analysis and recognition.

[0062] 7) Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.

[0063] 8) Logo, usually refers to a series of design elements used by a company, brand, organization or individual to identify its identity, image or services. Logo can include text, patterns, symbols, colors, shapes and other visual elements.

[0064] See also Figure 1 , Figure 1 It is a schematic diagram of the architecture of the image processing system 100 provided in an embodiment of the present application. The terminal (terminal 400 is shown as an example) is connected to the server 200 via the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two. The terminal 400 is used for the user to use the client 401, which is displayed on the display interface (display interface 401-1 is shown as an example). The terminal 400 and the server 200 are connected to each other via a wired or wireless network.

[0065] The server 200 is used to obtain an image to be processed including a target object and text material, and perform text material recognition on the image to be processed to obtain the distribution of the text material in the image to be processed; based on the distribution of the text material in the image to be processed, remove the text material in the image to be processed to obtain an intermediate image corresponding to the image to be processed; perform position detection on the target object in the intermediate image to obtain the area where the target object is located in the intermediate image; based on the distribution of the text material in the image to be processed, the intermediate image and the area where the target object is located, generate an image template corresponding to the image to be processed; wherein the text material and the target object in the image template are in a deconstructed state, and the image template is used to generate a new image after replacing the target object or the text material; and send the image template corresponding to the image to be processed to the terminal 400;

[0066] The terminal 400 is further used to receive an image template corresponding to the image to be processed, and display the image template based on a display interface.

[0067] In some embodiments, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or 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, content distribution networks (CDN, Content Deliver Network), and big data and artificial intelligence platforms. The terminal 400 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a set-top box, an intelligent voice interaction device, a smart home appliance, a vehicle-mounted terminal, an aircraft, and a mobile device (e.g., a mobile phone, a portable music player, a personal digital assistant, a dedicated messaging device, a portable gaming device, an intelligent speaker, and a smart watch), etc., but is not limited thereto. The terminal device and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.

[0068] See also Figure 2 , Figure 2 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. In practical applications, the electronic device can be Figure 1 The server 200 or terminal 400 shown, see Figure 2 , Figure 2 The electronic device shown includes: at least one processor 410, a memory 450, at least one network interface 420 and a user interface 430. The various components in the terminal 400 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 440 is not shown in FIG. Figure 2 Various buses are labeled as bus system 440 .

[0069] Processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0070] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0071] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.

[0072] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.

[0073] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.

[0074] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0075] A network communication module 452, used to reach other electronic devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB), etc.;

[0076] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., display screen, speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripherals and displaying content and information);

[0077] The input processing module 454 is used to detect one or more user inputs or interactions from one of the one or more input devices 432 and translate the detected inputs or interactions.

[0078] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 2 An image processing device 455 stored in a memory 450 is shown, which may be software in the form of a program or a plug-in, and includes the following software modules: a recognition module 4551, a removal module 4552, a detection module 4553, and a generation module 4554. These modules are logical, and thus may be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.

[0079] In other embodiments, the device provided in the embodiments of the present application can be implemented in hardware. As an example, the image processing device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the image processing method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs) or other electronic components.

[0080] In some embodiments, the terminal or server can implement the image processing method provided in the embodiments of the present application by running a computer program. For example, the computer program can be a native program or software module in the operating system; it can be a native application (APP, Application), that is, a program that needs to be installed in the operating system to run, such as an instant messaging APP, a web browser APP; it can also be a small program, that is, a program that can be run only by downloading it to a browser environment; it can also be a small program that can be embedded in any APP. In short, the above-mentioned computer program can be an application, module or plug-in in any form.

[0081] Based on the above description of the image processing system and electronic device provided by the embodiment of the present application, the image processing method provided by the embodiment of the present application is described below. In actual implementation, the image processing method provided by the embodiment of the present application can be implemented by the terminal or the server alone, or by the terminal and the server in collaboration, so that Figure 1 The server 200 in the embodiment of the present application alone executes the image processing method provided by the embodiment of the present application as an example for explanation. Figure 3 , Figure 3 is a flow chart of the image processing method provided by the embodiment of the present application. Figure 3 The steps shown are explained.

[0082] Step 101: The server obtains an image to be processed including a target object and text material, and performs text material recognition on the image to be processed to obtain the distribution of the text material in the image to be processed.

[0083] In actual implementation, the server obtains the object to be processed including the target object and the text material, wherein the image to be processed may be pre-stored locally, or may be obtained from the outside world (such as the Internet), or may be collected in real time, for example, collected in real time by a camera. This embodiment of the application does not limit this.

[0084] It should be noted that the image to be processed can be a game image corresponding to a virtual scene during a game, or a promotional image, such as an advertising image, or a character image, a landscape image, etc., which is not limited in the embodiments of the present application. Among them, the target object in the image to be processed can be a character or an object. For example, when the image to be processed is a promotional image, the target object in the image to be processed is a commodity, and when the image to be processed is a character image, the target object in the image to be processed is a specific person, etc. At the same time, the target object can be one or more, which is not limited in the embodiments of the present application.

[0085] For example, see Figure 4 , Figure 4 is a schematic diagram of an image to be processed provided in an embodiment of the present application, based on Figure 4 , the image to be processed is an advertisement image, and the target object is the advertisement object in the advertisement image, that is, the commodity, wherein, Figure 4 The dotted frame 401 indicates the target object, that is, the advertisement object in the advertisement image.

[0086] It should be noted that the text material words or logos of the image to be processed can be used to describe or introduce the corresponding target object. In actual implementation, after obtaining the image to be processed including the target object and the text material, the image to be processed can also be subjected to text material recognition to obtain the distribution of the text material in the image to be processed. Specifically, the process of performing text material recognition on the image to be processed and obtaining the distribution of the text material in the image to be processed can be to perform text recognition on the image to be processed to obtain the text material of the image to be processed; and to perform position analysis on the text material to obtain the distribution of the text material in the image to be processed.

[0087] It should be noted that performing position analysis on text materials to obtain the distribution of text materials in the image to be processed means analyzing the relative position of the text materials in the image to be processed to obtain the relative position of the text materials in the image to be processed, and then directly generating the distribution of the text materials in the image to be processed based on the relative position of the text materials in the image to be processed.

[0088] It should be noted that the distribution of text material in the image to be processed, that is, the text layout of the image to be processed, is not only used to indicate the relative position of the text material in the image to be processed, but also used to indicate the relative position relationship between the text materials in the image to be processed, and between the text material and the target object. Specifically, based on the relative position of the text material in the image to be processed, the process of directly generating the distribution of the text material in the image to be processed can be, based on the relative position of the text material in the image to be processed, masking the non-text area in the image to be processed to obtain the distribution of the text material in the image to be processed, wherein the non-text area indicates the area outside the area where the text material is located in the image to be processed.

[0089] For example, see Figure 5 , Figure 5 is a schematic diagram of the distribution of text materials in the image to be processed provided by the embodiment of the present application, based on Figure 5 , the image to be processed is an advertisement image, and the dashed line frame 501 and the dashed line frame 502 indicate text materials in the image to be processed.

[0090] Step 102: based on the distribution of text materials in the image to be processed, remove the text materials in the image to be processed to obtain an intermediate image corresponding to the image to be processed.

[0091] In actual implementation, after determining the distribution of text materials in the image to be processed, see Figure 6 , Figure 6 is a flowchart of a process for determining an intermediate image corresponding to an image to be processed provided by an embodiment of the present application, based on Figure 6The process of determining the intermediate image corresponding to the image to be processed, that is, step 102, can be implemented by the following steps.

[0092] Step 1021 , based on the distribution of text materials in the image to be processed, the text materials in the image to be processed are removed to obtain a text-free image.

[0093] In actual implementation, after determining the distribution of text materials in the image to be processed, the image to be processed is subjected to cutout processing based on the distribution of text materials in the image to be processed, that is, the text materials in the image to be processed are cut out to obtain a text-free image. Figure 7 , Figure 7 is a schematic diagram of a text-free image provided in an embodiment of the present application, based on Figure 7 , Figure 7 The dashed box 701 in a indicates the text material in the image to be processed. Figure 7 The text material in the image to be processed indicated by the dotted box 701 in a is removed to obtain the following Figure 7 The b indicates an image without text.

[0094] Step 1022, repairing the area of ​​the text-free image where the text material is removed, to obtain an intermediate image corresponding to the image to be processed.

[0095] It should be noted that the intermediate image is used to indicate the non-text area in the image to be processed, that is, the background image of the text material in the image to be processed.

[0096] In actual implementation, the process of repairing the area where the text material is removed in the text-free image to obtain the intermediate image corresponding to the image to be processed can be: in the text-free image, determine the associated area of ​​the area where the text material is removed, and obtain pixel information of the associated area; based on the pixel information, reconstruct the area where the text material is removed in the image to be processed to obtain the intermediate image corresponding to the image to be processed.

[0097] It should be noted that the associated area may be the surrounding area of ​​the area where the text material is removed, for example, the area surrounding the removed text material, and the pixel information of the associated area obtained may be the pixel value of each pixel in the associated area, so that the area where the text material is removed in the image to be processed is reconstructed based on the pixel value of each pixel in the associated area to obtain an intermediate image corresponding to the image to be processed. Figure 8 , Figure 8 is a schematic diagram of an intermediate image provided in an embodiment of the present application, based on Figure 8 , Figure 8 The black area indicated by the dotted frame 801 in a is the area where the text material is removed. Figure 8The region indicated by the dashed box 801 in a where the text material is removed is reconstructed to obtain Figure 8 The intermediate image corresponding to the image to be processed indicated by b.

[0098] In this way, based on the pixel value of each pixel point in the associated area, the area where the text material is removed in the processed image is reconstructed, ensuring the fit between the reconstructed image area and the associated area, reducing the abruptness of the reconstructed image area, and thus improving the generation effect of the image template in the subsequent process of generating the image template.

[0099] Step 103: perform position detection on the target object in the intermediate image to obtain the area where the target object is located in the intermediate image.

[0100] In actual implementation, for the process of detecting the position of the target object in the intermediate image and obtaining the area where the target object is located in the intermediate image, see Fig. 9 , Fig. 9 is a flowchart of a process for determining the area where the target object is located in the intermediate image provided by an embodiment of the present application, based on Fig. 9 , perform position detection on the target object in the intermediate image to obtain the area where the target object is located in the intermediate image, that is, step 103 can be implemented by the following steps.

[0101] Step 1031 , obtaining description information of the image to be processed, where the description information is used to describe the target object in the image to be processed.

[0102] It should be noted that the description information may be pre-set and used to describe the target object in the image to be processed. As mentioned above, when the image to be processed is a promotional image, the target object in the image to be processed is a commodity, so the description information may be the specific type or name of the commodity, such as a water cup, a watch, XX juice, etc. When the image to be processed is a person image, the target object in the image to be processed is a specific person, so the description information may be a child, a man, a woman, etc. This embodiment of the application does not limit this.

[0103] Among them, the number of target objects can be one or more, so that the description information can be used to describe one or more target objects. For example, when the image to be processed is a promotional image and the number of target objects is one, the target object in the image to be processed is a commodity, and the commodity includes a water cup, then the description information can be a water cup. When the image to be processed is a promotional image and the number of target objects is multiple, the target object in the image to be processed is a commodity, and the commodity includes a water cup and a watch, then the description information can be a water cup and a watch.

[0104] In this way, the target object in the image to be processed is determined by setting the description information, so that the corresponding image template is generated in the subsequent process, which improves the flexibility of the generated image template. At the same time, compared with directly processing the image to be processed to generate the image template, using the description information as a constraint condition can also improve the accuracy of the generated image template.

[0105] Step 1032: locate the target object in the intermediate image based on the description information to obtain the position of the target object in the intermediate image.

[0106] It should be noted that after obtaining the description information, the process of locating the target object in the intermediate image is to search for image content that meets the description information in the intermediate image. Since the description information is used to describe the target object in the image to be processed, searching for image content that meets the description information in the intermediate image is to search for the target object in the intermediate image. After searching for image content that meets the description information, the area where the image content that meets the description information is located is used as the position of the target object in the intermediate image.

[0107] Step 1033: Generate a bounding box of the target object based on the position of the target object in the intermediate image; wherein the bounding box is used to indicate the area where the target object is located in the intermediate image.

[0108] In actual implementation, the bounding box can be a rectangle or a circle, etc., which is not limited in the embodiments of the present application; after determining the position of the target object in the intermediate image, the target object is analyzed to obtain the size of the target object in the intermediate image; thus, the process of generating the bounding box of the target object based on the position of the target object in the intermediate image can be to generate the bounding box of the target object based on the position of the target object in the intermediate image and the size of the target object in the intermediate image.

[0109] It should be noted that, since the bounding box is used to indicate the area where the target object is located in the intermediate image, generating the bounding box of the target object means determining the area where the target object is located in the intermediate image; and the size of the target object in the intermediate image refers to the size of the target object in the intermediate image, that is, the area occupied by the target object in the intermediate image. Therefore, the process of generating the bounding box of the target object based on the position of the target object in the intermediate image and the size of the target object in the intermediate image is to generate a bounding box that can enclose the target object at the position of the target object in the intermediate image and based on the size of the target object in the intermediate image. For example, see Fig.10 , Fig.10 is a schematic diagram of a bounding box of a target object provided in an embodiment of the present application, based on Fig.10, the dotted box 1001 indicates the target object, and the solid box 1002 indicates the bounding box of the target object.

[0110] In actual implementation, after generating the bounding box of the target object, as mentioned above, the bounding box is used to indicate the area where the target object is located in the intermediate image. Therefore, generating the bounding box of the target object also determines the area where the target object is located in the intermediate image. Based on this, in the subsequent process of generating an image template corresponding to the image to be processed based on the distribution of text material in the image to be processed, the intermediate image and the area where the target object is located, the image template corresponding to the image to be processed can be generated based on the distribution of text material in the image to be processed, the intermediate image and the bounding box.

[0111] It should be noted that the process of generating an image template corresponding to the image to be processed based on the distribution of text materials in the image to be processed, the intermediate image and the area where the target object is located, that is, the process of generating an image template corresponding to the image to be processed based on the distribution of text materials in the image to be processed, the intermediate image and the bounding box, will be described later and will not be repeated here in the embodiments of the present application.

[0112] In some embodiments, in addition to directly generating an image template corresponding to the image to be processed based on the distribution of text material in the image to be processed, the intermediate image and the bounding box, the bounding box can be further processed to obtain a mask image of the target object, thereby generating an image template corresponding to the image to be processed based on the distribution of text material in the image to be processed, the intermediate image and the mask image of the target object. Specifically, after generating the bounding box of the target object based on the position of the target object in the intermediate image, the intermediate image can be segmented with the bounding box as an anchor point to obtain the mask image of the target object; wherein the mask image is used to indicate the area where the target object is located in the intermediate image; thereby, in the process of generating an image template corresponding to the image to be processed based on the distribution of text material in the image to be processed, the intermediate image and the bounding box, the image template can be generated based on the distribution of text material in the image to be processed, the intermediate image and the mask image.

[0113] It should be noted that the anchor point is used to locate and identify the starting point or key point of the target object, and is used to determine the position and boundary of the target object. In this way, the intermediate image is segmented with the bounding box as the anchor point to obtain the mask image of the target object. For example, see Fig.11 , Fig.11 is a schematic diagram of a mask image of a target object provided in an embodiment of the present application, based on Fig.11 , using the bounding box as the anchor point, segment the intermediate image and obtain Fig.11 The mask image of the target object is shown.

[0114] It should be noted that the mask image is used to indicate the area where the target object is located in the intermediate image, and the bounding box is also used to indicate the area where the target object is located in the intermediate image. However, since the mask image is segmented with the bounding box as the anchor point, the mask image can more accurately indicate the area where the target object is located in the intermediate image than the bounding box. At the same time, the process of generating an image template corresponding to the image to be processed based on the distribution of text materials in the image to be processed, the intermediate image and the mask image of the target object will be described later, and the embodiments of the present application will not be repeated here.

[0115] In this way, using the bounding box as an anchor point, the target object can be better identified and located, improving the accuracy and completeness of the segmentation result. Then, an image template is generated based on the segmentation result, i.e., the mask image, further improving the accuracy of the generated image template.

[0116] In some embodiments, after the intermediate image is segmented with the bounding box as an anchor point to obtain a mask image of the target object, the mask image can be further processed to obtain a target mask image, thereby generating an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image and the target mask image of the target object. Specifically, after the intermediate image is segmented with the bounding box as an anchor point to obtain the mask image of the target object, edge detection is performed on the target object based on the mask image to obtain a target pixel in the mask image; wherein the target pixel is a pixel whose grayscale difference with at least one adjacent pixel is greater than a difference threshold; line growth is performed based on the target pixel to obtain an object frame of the target object, and the object frame is used to indicate the shape of the target object; based on the object frame, a target mask image of the target object is generated, and the target mask image is used to indicate the area where the target object is located in the intermediate image; thus, the process of generating an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image and the mask image can be generating an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image and the target mask image.

[0117] It should be noted that the process of edge detection of the target object based on the mask image is used to identify potential lines in the image and find points in the image with significant grayscale changes. These points may constitute the endpoints or inflection points of the lines, wherein the points with significant grayscale changes are also target pixels, that is, pixels whose grayscale difference with at least one adjacent pixel is greater than a difference threshold. Specifically, the grayscale value of each pixel in the mask image is first obtained, and then the target pixel is selected from multiple pixels based on the grayscale value of each pixel, so that the target pixel is used as the starting point for the growth of the candidate line.

[0118] In actual implementation, the process of performing line growth based on the target pixel point to obtain the object frame of the target object can be: expanding the target pixel point to obtain multiple extension points; wherein the extension point is a pixel point whose similarity with the target pixel point reaches a similarity threshold; and connecting the target pixel point with the multiple extension points to obtain the object frame of the target object.

[0119] It should be noted that after determining the target pixel point, based on the similarity with the target pixel point, extension points are searched around the target pixel point, and these extension points should be similar to the characteristics of the target pixel point, for example, having similar grayscale values, directions or texture features, etc.; specifically, the pixel features of the target pixel point and the pixel features of other pixels within the target range around the target pixel point are obtained, and the pixel features include the grayscale values, directions or texture features of the corresponding pixel points; then the pixel features of the target pixel point are matched with the pixel features of the other pixels, and when the matching result indicates that the similarity between the corresponding other pixel points and the target pixel point reaches a similarity threshold, the other pixel points are determined as extension points.

[0120] It should be noted that after determining the extension point, the extension point can also be extended to obtain multiple other extension points, where the other extension points are pixel points whose similarity with the extension point reaches a similarity threshold. Here, the process of extending the extension point to obtain multiple other extension points is similar to the process of extending the target pixel point to obtain multiple extension points described above, and will not be repeated here.

[0121] It should be noted that after determining other extension points, other extension points can continue to be extended until the extension termination condition is met, wherein the extension termination condition can be pre-set, such as the length, linearity, and rate of change of the target line. The target line is a line that can be formed based on the target pixel point, the extension point, and other extension points. When the growth of the line meets these conditions, the line growth process stops.

[0122] In actual implementation, for the process of connecting the target pixel point with multiple extension points to obtain the object frame of the target object, after connecting the target pixel point with multiple extension points, the connected lines can also be smoothed to obtain the object frame of the target object. In this way, noise and sharp turns are removed through smoothing, making the lines smoother and more continuous.

[0123] In actual implementation, after obtaining the object frame of the target object, the process of generating the target mask image of the target object based on the object frame is to segment the mask image with the object frame as the anchor point to obtain the target mask image; wherein, the process of segmenting the mask image with the object frame as the anchor point to obtain the target mask image is similar to the process of segmenting the intermediate image with the bounding box as the anchor point to obtain the mask image as described above, and this embodiment of the present application will not be described in detail. For example, see Fig.12 , Fig.12 is a schematic diagram of a target mask image of a target object provided in an embodiment of the present application, based on Fig.12 , based on the mask image, edge detection is performed on the target object to obtain the target pixel points in the mask image, and then line growth is performed based on the target pixel points to obtain the object frame of the target object, thereby generating the following Fig.12 Target mask image of the target object shown.

[0124] It should be noted that the target mask image is used to indicate the area where the target object is located in the intermediate image, and the mask image is also used to indicate the area where the target object is located in the intermediate image. However, since the target mask image is obtained based on the line growth process, the target mask image can more accurately indicate the area where the target object is located in the intermediate image than the mask image, that is, the target mask image can indicate the shape of the target object like the object box. In this way, the target object can be better identified and located through the target mask image, thereby further improving the accuracy of the generated image template in the process of generating the image template based on the target mask image.

[0125] In addition, the process of generating an image template corresponding to the image to be processed based on the distribution of text materials in the image to be processed, the intermediate image and the target mask image of the target object will be described later, and the embodiments of the present application will not be repeated here.

[0126] Step 104, based on the distribution of text materials in the image to be processed, the intermediate image and the area where the target object is located, generate an image template corresponding to the image to be processed; wherein the text materials and the target object in the image template are in a deconstructed state, and the image template is used to generate a new image after replacing the target object or text materials.

[0127] It should be noted that the text material and the target object are in a deconstructed state, which means that the text material and the target object are in a state that can be replaced, that is, the text material and the target object in the image to be processed do not need to be decomposed into different elements, but these elements can be processed independently, so that when the text material and the target object are in a deconstructed state, the efficiency of processing the text material and the target object will be higher. Furthermore, if the image template includes the text material and the target object in a deconstructed state, the target object or the text material can be replaced to obtain a new image, that is, the image template is used to generate a new image after the target object or the text material is replaced.

[0128] In actual implementation, the process of generating an image template corresponding to the image to be processed based on the distribution of text material in the image to be processed, the intermediate image and the area where the target object is located can be: based on the distribution of text material in the image to be processed, the text material in the image to be processed is transformed to obtain editable text corresponding to the text material; based on the area where the target object is located, a mask image corresponding to the target object is obtained; and the editable text, the intermediate image and the mask image are merged to obtain the image template corresponding to the image to be processed.

[0129] It should be noted that, since the text material in the image to be processed is in image format, it is necessary to convert the text material in the image to be processed so that the text material becomes a text format, that is, editable text, so as to facilitate editing the text content of the text material. In this way, when the text content of the text material is edited, it can be considered that the text material is replaced; and for the process of obtaining the mask image corresponding to the target object based on the area where the target object is located, the mask image obtained is also the mask image described above, and this embodiment of the present application will not be repeated; thus, after determining the mask image corresponding to the target object and the editable text corresponding to the text material, the editable text, the intermediate image and the mask image are directly fused to obtain the image template corresponding to the image to be processed. In this way, by converting the text material in the image to be processed, the text material becomes an editable text, so as to facilitate editing the text content of the text material, and improve the utilization rate and flexibility of the obtained image template.

[0130] For example, see Fig.13 , Fig.13 is a schematic diagram of the generation process of the image template provided in the embodiment of the present application, based on Fig.13, indicated by 1301 is the editable text obtained based on the distribution of text materials in the image to be processed, indicated by 1302 is the mask image corresponding to the target object, and indicated by 1303 is the intermediate image corresponding to the image to be processed. The editable text indicated by 1301, the intermediate image indicated by 1303 and the mask image indicated by 1302 are fused to obtain the image template corresponding to the image to be processed as indicated by 1304.

[0131] In actual implementation, for the process of generating an image template corresponding to the image to be processed based on the distribution of text materials in the image to be processed, the intermediate image and the bounding box as mentioned above, accordingly, based on the distribution of text materials in the image to be processed, the text material in the image to be processed is transformed to obtain editable text corresponding to the text material; based on the bounding box, the intermediate image is segmented to obtain a mask image of the target object, and then the editable text, the intermediate image and the mask image are fused to obtain the image template corresponding to the image to be processed.

[0132] In actual implementation, the process of generating an image template corresponding to the image to be processed based on the distribution of text materials in the image to be processed, the intermediate image and the mask image is the same as described above. Based on the distribution of text materials in the image to be processed, the text materials in the image to be processed are transformed to obtain editable text corresponding to the text materials; then the editable text, the intermediate image and the mask image are directly fused to obtain the image template corresponding to the image to be processed.

[0133] In actual implementation, based on the distribution of text materials in the image to be processed, the intermediate image and the target mask image, the process of generating an image template corresponding to the image to be processed is, accordingly, based on the distribution of text materials in the image to be processed, the text materials in the image to be processed are transformed to obtain editable text corresponding to the text materials; then the editable text, the intermediate image and the target mask image are directly fused to obtain the image template corresponding to the image to be processed.

[0134] For example, see Fig.14 , Fig.14 is a schematic diagram of the generation process of the image template provided in the embodiment of the present application, based on Fig.14 , indicated by 1401 is the editable text obtained based on the distribution of text materials in the image to be processed, indicated by 1402 is the target mask image corresponding to the target object, and indicated by 1403 is the intermediate image corresponding to the image to be processed. The editable text indicated by 1401, the intermediate image indicated by 1403 and the target mask image indicated by 1402 are fused to obtain the image template corresponding to the image to be processed as indicated by 1404.

[0135] In some embodiments, after obtaining an image template including a text material in a deconstructed state and a target object, the target object in the image template can also be covered to obtain a target image template, wherein the area where the target object is located in the target image template is covered, that is, the corresponding position of the target object is vacant for filling in a new object, so that a new image is generated after filling in the new object. In this way, the corresponding image template can highlight the position that can be filled with content, and at the same time, the new object can be directly filled to generate a new image, which also improves the efficiency of generating new images.

[0136] For example, see Fig.15 , Fig.15 is a schematic diagram of a target image template provided in an embodiment of the present application, based on Fig.15 , after getting Fig.15 After the image template indicated by a is obtained, the area indicated by 1501, that is, the area where the target object is located, is covered. Fig.15 The target image template indicated by b.

[0137] In some embodiments, as described above, the target object may be a commodity, i.e., an advertising object, the image to be processed may be a promotional image, such as an advertising image including the advertising object, and the text material includes the advertising text material. Thus, the process of obtaining the image to be processed including the target object and the text material, and performing text material recognition on the image to be processed to obtain the distribution of the text material in the image to be processed may be to obtain the advertising image including the advertising object and the advertising text material, and perform text material recognition on the advertising image including the advertising object to obtain the distribution of the advertising text material in the advertising image; and based on the distribution of the text material in the image to be processed, remove the text material in the image to be processed to obtain the intermediate image corresponding to the image to be processed. The process may be, based on the distribution of the advertising text material in the advertising image, removing the advertising text material in the advertising image to obtain an intermediate image corresponding to the advertising image; and the process of detecting the position of the target object in the intermediate image to obtain the area where the target object is located in the intermediate image may be, detecting the position of the advertising object in the intermediate image to obtain the area where the advertising object is located in the intermediate image; and the process of generating an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image and the area where the target object is located may be, based on the distribution of the advertising text material in the advertising image, the intermediate image corresponding to the advertising image and the area where the advertising object is located, generating an advertising template corresponding to the advertising image.

[0138] It should be noted that the number of the advertising object in the advertising image may be one or more, which is not limited in the embodiments of the present application.

[0139] In some embodiments, as described above, the target object may be a portrait, and the image to be processed may be a person image. Thus, the process of obtaining the image to be processed including the target object and the text material, and performing text material recognition on the image to be processed to obtain the distribution of the text material in the image to be processed may be to obtain the person image including the portrait and the text material, and perform text material recognition on the person image to obtain the distribution of the text material in the person image; and the process of removing the text material in the image to be processed based on the distribution of the text material in the image to be processed to obtain the intermediate image corresponding to the image to be processed may be to remove the text material in the person image based on the distribution of the text material in the person image to obtain the intermediate image corresponding to the person image; and the process of performing position detection on the target object in the intermediate image to obtain the area where the target object is located in the intermediate image may be to perform position detection on the person image in the intermediate image to obtain the area where the person image is located in the intermediate image; and the process of generating an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image and the area where the target object is located may be to generate a portrait template corresponding to the person image based on the distribution of the text material in the image to be processed, the intermediate image corresponding to the person image and the area where the person image is located.

[0140] It should be noted that the character image here can be a face image, a half-body image, or a full-body image, and this embodiment of the present application does not limit this.

[0141] Next, the image processing method provided by the embodiment of the present application will be described. Fig.16 is a flowchart of the image processing method provided in the embodiment of the present application, see Fig.16 The image processing method provided in the embodiment of the present application is implemented collaboratively by the terminal and the server.

[0142] Step 201 : In response to an upload operation for an image to be processed including a target object and text material, the client obtains the image to be processed including the target object and text material.

[0143] In actual implementation, the client can be a client set on the terminal, and the image to be processed can be triggered by the user based on the human-computer interaction interface of the client, thereby triggering the upload function item in the human-computer interaction interface so that the client presents an image selection interface on the human-computer interaction interface. The user (for example, it can be an object or an artificial intelligence program operating on the client) uploads the image from the terminal based on the image selection interface, so that the client obtains the uploaded image to be processed. Here, the image to be processed uploaded from the terminal can be pre-stored locally in the terminal, or it can be sent by other devices connected to the terminal for communication. This is not limited to the embodiments of the present application.

[0144] Step 202: The client sends the image to be processed including the target object and text material to the server.

[0145] Step 203: the server performs text material recognition on the image to be processed including the target object and the text material, and obtains the distribution of the text material in the image to be processed.

[0146] Step 204 , based on the distribution of the text material in the image to be processed, remove the text material in the image to be processed to obtain an intermediate image corresponding to the image to be processed.

[0147] Step 205, obtaining description information of the image to be processed, and based on the description information, locating the target object in the intermediate image to obtain the position of the target object in the intermediate image.

[0148] The description information is used to describe the target object in the image to be processed.

[0149] Step 206 , based on the position of the target object in the intermediate image, a bounding box of the target object is generated, and the intermediate image is segmented using the bounding box as an anchor point to obtain a mask image of the target object.

[0150] The bounding box is used to indicate the area where the target object is located in the intermediate image, and the mask image is used to indicate the area where the target object is located in the intermediate image.

[0151] Step 207 , based on the mask image, edge detection is performed on the target object to obtain target pixels in the mask image, and line growth is performed based on the target pixels to obtain an object frame of the target object.

[0152] The target pixel is a pixel having a grayscale difference with at least one adjacent pixel that is greater than a difference threshold, and the object frame is used to indicate the shape of the target object.

[0153] Step 208 , based on the object frame, a target mask image of the target object is generated, and based on the distribution of the text material in the image to be processed, the intermediate image and the target mask image, an image template corresponding to the image to be processed is generated.

[0154] Step 209: The server sends the image template corresponding to the image to be processed to the client.

[0155] Step 210: The client receives the image template and displays the image template.

[0156] In actual implementation, the client can display the image template in the human-computer interaction interface of the client, save the image template locally in the terminal, and send the image template to other devices connected to the terminal for communication.

[0157] Using the above-mentioned embodiment of the present application, firstly, text material recognition is performed on the image to be processed including the target object and the text material to obtain the distribution of the text material in the image to be processed, and then based on the distribution of the text material in the image to be processed, the text material in the image to be processed is removed to obtain the intermediate image corresponding to the image to be processed, and then the area where the target object is located in the intermediate image is determined, thereby generating an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image and the area where the target object is located. In this way, after determining the distribution of the text material in the image to be processed, the text material is directly removed based on the distribution of the text material in the image to be processed to obtain the intermediate image, and then the image template is generated in combination with the distribution of the text material in the image to be processed, the intermediate image and the area where the target object is located. Compared with the solution in the related art that requires decomposing the advertising image into different layers to generate the advertising template, the generation efficiency of the image template is improved.

[0158] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.

[0159] When generating advertising templates, related technologies mostly use the layer function of image editing software to decompose the advertising image into different layers, each layer representing an independent element, such as a text layer, a picture layer, a background layer, etc., and then adjust the order, transparency, blending mode and other properties of the layer to achieve rapid modification and customization of the advertisement. However, such a method requires a lot of manpower and time to deconstruct the advertising image to generate the advertising template, which results in low efficiency in generating the image template.

[0160] Based on this, this application provides an advertising creative template deconstruction method based on AI integration, see Fig.17 , Fig.17 This is a technical architecture diagram of the advertising creative template deconstruction method based on AI integration provided in the embodiment of the present application. Fig.17 This application integrates OCR, Grounding, Inpainting, and Segment algorithms, and combines them with the newly proposed line growth algorithm, so that in many advertising scenarios, advertising images can be automatically converted into reusable PSDs, that is, a finished advertising image can be automatically deconstructed into a set of various elements, greatly improving the efficiency of batch generation of advertising materials.

[0161] In actual implementation, see Fig.18 , Fig.18 is a schematic diagram of the process of the advertising creative template deconstruction method based on AI integration provided in an embodiment of the present application, based on Fig.18After obtaining the advertisement image (the image to be processed), the OCR technology is used to identify the text and logo area of ​​the advertisement image, and the text content and format are identified to obtain the layout image corresponding to the advertisement image (the distribution of the text material in the image to be processed); then, based on the layout image, the text and logo in the advertisement image are erased to obtain the background image (the middle image) corresponding to the advertisement image; then, based on the pre-input product description (description information), the open set target detection technology is used to detect the product edge frame (enclosing frame); using the frame as the anchor point of the segmentation algorithm, the background image is segmented to segment the product mask image (mask image); then, based on the product mask image, the line growth method is used to segment the product frame mask (target mask image); finally, the layout image, background image and product frame segmentation image are combined, and PS script coding is used to automatically produce reusable creative template PSD.

[0162] In this way, through the above technical solution of the present application, not only the efficiency of image deconstruction is improved, but also the accuracy of image deconstruction can be improved.

[0163] Using the above-mentioned embodiment of the present application, firstly, text material recognition is performed on the image to be processed including the target object and the text material to obtain the distribution of the text material in the image to be processed, and then based on the distribution of the text material in the image to be processed, the text material in the image to be processed is removed to obtain the intermediate image corresponding to the image to be processed, and then the area where the target object is located in the intermediate image is determined, thereby generating an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image and the area where the target object is located. In this way, after determining the distribution of the text material in the image to be processed, the text material is directly removed based on the distribution of the text material in the image to be processed to obtain the intermediate image, and then the image template is generated in combination with the distribution of the text material in the image to be processed, the intermediate image and the area where the target object is located. Compared with the solution in the related art that requires decomposing the advertising image into different layers to generate the advertising template, the generation efficiency of the image template is improved.

[0164] The following is a description of an exemplary structure of the image processing device 455 provided in the embodiment of the present application implemented as a software module. In some embodiments, Figure 2 As shown, the software modules stored in the image processing device 455 of the memory 450 may include:

[0165] The recognition module 4551 is used to obtain an image to be processed including a target object and text material, and perform text material recognition on the image to be processed to obtain the distribution of the text material in the image to be processed;

[0166] A removal module 4552, configured to remove the text material in the image to be processed based on the distribution of the text material in the image to be processed, and obtain an intermediate image corresponding to the image to be processed;

[0167] A detection module 4553 is used to perform position detection on the target object in the intermediate image to obtain an area where the target object is located in the intermediate image;

[0168] Generation module 4554 is used to generate an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image and the area where the target object is located; wherein the text material and the target object in the image template are in a deconstructed state, and the image template is used to generate a new image after replacing the target object or text material.

[0169] In some embodiments, the recognition module 4551 is further used to perform text recognition on the image to be processed to obtain text material of the image to be processed; and perform position analysis on the text material to obtain the distribution of the text material in the image to be processed.

[0170] In some embodiments, the removal module 4552 is used to remove the text material in the image to be processed based on the distribution of the text material in the image to be processed to obtain a text-free image; and to repair the area in the text-free image where the text material was removed to obtain an intermediate image corresponding to the image to be processed.

[0171] In some embodiments, the removal module 4552 is also used to determine the associated area of ​​the area where the text material is removed in the text-free image, and obtain pixel information of the associated area; based on the pixel information, reconstruct the area where the text material is removed in the image to be processed to obtain an intermediate image corresponding to the image to be processed.

[0172] In some embodiments, the detection module 4553 is also used to obtain description information of the image to be processed, and the description information is used to describe the target object in the image to be processed; based on the description information, the target object in the intermediate image is located to obtain the position of the target object in the intermediate image; based on the position of the target object in the intermediate image, a bounding box of the target object is generated; wherein the bounding box is used to indicate the area where the target object in the intermediate image is located; the generation module 4554 is also used to generate an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image and the bounding box.

[0173] In some embodiments, the device also includes an analysis module, which is used to analyze the target object to obtain the size of the target object in the intermediate image; the detection module 4553 is also used to generate a bounding box of the target object based on the position of the target object in the intermediate image and the size of the target object in the intermediate image.

[0174] In some embodiments, the device also includes a segmentation module, which is used to segment the intermediate image using the bounding box as an anchor point to obtain a mask image of the target object; wherein the mask image is used to indicate the area where the target object is located in the intermediate image; the generation module 4554 is also used to generate an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image and the mask image.

[0175] In some embodiments, the device also includes a detection module, which is used to perform edge detection on the target object based on the mask image to obtain target pixel points in the mask image; wherein the target pixel point is a pixel point whose grayscale difference with at least one adjacent pixel point is greater than a difference threshold; line growth is performed based on the target pixel point to obtain an object frame of the target object, and the object frame is used to indicate the shape of the target object; based on the object frame, a target mask image of the target object is generated, and the target mask image is used to indicate the area where the target object is located in the intermediate image; the generation module 4554 is also used to generate an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image and the target mask image.

[0176] In some embodiments, the detection module is further used to expand the target pixel point to obtain multiple extension points; wherein the extension point is a pixel point whose similarity with the target pixel point reaches a similarity threshold; the target pixel point is connected with the multiple extension points to obtain an object frame of the target object.

[0177] In some embodiments, the generation module 4554 is also used to transform the text material in the image to be processed based on the distribution of the text material in the image to be processed to obtain editable text corresponding to the text material; based on the area where the target object is located, obtain the mask image corresponding to the target object; and fuse the editable text, the intermediate image and the mask image to obtain an image template corresponding to the image to be processed.

[0178] In some embodiments, the target object includes an advertising object, the image to be processed is an advertising image including the advertising object, and the text material includes an advertising text material. The identification module 4551 is further used to obtain an advertising image including an advertising object and an advertising text material, and perform text material recognition on the advertising image including the advertising object to obtain the distribution of the advertising text material in the advertising image; the removal module 4552 is further used to remove the advertising text material in the advertising image based on the distribution of the advertising text material in the advertising image to obtain an intermediate image corresponding to the advertising image; the detection module 4553 is further used to perform position detection on the advertising object in the intermediate image to obtain an area in the intermediate image where the advertising object is located; the generation module 4554 is further used to generate an advertising template corresponding to the advertising image based on the distribution of the advertising text material in the advertising image, the intermediate image corresponding to the advertising image, and the area where the advertising object is located.

[0179] The present application embodiment provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device performs the above-mentioned image processing method of the present application embodiment, for example, Figure 3 The image processing method is shown.

[0180] The present application embodiment provides a computer-readable storage medium storing executable instructions, wherein the executable instructions are stored. When the executable instructions are executed by a processor, the processor will execute the image processing method provided by the present application embodiment, for example, Figure 3 The image processing method is shown.

[0181] In some embodiments, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disk, or a CD-ROM; or it may be various devices including one or any combination of the above memories.

[0182] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0183] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0184] As an example, the executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.

[0185] It should be noted that in the embodiments of the present application, related data such as images to be processed are involved. When the embodiments of the present application are applied to specific products or technologies, corresponding permissions or consents need to be obtained, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0186] In summary, the embodiments of the present application have the following beneficial effects:

[0187] (1) After determining the distribution of text materials in the image to be processed, the text materials are directly removed based on the distribution of the text materials in the image to be processed to obtain an intermediate image, and then the image template is generated by combining the distribution of the text materials in the image to be processed, the intermediate image and the area where the target object is located. Compared with the solution in the related art that requires decomposing the advertising image into different layers to generate the advertising template, the generation efficiency of the image template is improved.

[0188] (2) Based on the pixel values ​​of each pixel in the associated area, the area where the text material is removed in the processed image is reconstructed, which ensures the fit between the reconstructed image area and the associated area, reduces the abruptness of the reconstructed image area, and thus improves the generation effect of the image template in the subsequent process of generating the image template.

[0189] (3) By setting the description information, the target object in the image to be processed is determined, so that the corresponding image template is generated in the subsequent process, which improves the flexibility of the generated image template. At the same time, compared with directly processing the image to be processed to generate the image template, using the description information as a constraint condition can also improve the accuracy of the generated image template.

[0190] (4) Using the bounding box as an anchor point can better identify and locate the target object, improve the accuracy and completeness of the segmentation result, and then generate an image template based on the segmentation result, that is, the mask image, which further improves the accuracy of the generated image template.

[0191] (5) Through smoothing, noise and sharp turns are removed, making the lines smoother and more continuous.

[0192] (6) The target mask image can be used to better identify and locate the target object, thereby further improving the accuracy of the generated image template in the process of generating the image template based on the target mask image.

[0193] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. An image processing method, characterized in that: The method comprises: Acquire an image to be processed including a target object and text material, and perform text material recognition on the image to be processed to obtain the distribution of the text material in the image to be processed; Based on the distribution of the text material in the image to be processed, removing the text material in the image to be processed to obtain an intermediate image corresponding to the image to be processed; Performing position detection on the target object in the intermediate image to obtain an area where the target object is located in the intermediate image; Based on the distribution of the text material in the image to be processed, the intermediate image and the area where the target object is located, an image template corresponding to the image to be processed is generated; The text material and the target object in the image template are in a deconstructed state, and the image template is used to generate a new image after replacing the target object or the text material.

2. The method according to claim 1, characterized in that The step of performing text material recognition on the image to be processed to obtain the distribution of the text material in the image to be processed includes: Performing text recognition on the image to be processed to obtain text material of the image to be processed; Performing position analysis on the text material to obtain the distribution of the text material in the image to be processed.

3. The method according to claim 1, characterized in that The removing of the text material in the image to be processed based on the distribution of the text material in the image to be processed to obtain an intermediate image corresponding to the image to be processed includes: Based on the distribution of the text material in the image to be processed, the text material in the image to be processed is removed to obtain a text-free image; The region where the text material is removed in the text-free image is repaired to obtain an intermediate image corresponding to the image to be processed.

4. The method according to claim 3, characterized in that The repairing of the region where the text material is removed from the text-free image to obtain an intermediate image corresponding to the image to be processed includes: In the text-free image, determining an associated region of the region where the text material is removed, and acquiring pixel information of the associated region; Based on the pixel information, the region where the text material is removed in the image to be processed is reconstructed to obtain an intermediate image corresponding to the image to be processed.

5. The method according to claim 1, characterized in that The performing position detection on the target object in the intermediate image to obtain the area where the target object is located in the intermediate image includes: Acquire description information of the image to be processed, where the description information is used to describe the target object in the image to be processed; Based on the description information, the target object in the intermediate image is located to obtain the position of the target object in the intermediate image; Based on the position of the target object in the intermediate image, generating a bounding box of the target object; Wherein, the bounding box is used to indicate the area where the target object is located in the intermediate image; The step of generating an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image, and the area where the target object is located includes: An image template corresponding to the image to be processed is generated based on the distribution of the text material in the image to be processed, the intermediate image and the bounding box.

6. The method according to claim 5, characterized in that After locating the target object in the intermediate image based on the description information to obtain the position of the target object in the intermediate image, the method further includes: Analyze the target object to obtain the size of the target object in the intermediate image; The step of generating a bounding box of the target object based on the position of the target object in the intermediate image comprises: A bounding box of the target object is generated based on the position of the target object in the intermediate image and the size of the target object in the intermediate image.

7. The method according to claim 5, characterized in that After generating a bounding box of the target object based on the position of the target object in the intermediate image, the method further includes: Using the bounding box as an anchor point, segmenting the intermediate image to obtain a mask image of the target object; Wherein, the mask image is used to indicate the area where the target object is located in the intermediate image; The step of generating an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image, and the bounding box includes: An image template corresponding to the image to be processed is generated based on the distribution of the text material in the image to be processed, the intermediate image and the mask image.

8. The method according to claim 7, characterized in that After the intermediate image is segmented using the bounding box as an anchor point to obtain a mask image of the target object, the method further includes: Based on the mask image, edge detection is performed on the target object to obtain target pixel points in the mask image; The target pixel is a pixel whose grayscale difference with at least one adjacent pixel is greater than a difference threshold; Perform line growth based on the target pixel points to obtain an object frame of the target object, where the object frame is used to indicate the shape of the target object; Based on the object frame, generating a target mask image of the target object, wherein the target mask image is used to indicate a region where the target object is located in the intermediate image; The step of generating an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image, and the mask image includes: An image template corresponding to the image to be processed is generated based on the distribution of the text material in the image to be processed, the intermediate image and the target mask image.

9. The method according to claim 8, characterized in that The performing line growth based on the target pixel point to obtain the object frame of the target object includes: Expanding the target pixel point to obtain a plurality of expansion points; wherein the expansion points are pixel points whose similarity with the target pixel point reaches a similarity threshold; The target pixel point is connected with the multiple extension points to obtain an object frame of the target object.

10. The method according to claim 1, characterized in that The step of generating an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image, and the area where the target object is located includes: Based on the distribution of the text material in the image to be processed, the text material in the image to be processed is converted to obtain an editable text corresponding to the text material; Based on the area where the target object is located, obtaining a mask image corresponding to the target object; The editable text, the intermediate image and the mask image are fused to obtain an image template corresponding to the image to be processed.

11. The method according to claim 1, characterized in that The target object includes an advertising object, the image to be processed is an advertising image including the advertising object, the text material includes an advertising text material, and acquiring the image to be processed including the target object and the text material, and performing text material recognition on the image to be processed to obtain the distribution of the text material in the image to be processed includes: Acquire an advertisement image including an advertisement object and advertisement text material, and perform text material recognition on the advertisement image including the advertisement object to obtain distribution of the advertisement text material in the advertisement image; The removing of the text material in the image to be processed based on the distribution of the text material in the image to be processed to obtain an intermediate image corresponding to the image to be processed includes: Based on the distribution of the advertisement text material in the advertisement image, removing the advertisement text material in the advertisement image to obtain an intermediate image corresponding to the advertisement image; The performing position detection on the target object in the intermediate image to obtain the area where the target object is located in the intermediate image includes: Performing position detection on the advertisement object in the intermediate image to obtain an area where the advertisement object is located in the intermediate image; The step of generating an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image, and the area where the target object is located includes: An advertisement template corresponding to the advertisement image is generated based on the distribution of the advertisement text material in the advertisement image, the intermediate image corresponding to the advertisement image, and the area where the advertisement object is located.

12. An image processing device, characterized in that: The device comprises: A recognition module is used to obtain an image to be processed including a target object and text material, and perform text material recognition on the image to be processed to obtain the distribution of the text material in the image to be processed; A removal module, configured to remove the text material in the image to be processed based on the distribution of the text material in the image to be processed, so as to obtain an intermediate image corresponding to the image to be processed; A detection module, used to detect the position of the target object in the intermediate image to obtain an area where the target object is located in the intermediate image; A generation module is used to generate an image template corresponding to the image to be processed based on the distribution of the text material in the image to be processed, the intermediate image and the area where the target object is located; wherein the text material and the target object in the image template are in a deconstructed state, and the image template is used to generate a new image after replacing the target object or the text material.

13. An electronic device, characterized in that: include: A memory for storing executable instructions; A processor, configured to implement the image processing method according to any one of claims 1 to 11 when executing the executable instructions stored in the memory.

14. A computer-readable storage medium, characterized in that: Executable instructions are stored, which are used to cause a processor to execute and implement the image processing method described in any one of claims 1 to 11.

15. A computer program product comprising a computer program or computer executable instructions, characterized in that: When the computer program or computer executable instruction is executed by a processor, the image processing method according to any one of claims 1 to 11 is implemented.