Trademark erasing method and device, electronic device and readable storage medium

By identifying and erasing pixels other than human figures in the trademark area of ​​an image, the problem of trademark occlusion affecting visual effects is solved, achieving the effect of preserving the integrity of the person and improving the visual experience.

CN116740230BActive Publication Date: 2026-11-27BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310605368.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-25
Publication Date
2026-11-27
Estimated Expiration
2043-05-25

AI Technical Summary

Technical Problem

In existing technologies, the portion of an image where a trademark overlaps with a person is masked with mosaic, which affects the visual effect of the image and reduces the visual experience.

Method used

By identifying the trademark area and human body pixels in the image, pixels in the trademark area other than human body pixels are erased to preserve the integrity of the person. Precise erasure is achieved by using a merged mask image of the trademark mask image and the human body mask image.

Benefits of technology

While erasing the trademark, the integrity of the people in the image was preserved, improving the visual experience and reducing the impact of the trademark being obscured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116740230B_ABST
    Figure CN116740230B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a trademark erasing method and device, electronic equipment and readable storage medium, and relate to the technical field of image processing. The method comprises: obtaining a trademark region in which a trademark is located in a first image; obtaining human body pixels in the first image; erasing pixels in the trademark region of the first image except the human body pixels, to obtain a first image after trademark erasing. The present application can retain as much as possible complete human body pixels in the first image while erasing the trademark and reducing trademark occlusion, and can retain as much as possible the integrity of the figure in the first image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to trademark erasure methods and apparatus, electronic devices, and readable storage media. Background Technology

[0002] Erasing existing trademarks from an image can reduce trademark obstruction, improve the visual effect of the image, and enable image reuse.

[0003] In images, trademarks may overlap with figures. Currently, the main method is to use mosaic to cover all parts of the trademark in the image. That is, if the trademark overlaps with a figure in the image, the portion of the trademark overlapping the figure is also covered with mosaic.

[0004] However, using mosaic to cover the parts of the logo that overlap with the figures also affects the visual effect of the figures in the image and reduces the visual experience of the image. Summary of the Invention

[0005] The purpose of this invention is to provide a trademark erasure method, apparatus, electronic device, and readable storage medium to achieve the technical objective of preserving complete human body pixels in an image while erasing the trademark. The specific technical solution is as follows:

[0006] In a first aspect of the present invention, a trademark erasure method is provided, the method comprising:

[0007] Obtain the trademark area located in the first image;

[0008] Obtain the human body pixels in the first image;

[0009] Erasure all pixels in the trademark area of ​​the first image except for the human body pixels to obtain the first image after trademark erasure.

[0010] In a second aspect of the invention, a trademark erasure device is also provided, the device comprising:

[0011] The trademark acquisition module is used to acquire the trademark area where the trademark is located in the first image;

[0012] The human body pixel acquisition module is used to acquire human body pixels in the first image;

[0013] The erasure module is used to erase pixels in the trademark area of ​​the first image, except for the human body pixels, to obtain the first image after the trademark has been erased.

[0014] In a third aspect of the invention, a computer-readable storage medium is also provided, wherein instructions are stored therein, which, when executed on a computer, cause the computer to perform any of the trademark erasure methods described above.

[0015] In a fourth aspect of the invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the trademark erasure methods described above.

[0016] The trademark erasure method provided in this embodiment of the invention erases all pixels in the trademark area of ​​the first image except for human body pixels. While erasing the trademark and reducing trademark occlusion, it can preserve as many complete human body pixels in the first image as possible, that is, preserve the integrity of the person in the first image as much as possible. It can solve the technical problem that using mosaic to cover the part of the trademark that overlaps with the person in the image will affect the visual effect of the person in the image, and thus achieve the beneficial effect of preserving the integrity of the person in the first image. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.

[0018] Figure 1 This is a flowchart illustrating the steps of a trademark erasure method according to an embodiment of the present invention;

[0019] Figure 2 This is a flowchart illustrating the steps of another trademark erasure method in an embodiment of the present invention;

[0020] Figure 3 This is a schematic diagram illustrating the overlapping and merging of the human body mask image and the trademark mask image in an embodiment of the present invention;

[0021] Figure 4 This is a schematic diagram of a trademark erasure process according to an embodiment of the present invention;

[0022] Figure 5 This is a schematic diagram of the structure of a trademark erasing device according to an embodiment of the present invention;

[0023] Figure 6 This is a schematic diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0024] The technical solutions of the present invention will now be described with reference to the accompanying drawings in the embodiments of the present invention.

[0025] Figure 1 This is a flowchart illustrating the steps of a trademark erasure method according to an embodiment of the present invention, as follows: Figure 1 As shown, the method includes:

[0026] Step 101: Obtain the trademark area in the first image where the trademark is located.

[0027] The trademark mentioned in this application is a visual sign used to identify and distinguish the source of goods or services. Such a trademark may include at least one of the following visual elements: words, graphics, letters, numbers, three-dimensional signs, colors, etc.

[0028] The first image here can be at least one frame from a picture or video, etc., and is not specifically limited in this embodiment of the invention.

[0029] For example, the first image may be a single frame or several frames from a video, and the first image may contain the trademark of a video playback platform, or the first image may contain the trademark of a sponsor of the video.

[0030] For example, the first image here could be a poster, a common form of advertising used for movies, TV series, plays, competitions, cultural performances, promotions, and other events. Posters typically include text information such as the nature of the event, the organizer, the time, and the location. They are often used in film and television productions and new product promotions, utilizing a complete combination of elements such as images, text, color, and space. Posters often feature embedded text and images, and contain many elements with complex backgrounds. This first image may include the logo of the event organizer.

[0031] The number of trademarks in the first image is not specifically limited. For example, the first image may include one trademark or multiple trademarks.

[0032] This step primarily involves identifying trademarks from the first image based on their visual characteristics, thus defining the area containing the trademark as the trademark region. This step determines the position or coordinates of the trademark within the first image. When the first image contains multiple trademarks, this step may involve identifying only specific trademarks, or it may involve identifying all trademarks in the first image; this invention does not impose specific limitations on this approach.

[0033] Step 102: Obtain the human body pixels in the first image.

[0034] The first image contains people, and this step is to identify the people in the first image and determine the pixels of the people as the human body pixels in the first image.

[0035] It should be noted that the human body pixels here can include pixels of all parts of the human body, or they can include pixels of only specific parts of the human body; this invention does not impose a specific limitation on this. For example, the human body pixels here can be pixels of the entire person. Alternatively, the human body pixels can be pixels of the person's face, etc. This step determines the position or coordinates of the person in the first image.

[0036] Step 103: Erase all pixels in the trademark area of ​​the first image except for the human body pixels to obtain the first image after the trademark has been erased.

[0037] In the trademark area of ​​the first image, pixels other than human body pixels are erased. That is, if there are parts of the trademark that overlap with human body pixels, these parts are not erased. Only the parts of the trademark that do not overlap with human body pixels are erased. This preserves as many human body pixels as possible in the first image, ensuring the integrity of the person in the first image. For some images that mainly feature people, this can improve the visual experience and reduce the impact of the trademark.

[0038] For example, in the first image, there is trademark A and idol figure B. The first part of trademark A overlaps with the arm of idol figure B, while the rest of trademark A does not overlap with idol figure B. Therefore, the trademark area in the first image can be considered the area containing trademark A. The human body pixels in the first image can be all the pixels of idol figure B. During the erasing process using this method, the first part of trademark A is preserved, and only the rest of trademark A is erased, thus ensuring the integrity of idol figure B. This not only appropriately reduces the impact of trademark A but also preserves the integrity of idol figure B, improving the visual experience of the first image, especially for fans of idol figure B.

[0039] It should be noted that the order of steps 101 and 102 is not specifically limited. For example, steps 101 and 102 can be performed simultaneously, or step 102 can be performed first and then step 101.

[0040] Figure 2 This is a flowchart illustrating the steps of another trademark erasure method in an embodiment of the present invention, as follows: Figure 2 As shown, the method includes:

[0041] Step 201: Identify the preset trademark characters in the first image, and determine the area in the first image containing the preset trademark characters as the trademark area in the first image; and / or, identify the trademarks in the first image through a preset trademark image library to obtain the trademark area in the first image where the trademarks are located.

[0042] Specifically, trademarks typically contain trademark characters, which can include at least one of the following: trademark text, trademark letters, trademark symbols, trademark numbers, etc. If the first image contains content with a similarity greater than or equal to a preset trademark character, the first image is confirmed to contain a trademark, and the area containing the content with a similarity greater than or equal to the preset trademark character is defined as the trademark area in the first image. The preset similarity can be set according to actual needs, and there is no specific limit to the specific value. There can be one or more preset trademark characters. There is no specific limit to the number of preset trademark characters.

[0043] For example, if the goal is only to erase certain specific trademarks in the first image, then the trademark characters here can be the trademark characters contained within those specific trademarks. If the goal is to erase as many trademarks as possible in the first image, then the trademark characters here can be a large number of trademark characters, etc.

[0044] Alternatively, a pre-defined trademark image library can be established, with no specific limit on the number of trademarks in the library. Each pixel in the first image is compared one-to-one with each pixel of each trademark in the pre-defined trademark image. If the similarity between the two is greater than or equal to a pre-defined similarity, the first image is considered to contain a trademark. The area containing pixels in the first image whose similarity to each trademark in the pre-defined trademark image library is greater than or equal to the pre-defined similarity is defined as the trademark area.

[0045] Using the above method, the area where the trademark is located in the first image can be accurately determined. Furthermore, by setting preset trademark characters and trademarks from a preset trademark library, the trademarks to be identified in the first image can be determined flexibly and in various ways.

[0046] It should be noted that the accuracy of identifying the trademark area in the first image using a preset trademark image library may be slightly higher than the accuracy of identifying the trademark area in the first image using preset trademark characters. The reason for this is that the trademarks in the preset trademark image library are complete images, and comparison based on these complete images is more accurate.

[0047] Step 202: Perform human body segmentation on the first image to obtain human body pixels in the first image.

[0048] This step mainly involves identifying human and non-human pixels in the first image. For example, human skeletal posture and other parameters can be combined to perform human segmentation on the first image, thereby identifying human and non-human pixels within the first image. In this invention, no specific limitation is made to the specific human segmentation method.

[0049] Step 203: Obtain the trademark mask image corresponding to the first image based on the trademark area where the trademark is located in the first image; the size of the trademark mask image is equal to the size of the first image.

[0050] Optionally, the trademark mask image has a first region corresponding to the trademark region; the size of the first region is equal to the size of the trademark region, and the position of the first region in the trademark mask image corresponds to the position of the trademark region in the first image.

[0051] This step can involve generating a trademark mask image with the same size as the first image, and then defining the area in the trademark mask that corresponds to the trademark area in the first image as the first region. The size of the first region is equal to the size of the trademark area, and the position of the first region in the trademark mask image corresponds to the position of the trademark area in the first image. The main function of this trademark mask image is to distinguish between the trademark area and non-trademark areas in the first image.

[0052] Optionally, step 203 may include steps 2031 and 2032. Step 2031: Generate a second image with the same size as the first image; the second image includes a third region corresponding to the trademark region; the size of the third region is equal to the size of the trademark region, and the position of the third region in the second image corresponds to the position of the trademark region in the first image. Step 2032: Set the pixel values ​​of all pixels in the third region of the second image to a first preset pixel value, and set the pixel values ​​of all pixels in the remaining regions of the second image (excluding the third region) to a second preset pixel value, to obtain the trademark mask image; the first preset pixel value is different from the second preset pixel value. By setting the pixel values ​​of the third region corresponding to the trademark region in the second image to the first preset pixel value, and setting the pixel values ​​of the remaining regions of the second image (excluding the third region) to the second preset pixel value, the trademark region and non-trademark regions in the first image can be clearly distinguished. The first preset pixel value and the second preset pixel value only need to be different; the specific values ​​are not limited.

[0053] For example, the pixel values ​​of the third region in the second image can be set to 255, and the pixel values ​​of the remaining regions in the second image other than the third region can be set to 0, thus obtaining the trademark mask image.

[0054] Step 204: Obtain the human body mask image corresponding to the first image based on the human body pixels in the first image; the size of the human body mask image is equal to the size of the first image.

[0055] Optionally, the human body mask image has mask pixels corresponding to the human body pixels; the number of mask pixels is equal to the number of human body pixels, and the position of each mask pixel in the human body mask image corresponds to the position of each human body pixel in the first image.

[0056] This step can involve generating a human body mask image with the same size as the first image, and then determining the pixels in the human body mask that correspond to the human body pixels in the first image as mask pixels. The number of mask pixels in the human body mask image is equal to the number of human body pixels in the first image, and the position of each mask pixel in the human body mask image corresponds to the position of each human body pixel in the first image. The main function of this human body mask image is to distinguish between human body regions and non-human body regions in the first image.

[0057] Optionally, step 204 may include steps 2041 and 2042. Step 2041: Generate a third image with the same size as the first image; the third image contains human body mask pixels corresponding to the human body pixels; the number of human body mask pixels is equal to the number of human body pixels, and the position of each human body mask pixel in the third image corresponds to the position of each human body pixel in the first image. Step 2042: Set the pixel values ​​of all human body mask pixels in the third image to a third preset pixel value, and set the pixel values ​​of all other pixels in the third image except for the human body mask pixels to a fourth preset pixel value, to obtain the human body mask image; the third preset pixel value is different from the fourth preset pixel value. By setting the pixel values ​​of all human body mask pixels in the third image to the third preset pixel value, and setting the pixel values ​​of all other pixels in the human body mask image except for the human body mask pixels to the fourth preset pixel value, the human body region and non-human body region in the first image can be clearly distinguished. The third and fourth preset pixel values ​​here can be different; there are no restrictions on the specific values.

[0058] For example, the pixel value of each human body mask pixel in the third image can be set to 255, and the pixel values ​​of the remaining areas in the third image other than the human body mask pixels can be set to 0 to obtain a human body mask image.

[0059] Step 205: Overlap and merge the human body mask image and the trademark mask image to obtain a merged mask image including a first region; the first region is the area in the merged mask image that is composed of the trademark mask pixels corresponding to the pixels in the trademark region other than the human body pixels.

[0060] The size of the human body mask image is the same as the size of the first image, and the size of the trademark mask image is also the same as the size of the first image. The merged mask image is obtained by overlapping and merging the human body mask image and the trademark mask image. Therefore, the size of the merged mask image is also the same as the size of the first image.

[0061] Optionally, step 205 may include steps 2051 and 2052. Step 2051: Overlap the human body mask image and the trademark mask image. Step 2052: In the trademark mask image, remove the trademark mask pixels corresponding to the human body mask pixels whose orthographic projection falls into the second region from the second region to obtain a merged mask image including the first region. Figure 3 This is a schematic diagram illustrating the overlapping and merging of a human body mask image and a trademark mask image in an embodiment of the present invention. (Refer to...) Figure 3 , Figure 3 In the image on the left, the human body mask image is shown. Each small square in the human body mask image represents a pixel. In the human body mask image, black squares represent human body mask pixels, and white squares represent other pixels besides human body mask pixels. Figure 3 In the image, the central image is the trademark mask image. Each small square in the trademark mask image represents a pixel. In the trademark mask image, black squares represent trademark mask pixels, and white squares represent other pixels besides the trademark mask pixels. Figure 3 In the trademark mask image, the area formed by the black squares is the second area. Figure 3 In the image on the right, the merged mask image is shown. Each small square in the merged mask image represents a pixel. Black squares in the merged mask image represent the remaining trademark mask pixels, and the area formed by the black squares is the first region. During the overlapping and merging process, the trademark mask pixels corresponding to the human body mask pixels projected into the second region are replaced as other pixels in the trademark mask image. The remaining portion in the second region becomes the first region in the merged mask image. In other words, the first region is the area composed of the trademark mask pixels corresponding to all pixels in the second region of the merged mask image that are excluding the human body mask pixels. This step is equivalent to re-dividing the trademark region in the first image, using the area in the original trademark region that did not contain human body pixels as the re-divided trademark region.

[0062] It should be noted that in the merged mask image, the pixel values ​​of all pixels in the first region are the aforementioned first preset pixel values, and the pixel values ​​of the remaining pixels in the merged mask image other than the first region are the aforementioned second preset pixel values.

[0063] For example, referring to the previous example, in the merged mask image, the pixel value of all pixels in the first region is 255, and the pixel value of all other regions in the merged mask image other than the first region is 0.

[0064] The primary function of the first region of the merged mask image is to accurately represent the area or portion of the trademark region in the first image that does not contain human body pixels.

[0065] Step 206: Based on the first region of the merged mask image and the first image, erase the pixels in the trademark region of the first image, except for the human body pixels.

[0066] The portion of the first image other than the area corresponding to the first region is used as the source for restoration, forming a restoration region image of the area in the trademark region of the first image that does not contain human body pixels. Replacing the area formed by pixels other than human body pixels in the trademark region of the first image with this restoration region image completes the erasure of the trademark in the first image.

[0067] In the above method, since it accurately represents the area or part of the trademark area in the first image that does not contain human body pixels, the above method can accurately erase pixels other than human body pixels in the trademark area of ​​the first image, and only accurately erase the part of the trademark that does not overlap with human body pixels, thereby preserving as many complete human body pixels as possible in the first image, further ensuring the integrity of the person in the first image. For some images with people as the main subject, it can improve the visual experience and reduce the impact of the trademark.

[0068] Optionally, step 206 may include:

[0069] Step 2061: Take the region in the first image corresponding to the first region as the invalid region and the remaining regions in the first image as the valid region. Perform downsampling and upsampling on the valid regions in sequence to obtain a coarse-grained repair region image.

[0070] Step 2062: Combining the attention mechanism, the coarse-grained repair region image is downsampled and upsampled sequentially to obtain the fine-grained repair region image corresponding to the invalid region in the first image; wherein, all upsampling and all downsampling are performed using gated convolution.

[0071] Step 2063: Replace the invalid region in the first image with the fine-grained repair region image to erase pixels in the trademark region of the first image, except for the human body pixels.

[0072] In the first image, the region corresponding to the first area is the region that needs to be erased or repaired. Therefore, it is considered an invalid region during the formation of the repaired region image. The repaired region image originates from other regions in the first image, thus these other regions are considered valid regions for forming the repaired region image. The aforementioned valid regions are sequentially downsampled and upsampled. The above sampling process is used to extract features of the repaired region image to obtain a coarse-grained repaired region image.

[0073] The attention mechanism originates from research on human vision. In cognitive science, due to information processing bottlenecks, humans selectively focus on a portion of all information while ignoring other visible information; this mechanism is commonly referred to as the attention mechanism. Different parts of the human retina possess varying degrees of information processing capacity, or acuity, with only the fovea possessing the highest acuity. To efficiently utilize limited visual information processing resources, humans need to select specific parts of the visual region and then focus their attention on them. The attention mechanism primarily involves two aspects: determining which part of the input to focus on; and allocating limited information processing resources to the important parts. Then, combining the attention mechanism described above, the coarse-grained restoration region image is sequentially downsampled and upsampled to obtain the fine-grained restoration region image corresponding to the aforementioned invalid region in the first image. By incorporating the attention mechanism, the quality of the obtained restoration region image can be improved.

[0074] All the aforementioned upsampling and downsampling operations employed gated convolution. The main purpose of using gated convolution is to ensure that the convolution result depends as much as possible on the pixels of the aforementioned effective region. Trademarks are typically irregularly shaped, as are human body parts. Therefore, in the aforementioned first image, the region corresponding to the second region is highly likely to be an irregular region. Gated convolution effectively improves the image restoration quality in irregular regions.

[0075] Then, the fine-grained repair area image corresponding to the aforementioned invalid area in the first image is used to replace the aforementioned invalid area in the first image, thus completing the erasure of pixels other than human body pixels in the trademark area of ​​the first image. This method can further improve the quality of the repair area image, so the erasure effect is good, resulting in good quality of the first image after trademark erasure, which is conducive to its reuse.

[0076] It should be noted that the aforementioned process of first obtaining a coarse-grained repair region image, then combining an attention mechanism to obtain a fine-grained repair region image, and the erasing process can be performed using an erasing model. For example, it can utilize deepfillev2, etc., but in this embodiment of the invention, no specific limitation is made. For example, the first image containing only the effective region can be the damaged image in deepfillev2, and the merged mask image corresponds to the hole mask.

[0077] Figure 4 This is a schematic diagram of a trademark erasure process according to an embodiment of the present invention. For example, refer to... Figure 4 As shown, for the first image, human body segmentation is performed to obtain the human body pixels in the first image. Then, based on the human body pixels in the first image, a human body mask image corresponding to the first image is formed. At the same time, trademark recognition is performed on the first image to obtain the region where the trademark is located in the first image. Then, based on the region where the trademark is located in the first image, a trademark mask image corresponding to the first image is formed. The two are overlapped and merged to obtain a merged mask image. Then, the merged mask image and the first image are used as inputs to deepfillev2. deepfillev2 erases the pixels in the trademark region of the first image except for the human body pixels and outputs the first image after the trademark is erased.

[0078] Optionally, the aforementioned first image is at least one frame from the first video. The aforementioned method may further include: recombining the second video based on each of the first images after trademark erasure. During the synthesis process, images without trademark erasure are retained, and the first images before trademark erasure are replaced with the first images after trademark erasure. Here, the human body pixels can be pixels of all parts of the human body, or pixels of a specific part of the human body. In the recombined second video, the image of the person is completely unobstructed, or the specific parts of the person are unobstructed; only at least part of the trademark has been erased, preserving the integrity of the person as much as possible, reducing the impact of the trademark on the video, and improving the video's replayability.

[0079] For example, sponsor L pays trademark placement fees to platform 1, and the first video displayed on platform 1 bears sponsor L's trademark. This same video is then intended for platform 2, but sponsor L hasn't paid trademark placement fees to platform 2. Playing the first video directly on platform 2 would mean platform 2 is essentially providing free trademark placement for sponsor L, and the trademark's obstruction would negatively impact the viewing experience. Therefore, a different method can be used. Here, the human body pixels can represent all parts of the human body. Sponsor L's trademark is erased from each frame of the first video while maintaining the integrity of the person in each frame. Then, the images from the erased frames are used to reconstruct the second video, which is then played on platform 2. This not only improves video reuse but also reduces the obstruction of sponsor L's trademark, enhancing the viewing experience.

[0080] It should be noted that the second video can be re-synthesized using video compositing tools, such as FFmpeg (FastForward Moving Picture Expert Group).

[0081] Optionally, the first video includes advertisements. The trademarks in the first image are at least a portion of the trademarks in the advertisement. Here, "advertising" primarily refers to the means of disseminating information about goods or services to consumers or users through advertising media on a paid basis for promoting goods or providing services. In other words, by erasing some trademarks from the advertisement in the first video and then recombining them into a second video, the characters in the second video are all complete, improving the viewing experience and completeness of the second video after trademark erasure, without affecting the sale of the advertisements.

[0082] For example, sponsor L pays advertising fees to platform 1, and the first video played on platform 1 displays sponsor L's trademark. Then, this first video is to be played on platform 2, but sponsor L hasn't paid advertising fees to platform 2. If the first video is played directly, platform 2 is essentially giving sponsor L free advertising, and the obscuring of sponsor L's trademark would degrade the viewing experience. Therefore, a method can be used where the human body pixels can represent all parts of the human body. Sponsor L's trademark is erased from each frame of the first video while maintaining the integrity of the figures in each frame. Then, the images with the trademark erased are used to reconstruct the second video, which is then played on platform 2. This not only improves video reuse while selling advertising revenue but also reduces the obscuring of sponsor L's trademark, improving the viewing experience.

[0083] Figure 5 This is a schematic diagram of a trademark erasing device according to an embodiment of the present invention. The present invention also provides a trademark erasing device, see reference... Figure 5 As shown, the device may include:

[0084] The trademark acquisition module 301 is used to acquire the trademark area where the trademark is located in the first image;

[0085] Human body pixel acquisition module 302 is used to acquire human body pixels in the first image;

[0086] The erasure module 303 is used to erase pixels in the trademark area of ​​the first image, except for the human body pixels, to obtain the first image after the trademark has been erased.

[0087] Optionally, the device may further include: a trademark mask image acquisition module, used to acquire a trademark mask image corresponding to the first image based on the trademark area where the trademark is located in the first image; the size of the trademark mask image is equal to the size of the first image;

[0088] The human body mask image acquisition module is used to acquire a human body mask image corresponding to the first image based on the human body pixels in the first image; the size of the human body mask image is equal to the size of the first image;

[0089] The merging module is used to overlap and merge the human body mask image and the trademark mask image to obtain a merged mask image including a first region; the first region is the area in the merged mask image that is composed of the trademark mask pixels corresponding to the pixels in the trademark region other than the human body pixels;

[0090] The erasure module 303 may include:

[0091] The erase submodule is used to erase pixels other than the human body pixels in the trademark area of ​​the first image, based on the first region of the merged mask image and the first image.

[0092] Optionally, the trademark mask image has a second region corresponding to the trademark region; the size of the second region is equal to the size of the trademark region, and the position of the second region in the trademark mask image corresponds to the position of the trademark region in the first image.

[0093] The human body mask image has human body mask pixels corresponding to the human body pixels; the number of human body mask pixels is equal to the number of human body pixels, and the position of each human body mask pixel in the human body mask image corresponds to the position of each human body pixel in the first image.

[0094] Optionally, the merging module includes:

[0095] An overlapping placement submodule is used to overlap the human body mask image and the trademark mask image;

[0096] The merging submodule is used to remove the trademark mask pixels corresponding to the human body mask pixels that are orthographically projected into the second region from the second region in the trademark mask image, so as to obtain a merged mask image including the first region.

[0097] Optionally, the erasure submodule includes:

[0098] A coarse-grained restoration region image acquisition unit is used to take the region corresponding to the first region in the first image as an invalid region, take the remaining regions in the first image as valid regions, and perform downsampling and upsampling on the valid regions in sequence to obtain a coarse-grained restoration region image.

[0099] The fine-grained repair region image acquisition unit is used to combine an attention mechanism to sequentially downsample and upsample the coarse-grained repair region image to obtain the fine-grained repair region image corresponding to the invalid region in the first image; wherein, all upsampling and all downsampling are performed using gated convolution.

[0100] An erasing unit is configured to replace the invalid region in the first image with the repaired region image, thereby erasing pixels in the trademark region of the first image, except for the human body pixels.

[0101] Optionally, the trademark mask image acquisition module includes:

[0102] The second image generation submodule is used to generate a second image with the same size as the first image; the second image includes a third region corresponding to the trademark region; the size of the third region is the same as the size of the trademark region, and the position of the third region in the second image corresponds to the position of the trademark region in the first image;

[0103] The trademark mask image acquisition submodule is used to set the pixel values ​​of all pixels in the third region of the second image to a first preset pixel value, and to set the pixel values ​​of all pixels in the remaining regions of the second image other than the third region to a second preset pixel value, thereby obtaining the trademark mask image; the first preset pixel value and the second preset pixel value are different.

[0104] Optionally, the human body mask image acquisition module includes:

[0105] The third image generation submodule is used to generate a third image with the same size as the first image; the third image has human body mask pixels corresponding to the human body pixels; the number of human body mask pixels is equal to the number of human body pixels, and the position of each human body mask pixel in the third image is the same as the position of each human body pixel in the first image.

[0106] The human body mask image acquisition submodule is used to set the pixel values ​​of all human body mask pixels in the third image to a third preset pixel value, and set the pixel values ​​of all other pixels in the third image except for the human body mask pixels to a fourth preset pixel value, thereby obtaining the human body mask image; the third preset pixel value and the fourth preset pixel value are different.

[0107] Optionally, the trademark acquisition module 301 includes:

[0108] The first trademark acquisition submodule is used to identify preset trademark characters in the first image and determine the area in the first image containing the preset trademark characters as the trademark area in the first image;

[0109] And / or,

[0110] The second trademark acquisition submodule is used to identify the trademark in the first image through a preset trademark image library, so as to obtain the trademark area where the trademark is located in the first image.

[0111] Optionally, the human body pixel acquisition module 302 includes:

[0112] The human body pixel acquisition submodule is used to perform human body segmentation on the first image and acquire human body pixels in the first image.

[0113] Optionally, the first image is at least one frame from the first video; the device further includes:

[0114] The video compositing module is used to re-synthesize a second video based on the individual first images after the trademark has been erased.

[0115] Optionally, the first video contains advertisements; the trademarks in the first image are at least a portion of the trademarks in the advertisements.

[0116] It should be noted that the trademark erasure device can refer to the relevant records in the aforementioned trademark erasure methods and can achieve the same or similar beneficial effects. To avoid repetition, it will not be described again here.

[0117] This invention also provides an electronic device. Figure 6This is a schematic diagram of an electronic device according to an embodiment of the present invention. Figure 6 As shown, it includes a processor 401, a communication interface 402, a memory 403, and a communication bus 404, wherein the processor 401, the communication interface 402, and the memory 403 communicate with each other through the communication bus 404.

[0118] Memory 403 is used to store computer programs;

[0119] When processor 401 executes the program stored in memory 403, it performs the following steps:

[0120] Obtain the trademark area located in the first image;

[0121] Obtain the human body pixels in the first image;

[0122] Erasure all pixels in the trademark area of ​​the first image except for the human body pixels to obtain the first image after trademark erasure.

[0123] Optionally, before erasing the pixels other than the human body pixels in the trademark area of ​​the first image, the method further includes: obtaining a trademark mask image corresponding to the first image based on the trademark area where the trademark is located in the first image; the size of the trademark mask image is equal to the size of the first image; obtaining a human body mask image corresponding to the first image based on the human body pixels in the first image; the size of the human body mask image is equal to the size of the first image; overlapping and merging the human body mask image and the trademark mask image to obtain a merged mask image including a first region; the first region is the area formed by the merged mask image and the trademark mask pixels corresponding to the pixels in the trademark area other than the human body pixels.

[0124] The step of erasing pixels other than the human body pixels from the trademark area of ​​the first image includes:

[0125] Based on the first region of the merged mask image and the first image, pixels other than the human body pixels are erased from the trademark region of the first image.

[0126] Optionally, the trademark mask image has a second region corresponding to the trademark region; the size of the second region is equal to the size of the trademark region, and the position of the second region in the trademark mask image corresponds to the position of the trademark region in the first image.

[0127] The human body mask image has human body mask pixels corresponding to the human body pixels; the number of human body mask pixels is equal to the number of human body pixels, and the position of each human body mask pixel in the human body mask image corresponds to the position of each human body pixel in the first image.

[0128] Optionally, the step of overlapping and merging the human body mask image and the trademark mask image to obtain a merged mask image including the first region includes:

[0129] The human body mask image and the trademark mask image are overlapped;

[0130] In the trademark mask image, the trademark mask pixels corresponding to the human body mask pixels that are orthographically projected into the second region are removed from the second region to obtain a merged mask image including the first region.

[0131] Optionally, the step of erasing pixels other than the human body pixels in the trademark area of ​​the first image based on the first region of the merged mask image and the first image includes:

[0132] The region in the first image corresponding to the first region is taken as the invalid region, and the remaining regions in the first image are taken as the valid regions. The valid regions are downsampled and upsampled sequentially to obtain a coarse-grained repair region image.

[0133] By combining an attention mechanism, the coarse-grained repair region image is sequentially downsampled and upsampled to obtain the fine-grained repair region image corresponding to the invalid region in the first image; wherein, all upsampling and all downsampling are performed using gated convolution.

[0134] The invalid region in the first image is replaced with the repaired region image to erase pixels in the trademark region of the first image, except for the human body pixels.

[0135] Optionally, obtaining the trademark mask image corresponding to the first image based on the trademark area where the trademark is located in the first image includes:

[0136] Generate a second image with the same size as the first image; the second image includes a third region corresponding to the trademark region; the size of the third region is the same as the size of the trademark region, and the position of the third region in the second image corresponds to the position of the trademark region in the first image;

[0137] In the second image, the pixel values ​​of all pixels in the third region are set to a first preset pixel value, and the pixel values ​​of all pixels in the remaining regions of the second image other than the third region are set to a second preset pixel value to obtain the trademark mask image; the first preset pixel value and the second preset pixel value are different.

[0138] Optionally, obtaining the human body mask image corresponding to the first image based on the human body pixels in the first image includes:

[0139] A third image with the same size as the first image is generated; the third image has human body mask pixels corresponding to the human body pixels; the number of human body mask pixels is equal to the number of human body pixels, and the position of each human body mask pixel in the third image corresponds to the position of each human body pixel in the first image.

[0140] In the third image, the pixel values ​​of all the human body mask pixels are set to a third preset pixel value, and the pixel values ​​of all other pixels in the third image except for the human body mask pixels are set to a fourth preset pixel value to obtain the human body mask image; the third preset pixel value and the fourth preset pixel value are different.

[0141] Optionally, obtaining the trademark area where the trademark is located in the first image includes:

[0142] Identify the preset trademark characters in the first image, and determine the area in the first image containing the preset trademark characters as the trademark area in the first image;

[0143] And / or,

[0144] By using a pre-defined trademark image library, the trademark in the first image is identified to obtain the trademark area where the trademark is located in the first image.

[0145] Optionally, obtaining human body pixels in the first image includes:

[0146] Human body segmentation is performed on the first image to obtain human body pixels in the first image.

[0147] Optionally, the first image is at least one frame from the first video; the method further includes:

[0148] The second video is re-synthesized based on the individual first images after the trademark has been erased.

[0149] Optionally, the first video contains advertisements; the trademarks in the first image are at least a portion of the trademarks in the advertisements.

[0150] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0151] The communication interface is used for communication between the aforementioned terminal and other devices.

[0152] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0153] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0154] In another embodiment of the present invention, a computer-readable storage medium is also provided, which stores instructions that, when executed on a computer, cause the computer to perform any of the trademark erasure methods described in the above embodiments.

[0155] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the trademark erasure methods described in the above embodiments.

[0156] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).

[0157] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0158] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0159] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.

Claims

1. A method for removing trademarks, characterized in that, The method includes: Obtain the trademark area located in the first image; Obtain the human body pixels in the first image; Erasure all pixels except the human body pixels in the trademark area of ​​the first image to obtain the first image after trademark erasure; Before erasing pixels other than the human body pixels in the trademark area of ​​the first image, the method further includes: Based on the trademark area where the trademark is located in the first image, a trademark mask image corresponding to the first image is obtained; the size of the trademark mask image is equal to the size of the first image. Based on the human body pixels in the first image, obtain the human body mask image corresponding to the first image; the size of the human body mask image is equal to the size of the first image; The human body mask image and the trademark mask image are overlapped and merged to obtain a merged mask image including a first region; the first region is the area in the merged mask image that is composed of the trademark mask pixels corresponding to the pixels in the trademark region other than the human body pixels. The step of erasing pixels other than the human body pixels from the trademark area of ​​the first image includes: Based on the first region of the merged mask image and the first image, pixels other than the human body pixels are erased from the trademark region of the first image.

2. The method according to claim 1, characterized in that, The trademark mask image has a second region corresponding to the trademark region; the size of the second region is equal to the size of the trademark region, and the position of the second region in the trademark mask image corresponds to the position of the trademark region in the first image. The human body mask image has human body mask pixels corresponding to the human body pixels; The number of human body mask pixels is equal to the number of human body pixels, and the position of each human body mask pixel in the human body mask image corresponds to the position of each human body pixel in the first image.

3. The method according to claim 2, characterized in that, The step of overlapping and merging the human body mask image and the trademark mask image to obtain a merged mask image including a first region includes: The human body mask image and the trademark mask image are overlapped; In the trademark mask image, the trademark mask pixels corresponding to the human body mask pixels that are orthographically projected into the second region are removed from the second region to obtain a merged mask image including the first region.

4. The method according to claim 1, characterized in that, The step of erasing pixels other than the human body pixels in the trademark area of ​​the first image, based on the first region of the merged mask image and the first image, includes: The region in the first image corresponding to the first region is taken as the invalid region, and the remaining regions in the first image are taken as the valid regions. The valid regions are downsampled and upsampled sequentially to obtain a coarse-grained repair region image. By combining an attention mechanism, the coarse-grained repair region image is sequentially downsampled and upsampled to obtain the fine-grained repair region image corresponding to the invalid region in the first image; wherein, all upsampling and all downsampling are performed using gated convolution. The invalid region in the first image is replaced with the fine-grained repair region image to erase pixels in the trademark region of the first image, except for the human body pixels.

5. The method according to claim 1, characterized in that, The step of obtaining the trademark mask image corresponding to the first image based on the trademark area where the trademark is located in the first image includes: Generate a second image with the same size as the first image; the second image includes a third region corresponding to the trademark region; the size of the third region is the same as the size of the trademark region, and the position of the third region in the second image corresponds to the position of the trademark region in the first image; In the second image, the pixel values ​​of all pixels in the third region are set to a first preset pixel value, and the pixel values ​​of all pixels in the remaining regions of the second image other than the third region are set to a second preset pixel value to obtain the trademark mask image; the first preset pixel value and the second preset pixel value are different.

6. The method according to claim 1, characterized in that, The step of obtaining the human body mask image corresponding to the first image based on the human body pixels in the first image includes: A third image with the same size as the first image is generated; the third image has human body mask pixels corresponding to the human body pixels; the number of human body mask pixels is equal to the number of human body pixels, and the position of each human body mask pixel in the third image corresponds to the position of each human body pixel in the first image. In the third image, the pixel values ​​of all the human body mask pixels are set to a third preset pixel value, and the pixel values ​​of all other pixels in the third image except for the human body mask pixels are set to a fourth preset pixel value to obtain the human body mask image; the third preset pixel value and the fourth preset pixel value are different.

7. The method according to any one of claims 1 to 6, characterized in that, The step of obtaining the trademark area in the first image includes: Identify the preset trademark characters in the first image, and determine the area in the first image containing the preset trademark characters as the trademark area in the first image; And / or, By using a pre-defined trademark image library, the trademark in the first image is identified to obtain the trademark area where the trademark is located in the first image.

8. The method according to any one of claims 1 to 6, characterized in that, The step of obtaining human body pixels in the first image includes: Human body segmentation is performed on the first image to obtain human body pixels in the first image.

9. The method according to any one of claims 1 to 6, characterized in that, The first image is at least one frame from the first video; the method further includes: The second video is re-synthesized based on the individual first images after the trademark has been erased.

10. The method according to claim 9, characterized in that, The first video contains an advertisement; the trademark in the first image is at least a portion of the trademark in the advertisement.

11. A trademark erasing device, characterized in that, The device includes: The trademark acquisition module is used to acquire the trademark area where the trademark is located in the first image; The human body pixel acquisition module is used to acquire human body pixels in the first image; The erasure module is used to erase pixels in the trademark area of ​​the first image, except for the human body pixels, to obtain the first image after the trademark has been erased; The device further includes: a trademark mask image acquisition module, used to acquire a trademark mask image corresponding to the first image based on the trademark area where the trademark is located in the first image; the size of the trademark mask image is equal to the size of the first image; The human body mask image acquisition module is used to acquire a human body mask image corresponding to the first image based on the human body pixels in the first image; the size of the human body mask image is equal to the size of the first image; The merging module is used to overlap and merge the human body mask image and the trademark mask image to obtain a merged mask image including a first region; the first region is the area in the merged mask image that is composed of the trademark mask pixels corresponding to the pixels in the trademark region other than the human body pixels; The erasure module includes: The erase submodule is used to erase pixels other than the human body pixels in the trademark area of ​​the first image, based on the first region of the merged mask image and the first image.

12. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the steps of the method described in any one of claims 1-10.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-10.

Citation Information

Patent Citations

  • Seal removal method, computer equipment and readable storage medium

    CN111814716A