Image erasing method and device, electronic equipment and storage medium

By identifying and cropping the mask to accurately erase the image area, the accuracy and efficiency of the image erasing steps in image processing are solved, and an efficient image erasing effect is achieved.

CN118967884APending Publication Date: 2024-11-15BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411037669.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

During the image processing, it is difficult to accurately remove unnecessary parts of the image erase step, resulting in information loss and edge blur.

Method used

By acquiring the original image layer and the occlusion image layer, identifying the target object, cropping the mask of the occlusion image layer, and then accurately erasing local areas to achieve image erasing.

Benefits of technology

The efficiency and accuracy of image erasing are improved, and information loss and edge blur problems caused by inaccurate determination of erasing area are avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118967884A_ABST
    Figure CN118967884A_ABST
Patent Text Reader

Abstract

The invention relates to an image erasing method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining an original image layer and a shielding image layer, and the original image layer comprises a target object; the shielding image layer shields at least part of the target object; identifying a target object in the original image layer to obtain a first mask; based on the shielding image layer, cutting the first mask to obtain a second mask; and on the basis of the second mask, erasing a local area of the shielding image layer. The method for assisting the user in accurately determining the erasing area and erasing the image is essentially provided, the user does not need to define the erasing area in a smearing mode, and the image erasing efficiency is high. And the accuracy of the determined erasure area is high, so that the bad problems of information loss, edge blur and the like caused by inaccurate determination of the erasure area can be avoided to a certain extent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In the actual process of image processing, users often use layer materials for creative photo editing in pursuit of innovation and personal expression. This allows them to retain the core elements of the original image while overlaying and mixing various layer effects, such as texture, light, patterns or other image fragments, to enrich the visual content and create unique visual effects.

[0003] However, a crucial step in the creative photo editing workflow is image erasure, a step designed to remove unwanted parts of an image so that they can blend cleanly into a new background or element. 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 erasing method, device, electronic device and storage medium.

[0005] In a first aspect, the present disclosure provides an image erasing method, comprising:

[0006] Acquire an original image layer and a blocked image layer, wherein the original image layer includes a target object; and the blocked image layer blocks at least a portion of the target object;

[0007] Identify the target object in the original image layer to obtain a first mask;

[0008] Based on the occluding image layer, the first mask is cropped to obtain a second mask;

[0009] Based on the second mask, a local area of ​​the occluded image layer is erased.

[0010] In a second aspect, the present disclosure further provides an image erasing device, comprising:

[0011] An acquisition module, used to acquire an original image layer and a shielded image layer, wherein the original image layer includes a target object; and the shielded image layer shields at least a portion of the target object;

[0012] A recognition module, used for recognizing the target object in the original image layer to obtain a first mask;

[0013] A cropping module, configured to crop the first mask based on the occluded image layer to obtain a second mask;

[0014] An erasing module is used to erase a local area of ​​the occluded image layer based on the second mask.

[0015] In a third aspect, the present disclosure further provides an electronic device, the electronic device comprising:

[0016] one or more processors;

[0017] A storage device for storing one or more programs;

[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement the image erasing method as described above.

[0019] In a fourth aspect, the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, which implements the image erasing method as described above when executed by a processor.

[0020] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:

[0021] The technical solution provided by the embodiment of the present disclosure is to obtain an original image layer and an occluded image layer by setting, wherein the original image layer includes a target object; the occluded image layer occludes at least part of the target object; the target object in the original image layer is identified to obtain a first mask; based on the occluded image layer, the first mask is cropped to obtain a second mask; based on the second mask, a local area of ​​the occluded image layer is erased. In essence, it provides a method to assist users in accurately determining the erasure area and performing image erasure. The method does not require users to define the erasure area by smearing, and the image erasure efficiency is high. Moreover, the erasure area determined by it has a high accuracy, which can avoid the occurrence of adverse problems such as information loss and edge blurring caused by inaccurate determination of the erasure area to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] 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.

[0023] 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.

[0024] Figure 1 A flowchart of an image erasing method provided by an embodiment of the present disclosure;

[0025] Figure 2-Figure 9A schematic diagram of each layer during the execution of an image erasing method provided by an embodiment of the present disclosure;

[0026] Fig.10 is a structural schematic diagram of an image erasing device in an embodiment of the present disclosure;

[0027] Fig.11 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 1 This is a flowchart of an image erasing method provided in an embodiment of the present disclosure. This embodiment is applicable to the case where image erasing is performed in a client. The method can be executed by an image erasing 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 smart phones, PDAs, tablet computers, wearable devices with display screens, desktop computers, laptop computers, all-in-one machines, smart home devices, etc. Alternatively, this embodiment is applicable to the case where image erasing is performed in a server. The method can be executed by an image erasing 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, obtaining an original image layer and a blocked image layer, wherein the original image layer includes a target object; and the blocked image layer blocks at least a portion of the target object.

[0033] The original image may be, for example, an image that needs to have at least a part of its area exposed, which may be an image taken by a user or an image downloaded from the Internet. The original image includes one or more objects, which are things in the original image, and may specifically be people, animals, plants, buildings or objects. The target object may be, for example, one or more specific objects in the original image, which are factors that need to be considered when determining the image erasure area. The original image layer may be, for example, the layer where the original image is located.

[0034] The occluded image may be, for example, an image that occludes the original image, and may be an erased object. The occluded image may be, for example, an image taken by a user, or an image downloaded from the Internet. The occluded image layer may be, for example, a layer where the occluded image is located. The size of the occluded image may be greater than, equal to, or smaller than the original image. The occluded image may occlude part or all of the target object in the original image.

[0035] For example, see Figure 2 The original image layer includes a gourd-shaped pattern and a hexagonal star-shaped pattern, the gourd-shaped pattern is the target object, and the occlusion image layer includes an occlusion image, which is rectangular. After the occlusion image layer is superimposed on the original image layer, the occlusion image occludes the lower half of the target object.

[0036] It should be noted that, in practice, which layer is used as the occlusion layer, which layer is used as the original image layer, and which object or objects in the original image layer are used as the target object can be specified by the user.

[0037] S120: Identify the target object in the original image layer to obtain a first mask.

[0038] The first mask marks the location of the target object in the original image layer.

[0039] Optionally, an object recognition model may be used to recognize the target object in the original image layer to obtain a first mask. For example, if the target object is a person, a person recognition model may be used; if the target object is an animal, an animal recognition model may be used.

[0040] For example, for Figure 2 The original image layer given in , with the gourd-shaped pattern as the target object, obtains the first mask. Figure 3 As shown, the first mask marks the location of the target object.

[0041] S130 , based on the occluded image layer, crop the first mask to obtain a second mask.

[0042] There are many methods for implementing this step, and this application does not limit this. Exemplarily, the implementation method of this step includes: unifying the occluding image layer and the first mask into the same coordinate system, and cropping the first mask based on the coordinate values ​​of the occluding image layer and the first mask in the coordinate system.

[0043] It should be noted that, in practice, in order to enable each layer to be edited independently, each layer is usually set to have its own coordinate system, and the canvas has a coordinate system corresponding to the canvas. This will result in the occlusion image layer coordinate system and the first mask layer coordinate system often not completely overlapping. In practice, the two may be rotated, flipped, horizontally or vertically axially scaled, etc. In view of this, optionally, the implementation method of this step can be set to include: taking the coordinate system corresponding to the occlusion image layer as the target coordinate system; placing the first mask in the target coordinate system; based on the coordinate values ​​of the occlusion image layer and the first mask in the target coordinate system, the first mask is cropped to obtain a second mask. This setting can reduce the amount of calculation for determining the cropping area, thereby improving the efficiency of cropping the first mask.

[0044] For example, based on Figure 2 The occlusion image in the occlusion image layer in Figure 3 After cutting the first mask in , the second mask is obtained as Figure 4 As shown, see Figure 4 The second mask includes a first area and a second area, the first area at least partially overlaps with the target object in the original image layer, and the second area is the area in the second mask except the first area.

[0045] S140: Based on the second mask, erase the local area of ​​the occluded image layer.

[0046] Optionally, the second mask includes a first area and a second area, the first area at least partially overlaps with the target object in the original image layer, and the second area is the area of ​​the second mask other than the first area. The implementation method of this step includes: erasing the image in the area corresponding to the first area in the occluding image layer so that the target object in the original image layer is visible from the first area; or erasing the image in the area corresponding to the second area in the occluding image layer so that the occluding image layer only occludes the target object in the original image layer.

[0047] The image in the area corresponding to the first area in the occluding image layer is erased, which essentially means that the image in the first area in the occluding image layer is regarded as the content to be erased. Figure 2 and Figure 5 , after erasing the image in the first area in the occluding image layer, the lower half of the gourd-shaped pattern in the original image layer is revealed.

[0048] Erasing the image in the area corresponding to the second area in the occluding image layer essentially means that the image in the second area in the occluding image layer is regarded as the content to be erased. Figure 2 and Figure 6, after erasing the image in the second area in the occluding image layer, the lower half of the gourd-shaped pattern in the original image layer is still occluded, but the image outside the gourd-shaped pattern in the occluding image layer is removed.

[0049] The above technical solution is configured to obtain an original image layer and an occluded image layer, wherein the original image layer includes a target object; the occluded image layer occludes at least part of the target object; the target object in the original image layer is identified to obtain a first mask; based on the occluded image layer, the first mask is cropped to obtain a second mask; based on the second mask, a local area of ​​the occluded image layer is erased. In essence, it provides a method to assist users in accurately determining an erasure area and performing image erasure. This method does not require users to define the erasure area by smearing, and the image erasure efficiency is high. Moreover, the erasure area determined by it has a high accuracy, which can avoid the occurrence of adverse problems such as information loss and edge blurring caused by inaccurate determination of the erasure area to a certain extent.

[0050] Based on the above technical solution, optionally, after S140, the method may further include: synthesizing the original image layer and the occluded image layer after the erasure process to obtain the target image. In some scenarios, after the erasure operation, the occluded image layer and the original image layer themselves can be used as a creative photo editing result, which can be subsequently saved, displayed or disseminated.

[0051] In the above technical solution, optionally, S120 can also be replaced by: obtaining a first candidate image layer; merging the first candidate image layer with the original image layer to obtain a target layer; identifying a target object in the target layer to obtain a first mask.

[0052] The first candidate image layer may be, for example, a layer specified by a user. Optionally, the first candidate image layer may be, for example, the remaining layers in the current display interface (such as the canvas currently displayed by the terminal) except the original image layer and the occluded image layer.

[0053] The first candidate image layer is merged with the original image layer to obtain a target layer; the target object in the target layer is identified to obtain a first mask, which essentially allows the scope to be erased to be further limited with the help of the first candidate image layer.

[0054] Furthermore, the first candidate image layer and the occluding image layer have a stacking relationship; merging the first candidate image layer with the original image layer to obtain a target layer may include: determining a second candidate image layer in the first candidate image layer according to the stacking relationship between the first candidate image layer and the occluding image layer; the second candidate image layer is below the occluding image layer; and merging the second candidate image layer with the original image layer to obtain the target layer.

[0055] For example, see Figure 7 , assuming that the canvas displayed by the terminal includes 4 layers in total, from the bottom to the top, they are layer 1 to layer 4, where layer 1 is the original image layer and layer 3 is the occluded image layer. Layer 2 and layer 4 are both first candidate image layers. Layer 2 is located below layer 3, that is, between layer 1 and layer 3. Layer 4 is located above layer 3. Then layer 2 is the second candidate image layer. When the target object is subsequently identified, the whole formed by layer 1 and layer 2 is identified to obtain the first mask. The first mask is as shown in Figure 8 As shown. Subsequently, based on the occluded image layer (i.e., layer 3), the first mask is cropped to obtain a second mask. The second mask is as shown Fig. 9 shown.

[0056] Based on the above technical solutions, optionally, the method may also include: determining the target pixels based on the target object; determining the ratio of the number of target pixels in the third area to the total number of pixels in the third area, the third area being the area obtained by projecting the first mask onto the original image; judging whether the target object is successfully identified based on the ratio; S130 includes: if the judgment result is that the target object is successfully identified, cropping the first mask based on the occluded image layer to obtain a second mask.

[0057] The target pixel is a pixel associated with the target object. The number of target pixels can determine to a certain extent whether the obtained first mask actually indicates the position of the target object. For example, if the target object is a white cat, if the target object is correctly identified, it means that the ratio of the number of white pixels in the third area to the total number of pixels in the third area will be larger. It is determined that the target pixel is white.

[0058] There are many specific implementation methods for "determining whether the target object is successfully identified based on the ratio", and this application does not limit this. Exemplarily, the implementation method of this step may include determining whether the target object is successfully identified based on the magnitude relationship between the ratio and a preset threshold. The preset threshold can be set according to actual needs, and this application does not limit this.

[0059] In practice, the target object recognition model is not perfect and may have various recognition errors, such as misidentifying one object as another; there is a target object in the original image but it is not recognized; there is no target object in the original image but background noise or random patterns in the original image are regarded as the target object, etc. In view of this, by setting the ratio of the number of target pixels in the third area to the total number of pixels in the third area; based on the ratio, judging whether the target object is successfully recognized, is essentially a test of the recognition result to further ensure that the erasure area is accurately determined.

[0060] 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.

[0061] 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.

[0062] 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.

[0063] 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.

[0064] 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.

[0065] Fig.10 Schematic diagram of the structure of an image erasing device in an embodiment of the present disclosure. The image erasing device provided in the embodiment of the present disclosure can be configured in a client, or can be configured in a server. Fig.10 , the image erasing device specifically comprises:

[0066] An acquisition module 310 is used to acquire an original image layer and a blocked image layer, wherein the original image layer includes a target object; and the blocked image layer blocks at least a portion of the target object;

[0067] The recognition module 320 is used to recognize the target object in the original image layer to obtain a first mask;

[0068] A cropping module 330, configured to crop the first mask based on the occluding image layer to obtain a second mask;

[0069] The erasing module 340 is used to erase the local area of ​​the occluding image layer based on the second mask.

[0070] Furthermore, the identification module 320 is used to:

[0071] Get the first candidate image layer;

[0072] Merging the first candidate image layer with the original image layer to obtain a target layer;

[0073] The target object in the target layer is identified to obtain a first mask.

[0074] Further,

[0075] The first candidate image layer and the occluded image layer have a stacking relationship; the identification module 320 is used to:

[0076] According to the stacking relationship between the first candidate image layer and the occluding image layer, determining a second candidate image layer in the first candidate image layer; the second candidate image layer is below the occluding image layer;

[0077] The second candidate image layer is merged with the original image layer to obtain a target layer.

[0078] Furthermore, the cutting module 330 is used to:

[0079] The coordinate system corresponding to the occluded image layer is used as the target coordinate system;

[0080] placing the first mask in the target coordinate system;

[0081] Based on the coordinate values ​​of the occluding image layer and the first mask in the target coordinate system, the first mask is cropped to obtain a second mask.

[0082] Furthermore, the device also includes a verification module, which is used to:

[0083] Based on the target object, determining a target pixel;

[0084] Determine a ratio of the number of target pixels in a third area to the total number of pixels in the third area, wherein the third area is an area obtained by projecting the first mask onto the original image;

[0085] Based on the ratio, determining whether the target object is successfully identified;

[0086] The cutting module 330 is used to:

[0087] If the judgment result is that the target object is successfully identified, the first mask is cropped based on the occluded image layer to obtain a second mask.

[0088] Furthermore, the second mask includes a first area and a second area, the first area at least partially overlaps with the target object in the original image layer, and the second area is an area in the second mask except the first area;

[0089] The erasing module 340 is used for:

[0090] Erasing the image in the area corresponding to the first area in the occluded image layer, so that the target object in the original image layer is visible from the first area; or

[0091] The image in the area corresponding to the second area in the occluding image layer is erased so that the occluding image layer only occludes the target object in the original image layer.

[0092] Furthermore, the device also includes a synthesis module, which is used to:

[0093] The original image layer and the occluded image layer after the erasure process are synthesized to obtain a target image.

[0094] The image erasing device provided in the embodiment of the present disclosure can execute the steps executed by the client or server in the image erasing 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.

[0095] Fig.11 Schematic diagram of the structure of an electronic device in the embodiment of the present disclosure. Fig.11 , 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. Fig.11 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.

[0096] like Fig.11As 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 erasing 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.

[0097] 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 Fig.11 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.

[0098] 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 erasing 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.

[0099] 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.

[0100] 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.

[0101] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0102] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:

[0103] Acquire an original image layer and a blocked image layer, wherein the original image layer includes a target object; and the blocked image layer blocks at least a portion of the target object;

[0104] Identify the target object in the original image layer to obtain a first mask;

[0105] Based on the occluding image layer, the first mask is cropped to obtain a second mask;

[0106] Based on the second mask, a local area of ​​the occluded image layer is erased.

[0107] 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.

[0108] 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).

[0109] 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.

[0110] 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.

[0111] 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.

[0112] 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.

[0113] According to one or more embodiments of the present disclosure, the present disclosure provides an electronic device, including:

[0114] one or more processors;

[0115] A memory for storing one or more programs;

[0116] When the one or more programs are executed by the one or more processors, the one or more processors implement any image erasing method provided by the present disclosure.

[0117] 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 erasing method as described in any one of the present disclosure is implemented.

[0118] The embodiment of the present disclosure further provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, the image erasing method as described above is implemented.

[0119] 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.

[0120] 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 erasing method, characterized in that: include: Acquire an original image layer and a blocked image layer, wherein the original image layer includes a target object; The occlusion image layer occludes at least a portion of the target object; Identify the target object in the original image layer to obtain a first mask; Based on the occluding image layer, the first mask is cropped to obtain a second mask; Based on the second mask, a local area of ​​the occluded image layer is erased.

2. The method according to claim 1, characterized in that The step of identifying the target object in the original image layer to obtain a first mask includes: Get the first candidate image layer; Merging the first candidate image layer with the original image layer to obtain a target layer; The target object in the target layer is identified to obtain a first mask.

3. The method according to claim 2, characterized in that The first candidate image layer and the occluded image layer have a stacking relationship; and merging the first candidate image layer with the original image layer to obtain a target layer includes: According to the stacking relationship between the first candidate image layer and the occluding image layer, determining a second candidate image layer in the first candidate image layer; the second candidate image layer is below the occluding image layer; The second candidate image layer is merged with the original image layer to obtain a target layer.

4. The method according to claim 1, characterized in that: Based on the occluding image layer, the first mask is cropped, including: The coordinate system corresponding to the occluded image layer is used as the target coordinate system; placing the first mask in the target coordinate system; Based on the coordinate values ​​of the occluding image layer and the first mask in the target coordinate system, the first mask is cropped to obtain a second mask.

5. The method according to claim 1, characterized in that Also includes: Based on the target object, determining a target pixel; Determine a ratio of the number of target pixels in a third area to the total number of pixels in the third area, wherein the third area is an area obtained by projecting the first mask onto the original image; Based on the ratio, determining whether the target object is successfully identified; The step of clipping the first mask based on the occluded image layer to obtain a second mask includes: If the judgment result is that the target object is successfully identified, the first mask is cropped based on the occluded image layer to obtain a second mask.

6. The method according to claim 1, characterized in that The second mask includes a first area and a second area, the first area at least partially overlaps with the target object in the original image layer, and the second area is an area of ​​the second mask except the first area; The step of erasing the local area of ​​the occluded image layer based on the second mask includes: Erasing the image in the area corresponding to the first area in the shielding image layer, so that the target object in the original image layer is visible from the first area; or, The image in the area corresponding to the second area in the occluding image layer is erased so that the occluding image layer only occludes the target object in the original image layer.

7. The method according to claim 1, characterized in that After erasing the local area of ​​the blocking image layer based on the second mask, the method further includes: The original image layer and the occluded image layer after the erasure process are synthesized to obtain a target image.

8. An image erasing device, characterized in that: include: An acquisition module, used for acquiring an original image layer and a masked image layer, wherein the original image layer includes a target object; The occlusion image layer occludes at least a portion of the target object; A recognition module, used for recognizing the target object in the original image layer to obtain a first mask; A cropping module, configured to crop the first mask based on the occluded image layer to obtain a second mask; An erasing module is used to erase a local area of ​​the occluded image layer based on the second mask.

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.