Image processing method and device, electronic equipment and storage medium
By using the occlusion object to block a specific area of the target object in the image processing method and generating a target image, the problem of lack of semantic association and visual fusion between the commodity and the environment in the prior art is solved, and the effective semantic association and visual fusion effect between the target object and the new background is achieved.
Patent Information
- Application Number
- CN202510168502.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-14
- Publication Date
- 2025-06-06
AI Technical Summary
Existing background replacement technologies are difficult to construct visual effects of the interaction between goods and the environment, and goods lack semantic association and visual fusion with the surrounding environment.
By acquiring the original image, the first prompt information, the first mask and the second prompt information are determined, and a target image is generated, where the occlusion object blocks a specific area of the target object, forming an effective semantic association and visual fusion between the target object and the new background.
The effective semantic association and visual fusion between the target object and the new background are achieved, and the visual effect of the interaction between the target object and the environment is constructed.
Smart Images

Figure CN120107445A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image generation technology, and in particular to an image processing method, device, electronic device and storage medium. Background Art
[0002] In the digital age, image generation technology, as a major breakthrough in the field of artificial intelligence, has greatly enriched the user's content creation experience and brought unprecedented innovation momentum to all walks of life. At present, people hope to apply these technologies to specific scenarios. For example, in the e-commerce field, merchants hope to customize product promotion images through image generation technology.
[0003] One of the key operations in customizing product promotional images is background replacement. In the current field of image processing, users can already replace the background of input product images. However, existing background replacement technologies have significant limitations. Specifically, the images generated by this technology usually simply superimpose the product on a new background. In the images obtained by this method, the product and the surrounding environment lack effective semantic association and visual fusion effects, making it difficult to construct a visual effect of the interaction between the product and the environment. Summary of the invention
[0004] In order to solve the above technical problem or at least partially solve the above technical problem, the present disclosure provides an image processing method, device, electronic device and storage medium.
[0005] In a first aspect, the present disclosure provides an image processing method, comprising:
[0006] Acquire an original image; the original image includes a target object;
[0007] Determine first prompt information, a first mask, and second prompt information, wherein the first prompt information is used to describe the blocking object that blocks the target object; the first mask is used to indicate a first target area, which is an area blocked by the blocking object on the target object; and the second prompt information is used to describe the second background;
[0008] A target image is generated based on the original image, the first prompt information, the first mask, and the second prompt information; the target image includes the occluding object, the target object, and the second background, and in the target image, the occluding object occludes the first target area of the target object.
[0009] In a second aspect, the present disclosure further provides an image processing device, comprising:
[0010] An acquisition module, used for acquiring an original image; the original image includes a target object;
[0011] A determination module, configured to determine first prompt information, a first mask, and second prompt information, wherein the first prompt information is used to describe an obstructing object that obstructs the target object; the first mask is used to indicate a first target area, which is an obstruction area of the target object by the obstructing object; and the second prompt information is used to describe a second background;
[0012] A generation module is used to generate a target image based on the original image, the first prompt information, the first mask and the second prompt information; the target image includes the occluding object, the target object and the second background, and in the target image, the occluding object occludes the first target area of the target object.
[0013] In a third aspect, the present disclosure further provides an electronic device, the electronic device comprising:
[0014] one or more processors;
[0015] A storage device for storing one or more programs;
[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the image processing method as described above.
[0017] In a fourth aspect, the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, which implements the image processing method as described above when executed by a processor.
[0018] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:
[0019] The technical solution provided by the embodiment of the present disclosure is to obtain an original image by setting; the original image includes a target object; determine the first prompt information, the first mask and the second prompt information, the first prompt information is used to describe the occluding object that occludes the target object; the first mask is used to indicate the first target area, the first target area is the occluding area of the target object by the occluding object; the second prompt information is used to describe the second background; based on the original image, the first prompt information, the first mask and the second prompt information, the target image is generated; the target image includes the occluding object, the target object and the second background, and in the target image, the occluding object occludes the first target area of the target object. Its essence is to provide a method that can replace the background of the original image. After the background replacement is completed, the target object is placed in a new background and is occluded by things in the new environment (i.e., the occluding object). The situation that the target object is occluded by the occluding object can form an effective semantic association and visual fusion effect between the target object and the surrounding environment, thereby constructing a visual effect of the interaction between the target object and the environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0022] Figure 1 A flowchart of an image processing method provided by an embodiment of the present disclosure;
[0023] Figure 2 A schematic diagram of a display interface of an electronic device provided by an embodiment of the present disclosure;
[0024] Figure 3 A schematic diagram of an original image provided by an embodiment of the present disclosure;
[0025] Figure 4 Based on Figure 3 Schematic diagram of the target image obtained from the original image in;
[0026] Figure 5 is a structural schematic diagram of an image processing device in an embodiment of the present disclosure;
[0027] Figure 6 It is a structural schematic diagram of an electronic device in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0028] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0029] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0030] Figure 1This is a flowchart of an image processing method provided in an embodiment of the present disclosure. This embodiment is applicable to the case where image processing is performed in a client. The method can be executed by an image processing device, which can be implemented in software and / or hardware. The device can be configured in an electronic device, such as a terminal, specifically including but not limited to a smart phone, a PDA, a tablet computer, a wearable device with a display screen, a desktop computer, a laptop computer, an all-in-one machine, a smart home device, etc. Alternatively, this embodiment is applicable to the case where image processing is performed in a server. The method can be executed by an image processing device, which can be implemented in software and / or hardware. The device can be configured in an electronic device, such as a server.
[0031] like Figure 1 As shown, the method may specifically include:
[0032] S110, acquiring an original image; the original image includes a target object.
[0033] The original image may be, for example, an image whose background needs to be replaced. In some scenarios, the original image is an image specified or uploaded by a user.
[0034] The target object is the thing in the original image, which can be a person, animal, plant, building or object, etc. In the e-commerce scenario, the object can be a product.
[0035] The original image may or may not include a background. If the original image does not include a background, the original image may be the result of performing a cutout operation on an image that includes a target object and other things. If the original image includes a background (hereinafter referred to as a first background), the first background may be a solid color background or a non-solid color background. A solid color background may, for example, be a pure white background. A non-solid color background may, for example, refer to a background that contains things that can create a specific atmosphere or scene, such as natural landscapes, architectural elements, etc. These elements can enrich the background information of the image and reflect the environment in which the target object is located.
[0036] S120, determine the first prompt information, the first mask and the second prompt information, the first prompt information is used to describe the occluding object that occludes the target object; the first mask is used to indicate the first target area, and the first target area is the occluding area of the target object by the occluding object; the second prompt information is used to describe the second background; the second background is different from the first background.
[0037] By adopting the technical solution provided in the present application, the image finally generated is the target image. In the target image, the "target object" in the original image is maintained in the target image, and the first background in the original image is replaced by the second background. The target image also includes an occluding object, which is a person, animal, plant, building or object, etc. In the target image, the occluding object occludes the target object. Here, it should be noted that the occluding object of the target object is a manifestation of the interaction between the target object and the environment reflected by the second background.
[0038] The first prompt information may be, for example, a specific object specified by the occluding object, or descriptive information about the color, shape, posture, layout, etc. of the occluding object. The second prompt information may be, for example, information describing the content of the second background or the environment to be created by the second background.
[0039] There are many specific implementation methods for "determining the first prompt information and the second prompt information", and this application does not limit this. For example, in some embodiments, "determining the first prompt information and the second prompt information" may include: displaying an image processing page, the image processing page includes multiple scene identifiers; the scene identifier is associated with prompt information; in response to a selection operation of a target scene identifier among the multiple scene identifiers, the prompt information corresponding to the target scene identifier is used as the target prompt information; the target prompt information includes the first prompt information and the second prompt information.
[0040] The image processing page may be, for example, a page for replacing the background of an original image. Through the image processing page, relevant information that can reflect what kind of background the user wishes to replace the original image with can be collected.
[0041] Each scene identifier represents a scene. The scene identifier may be information that distinguishes one scene from other scenes. A scene may be a specific environment, such as a forest, a bedroom, or a beach.
[0042] The scene identifier is associated with prompt information. The prompt information associated with the scene identifier is description information of the specific scene represented by the scene identifier.
[0043] The selection operation of the target scene identifier among the multiple scene identifiers may be, for example, a selection operation of the target scene identifier in the image processing page, which may specifically be a click operation, a slide operation, a hover operation, or a drag operation. The target scene is the scene represented by the target scene identifier selected by the user. The user's selection of the target scene identifier means that the user wishes to generate an image in which the target object is in the target scene.
[0044] For example, see Figure 2, the image processing page includes a first area and a second area, and the first area includes multiple scene identifiers. Among them, the multiple scene identifiers include scene identifier 1 and scene identifier 2. Assume that the scene referred to by scene identifier 1 is a bedroom, and its associated prompt information is "The product is placed on the floor of the bedroom, with a small and elegant table lamp on it. The soft light from the lamp casts a soft light on the product." The scene referred to by scene identifier 2 is a beach, and its associated prompt information is "The product is carefully placed on the beach, the sand on the beach blocks some of the bottom of the product, the gentle waves beat the coast, the golden beach extends to the horizon, and the soft hue of the sky at sunset creates a quiet and warm atmosphere." If the user clicks on scene identifier 1, "The product is placed on the floor of the bedroom, with a small and elegant table lamp on it. The soft light from the lamp casts a soft light on the product" is used as the target prompt information. In this target prompt information, "product" refers to the target object. "There is a small and elegant table lamp on it. The soft light from the lamp casts a soft light on the product" is the first prompt information, which describes the obstructed object "table lamp". "On the floor of the bedroom" is the second prompt information, which describes the environment or scene where the "product" is located.
[0045] In some other embodiments, "determining the first prompt information and the second prompt information" may include: obtaining target prompt information input by the user; the target prompt information includes the first prompt information and the second prompt information.
[0046] There are many specific implementation methods for "determining the first mask", and the present application does not limit this. Exemplarily, in one example, optionally, the target prompt information also includes third prompt information; the third prompt information is used to describe the position of the first target area; determining the first mask includes: determining the first mask based on the third prompt information. "The product is placed on the floor of the bedroom, with a small and elegant table lamp on it. The soft light from the lamp casts a soft light on the product" is still used as the target prompt information. In this target prompt information, "the product is placed on the floor of the bedroom, with a small and elegant table lamp on it" is the third prompt information, which describes the occlusion area of the target object "product" (that is, the first target area, which is the top of the product) of the occluding object "table lamp".
[0047] In one example, optionally, a mask library is obtained, the mask library includes a plurality of masks; based on a preset screening rule, a first mask is determined from the mask library.
[0048] The mask library may be, for example, a pre-built database including a plurality of masks. The regions represented by different masks in the mask library have at least one different shape, size or position. If a mask in the mask library is used as the first mask, it means that the occluding object is limited to perform an occluding operation on the target object in the region marked by the first mask in the original image.
[0049] The preset filtering rule may be, for example, a pre-set filtering rule, which is used to select a mask as the first mask from a plurality of masks in the mask library. The present application does not limit the specific content of the preset filtering rule. Exemplarily, the preset filtering rule may include how to determine the relevant information of the first mask based on the third prompt information if the target prompt information also includes the third prompt information; or how to determine the relevant information of the first mask according to the position of the target object in the original image; or, determine the relevant information of the first mask according to the selection result of the user of the mask in the mask library.
[0050] S130, generating a target image based on the original image, the first prompt information, the first mask, and the second prompt information; the target image includes an occluding object, a target object, and a second background, and in the target image, the occluding object occludes a first target area of the target object.
[0051] There are many methods for implementing this step, and this application does not limit this. Exemplarily, the method for implementing this step may include: generating a first image based on the original image and the second prompt information, the first image including the target object and the second background; in the first image, the target object is not blocked; based on the first mask, determining the second target area; based on the first prompt information, redrawing the second target area in the first image to obtain the target image; in the target image, the second target area includes the blocked object.
[0052] Optionally, the first image presents a visual effect that the target object is directly superimposed on the new background, and in the first image, the target object is completely revealed and is not blocked by any object.
[0053] There are many specific implementation methods for "generating a first image based on the original image and the second prompt information", and this application does not limit this. Exemplarily, "generating a first image based on the original image and the second prompt information" includes: determining the unique features of the target object based on the original image; generating the first image based on the unique features of the target object and the second prompt information.
[0054] The exclusive features of the target object may refer to features or attributes that can be used to uniquely identify a specific target object. These features or attributes are unique to the specific target object and can be clearly distinguished even between similar objects. If the target object is an animal, the exclusive feature information of the target object may include fur color, spots, stripes, and body shape. If the target object is an object, the exclusive feature information of the target object may include shape, size, material, and surface texture. The exclusive features of the target object in the first image are consistent with the exclusive features of the target object in the original image.
[0055] It should be noted that the features of the target object include exclusive features and common features. Exclusive features are the key factors used to identify whether an object is a target object. Common features are often common to different objects. Taking the target object as a table as an example, exclusive features may be unique carvings, special table leg shapes, etc. When the table is presented in images with different backgrounds at different angles, different resolutions, different ambient brightness, etc., the table can still be accurately identified with these exclusive features. Common features may be, for example, the basic structure of the four legs supporting the table top, the flat characteristics of the table top, etc., which are common to most tables.
[0056] The universal features help to shape the overall image of the target object, while the specific features are mainly used to improve the recognition of the target object. When generating the first image, using the specific features of the target object can ensure that the first image includes the target object, or in other words, the target object is retained in the first image.
[0057] Optionally, based on the original image, the specific features and the common features of the target object are determined; based on the specific features and the common features of the target object and the second prompt information, the first image is generated.
[0058] The second target area may be, for example, an area for indicating a required redrawing in the first image. The purpose of the redrawing is to form a visual effect that the occluding object occludes the target area of the target object.
[0059] Optionally, the second target area includes the first target area, that is, the first target area is located in the second target area.
[0060] It should be noted that, in practice, in order to make the image of the redrawn second target area connect naturally with the image of the non-redrawn area, the first target area can be set to be located within the second target area, and the area of the second target area is larger than that of the first target area.
[0061] There are many specific implementation methods for "determining the second target area in the first image based on the first mask", and this application does not limit this. Exemplarily, "determining the second target area in the first image based on the first mask" may include: determining the second mask based on the original image, the second mask being used to indicate the area occupied by the target object; determining the second target area based on the second mask and the first mask.
[0062] The second mask is specifically used to indicate the area occupied by the target object in the original image. In other words, the second mask is used to indicate the area occupied by the target object in the absence of object occlusion.
[0063] By setting the second target area based on the second mask and the first mask, its purpose is to comprehensively consider the area occupied by the target object in the original image and the occlusion area of the target object by the expected occluding object when determining the redrawing area (i.e., the second target area), so as to determine a reasonable second target area and avoid the situation where the second target area image after redrawing is unnaturally connected with the non-redrawn area image due to an unreasonable second target area.
[0064] For example, Figure 3 The image in is the original image, and the target object in the original image is a table. Import the original image into Figure 2 In the image processing page in , if the user clicks on scene identifier 1, if the prompt information associated with scene identifier 1 is "The product is placed on the floor of the bedroom, with a small and elegant table lamp on it. The soft light from the lamp casts a soft light on the product" as the target prompt information. In this example, "product" refers to Figure 3 The table in the image. Based on the target prompt information, the first prompt information, the first mask and the second prompt information can be obtained. Based on the target prompt information and the original image, the generated target image is as follows: Figure 4 As shown in the target image, the upper surface of the table is blocked by the occluder "table lamp". Figure 3 and Figure 4 , relative to the original image, the target image is the result of replacing the background of the original image.
[0065] The above technical solution is set to obtain an original image; the original image includes a target object; determine the first prompt information, the first mask and the second prompt information, the first prompt information is used to describe the occluding object that occludes the target object; the first mask is used to indicate the first target area, the first target area is the occluding area of the target object by the occluding object; the second prompt information is used to describe the second background; the second background is different from the first background; based on the original image, the first prompt information, the first mask and the second prompt information, a target image is generated; the target image includes the occluding object, the target object and the second background, and in the target image, the occluding object occludes the first target area of the target object. Its essence is to provide a method that can replace the background of the original image. After the background replacement is completed, the target object is placed in a new background and is occluded by things in the new environment (i.e., the occluding object). The situation that the target object is occluded by the occluding object can form an effective semantic association and visual fusion effect between the target object and the surrounding environment, thereby constructing a visual effect of interaction between the target object and the environment.
[0066] In practice, the above technical solution can be used to achieve at least the following scenarios: placing the target object in a natural environment, where the target object is blocked by an object in front of it; placing the target object in water (for example, floating it on the water surface), where the target object is blocked by water or splashing water droplets; and a person or animal can hold or wear the target object, where the target object is blocked by hands, clothing, accessories, etc.
[0067] On the basis of the above technical solution, optionally, S130 can be replaced by: determining negative prompt information; generating a target image based on the original image, the first prompt information, the first mask, the second prompt information and the negative prompt information.
[0068] The negative prompt information may be, for example, a user-input or preset negative guidance word. In the image generation model, the negative prompt information is used to guide the image generation model on what content should be avoided, which can make the image generation result more controllable.
[0069] Optionally, generating the first image based on the exclusive feature of the target object and the second prompt information may include: generating the first image based on the exclusive feature of the target object, the second prompt information and the negative prompt information.
[0070] Optionally, based on the first prompt information, the second target area in the first image is redrawn to obtain the target image; in the target image, the second target area includes an occluded object, which may include: based on the first prompt information and the negative prompt information, the second target area in the first image is redrawn to obtain the target image; in the target image, the second target area includes an occluded object.
[0071] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0072] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0073] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0074] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0075] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0076] Figure 5 Schematic diagram of the structure of an image processing device in an embodiment of the present disclosure. The image processing device provided in the embodiment of the present disclosure can be configured in a client or in a server. Figure 5 , the image processing device specifically comprises:
[0077] The acquisition module 310 is used to acquire an original image; the original image includes a target object;
[0078] The determination module 320 is used to determine first prompt information, a first mask, and second prompt information, wherein the first prompt information is used to describe the blocking object that blocks the target object; the first mask is used to indicate a first target area, and the first target area is the blocking area of the target object by the blocking object; and the second prompt information is used to describe the second background;
[0079] The generation module 330 is used to generate a target image based on the original image, the first prompt information, the first mask and the second prompt information; the target image includes the occluding object, the target object and the second background, and in the target image, the occluding object occludes the first target area of the target object.
[0080] Furthermore, the generating module 330 is used to:
[0081] Based on the original image and the second prompt information, a first image is generated, wherein the first image includes the target object and the second background; in the first image, the target object is not blocked;
[0082] Based on the first mask, determining a second target area;
[0083] Based on the first prompt information, the second target area in the first image is redrawn to obtain a target image; in the target image, the second target area includes the occluding object.
[0084] Furthermore, the generating module 330 is used to:
[0085] Based on the original image, determining the exclusive features of the target object;
[0086] A first image is generated based on the unique features of the target object and the second prompt information.
[0087] Furthermore, the generating module 330 is used to:
[0088] Based on the original image, determining a second mask, wherein the second mask is used to indicate an area occupied by the target object;
[0089] The second target area is determined based on the second mask and the first mask.
[0090] Further, the determination module 320 is used to:
[0091] Displaying an image processing page, the image processing page including a plurality of scene identifiers; the scene identifiers are associated with prompt information;
[0092] In response to a selection operation on a target scene identifier among the multiple scene identifiers, prompt information corresponding to the target scene identifier is used as target prompt information; the target prompt information includes first prompt information and second prompt information.
[0093] Furthermore, the target prompt information further includes third prompt information; the third prompt information is used to describe the position of the first target area; the determination module 320 is used to: determine the first mask based on the third prompt information; or,
[0094] The determination module 320 is configured to: obtain a mask library, the mask library including a plurality of masks; and determine a first mask from the mask library based on a preset screening rule.
[0095] Furthermore, the generating module 330 is used to:
[0096] Determine negative prompt information;
[0097] A target image is generated based on the original image, the first prompt information, the first mask, the second prompt information, and the negative prompt information.
[0098] The image processing device provided in the embodiment of the present disclosure can execute the steps executed by the client or server in the image processing method provided in the embodiment of the method of the present disclosure, and has the execution steps and beneficial effects, which will not be repeated here.
[0099] Figure 6 Schematic diagram of the structure of an electronic device in the embodiment of the present disclosure. Figure 6 , which shows a schematic diagram of the structure of an electronic device 1000 suitable for implementing the embodiment of the present disclosure. The electronic device 1000 in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (such as vehicle navigation terminals), wearable electronic devices, etc., and fixed terminals such as digital TVs, desktop computers, smart home devices, etc. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0100] like Figure 6 As shown, the electronic device 1000 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 to a random access memory (RAM) 1003 to implement the image processing method of the embodiment described in the present disclosure. In the RAM 1003, various programs and information required for the operation of the electronic device 1000 are also stored. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0101] Typically, the following devices may be connected to the I / O interface 1005: an input device 1006 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1007 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1008 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange information. Although Figure 6 The electronic device 1000 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0102] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart, thereby implementing the image processing method as described above. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 1009, or installed from a storage device 1008, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0103] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include an information signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated information signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0104] In some embodiments, the client and the server may communicate using any known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital information communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any known or future developed network.
[0105] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0106] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:
[0107] Acquire an original image; the original image includes a target object;
[0108] Determine first prompt information, a first mask, and second prompt information, wherein the first prompt information is used to describe the blocking object that blocks the target object; the first mask is used to indicate a first target area, and the first target area is the blocking area of the target object by the blocking object; the second prompt information is used to describe a second background; and the second background is different from the first background;
[0109] A target image is generated based on the original image, the first prompt information, the first mask, and the second prompt information; the target image includes the occluding object, the target object, and the second background, and in the target image, the occluding object occludes the first target area of the target object.
[0110] Optionally, when the above one or more programs are executed by the electronic device, the electronic device may also execute other steps described in the above embodiments.
[0111] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0112] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0113] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0114] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0115] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0116] According to one or more embodiments of the present disclosure, the present disclosure provides an electronic device, including:
[0117] one or more processors;
[0118] A memory for storing one or more programs;
[0119] When the one or more programs are executed by the one or more processors, the one or more processors implement any image processing method provided in the present disclosure.
[0120] According to one or more embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, and when the program is executed by a processor, the image processing method as described in any one of the present disclosure is implemented.
[0121] The embodiment of the present disclosure further provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the image processing method as described above is implemented.
[0122] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0123] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An image processing method, characterized in that: include: Acquire an original image; the original image includes a target object; Determine first prompt information, a first mask, and second prompt information, wherein the first prompt information is used to describe the blocking object that blocks the target object; the first mask is used to indicate a first target area, and the first target area is an area blocked by the blocking object on the target object; The second prompt information is used to describe the second background; Generate a target image based on the original image, the first prompt information, the first mask and the second prompt information; The target image includes the occluding object, the target object, and the second background. In the target image, the occluding object occludes the first target area of the target object.
2. The method according to claim 1, characterized in that The generating a target image based on the original image, the first prompt information, the first mask, and the second prompt information includes: Based on the original image and the second prompt information, a first image is generated, wherein the first image includes the target object and the second background; in the first image, the target object is not blocked; Based on the first mask, determining a second target area; Based on the first prompt information, the second target area in the first image is redrawn to obtain a target image; in the target image, the second target area includes the occluding object.
3. The method according to claim 2, characterized in that The step of generating a first image based on the original image and the second prompt information includes: Based on the original image, determining the exclusive features of the target object; A first image is generated based on the unique features of the target object and the second prompt information.
4. The method according to claim 2, characterized in that: The determining a second target area in the first image based on the first mask includes: Based on the original image, determining a second mask, wherein the second mask is used to indicate an area occupied by the target object; The second target area is determined based on the second mask and the first mask.
5. The method according to claim 2, characterized in that: The determining of the first prompt information and the second prompt information comprises: Displaying an image processing page, the image processing page including a plurality of scene identifiers; the scene identifiers are associated with prompt information; In response to a selection operation on a target scene identifier among the multiple scene identifiers, prompt information corresponding to the target scene identifier is used as target prompt information; the target prompt information includes first prompt information and second prompt information.
6. The method according to claim 5, characterized in that The target prompt information further includes third prompt information; the third prompt information is used to describe the position of the first target area; the determining the first mask includes: determining the first mask based on the third prompt information; or, A mask library is obtained, wherein the mask library includes a plurality of masks; and a first mask is determined from the mask library based on a preset screening rule.
7. The method according to claim 1, characterized in that generating a target image based on the original image, the first prompt information, the first mask and the second prompt information; Also includes: Determine negative prompt information; A target image is generated based on the original image, the first prompt information, the first mask, the second prompt information, and the negative prompt information.
8. An image processing device, characterized in that: include: An acquisition module, used for acquiring an original image; the original image includes a target object; A determination module, configured to determine first prompt information, a first mask, and second prompt information, wherein the first prompt information is used to describe an obstructing object that obstructs the target object; the first mask is used to indicate a first target area, and the first target area is an obstruction area of the target object by the obstructing object; The second prompt information is used to describe the second background; A generating module, configured to generate a target image based on the original image, the first prompt information, the first mask and the second prompt information; The target image includes the occluding object, the target object, and the second background. In the target image, the occluding object occludes the first target area of the target object.
9. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.