A method and system for removing grayscale video text - like watermarks that vary with the background

Through the two-way watermark detection and processing method and background filling technology, the problem that the existing technology cannot remove the text watermark of grayscale videos with the background changes is solved, real-time watermark removal and batch processing of grayscale imaging videos are realized, and clean data is provided for data marking and training.

CN114419006BActive Publication Date: 2025-05-30SICHUAN JIUZHOU AIR TRAFFIC CONTROL TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210073703.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-21
Publication Date
2025-05-30
Estimated Expiration
2042-01-21

AI Technical Summary

Technical Problem

The existing watermark removal technology cannot adapt to the removal of text-based watermarks of grayscale videos that change with background, cannot remove watermarks at specific locations in grayscale imaging videos in real time, and it is difficult to quickly batch process videos or images.

Method used

The two-way watermark detection and removal of grayscale videos are used. First, the pre-located watermark area is obtained through image preprocessing, and then the watermark area is accurately positioned using sobel edge detection and watermark grayscale value segmentation method to accurately locate the watermark area, generate a watermark template, and use the background area to fill the watermark area to remove the watermark.

Benefits of technology

The precise positioning and removal of text-type watermarks of grayscale videos with background changes is achieved, and the problem of watermark changes according to the changes in image light and darkness is overcome. It can obtain clean data after removing the watermark in batches, which is suitable for real-time watermark removal of grayscale imaging videos.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114419006B_ABST
    Figure CN114419006B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for removing grayscale video text - type watermarks that vary with the background, including obtaining a grayscale video to be processed, pre - processing the original image in the grayscale video to be processed to obtain a preliminarily located watermark area; according to the preliminarily located watermark area, using a two - path watermark detection and processing method to perform watermark detection and processing on the preliminarily located watermark area to obtain two intermediate results; performing an operation on the two intermediate results to generate a watermark template, obtaining a background area and a precisely located watermark area; using the background area to fill the precisely located watermark area to obtain an image after watermark removal. The present invention solves the problem of removing grayscale video text - type watermarks that vary with the background, removes watermarks at specific positions in real - time for videos with grayscale imaging, and overcomes the changes in watermarks due to the brightness and darkness changes of the image. The present invention can provide clean data for data marking and training in the field of artificial intelligence.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of watermark removal, and particularly relates to a method and system for removing text - type watermarks in grayscale videos that change with the background. Background Art

[0002] Grayscale imaging is often used in the field of video images. Various grayscale videos carry watermarks such as video annotations, dates, times, etc. These watermarks are collectively referred to as text - type watermarks herein. These watermarks have several main characteristics: First, the watermarks are variable, for example, the time changes; Second, the brightness and darkness of the watermarks are variable. For example, when the background is dark, the watermark is light; when the background is light, the watermark is dark; Third, the watermarks have long and thin lines, and the watermarks blend with the background; Fourth, the grayscale values of the watermarks themselves remain consistent.

[0003] In recent years, it has become increasingly common to use artificial intelligence algorithms to process videos and images, such as object detection, object classification, etc. Artificial intelligence algorithms, especially the supervised deep - learning algorithms that have become popular in recent years, work based on a large amount of data. First, a neural network is built, then the labeled training - set data is input into the network for training to obtain a trained model, and finally, the trained model is used for real - time work.

[0004] Data acquisition is very important but also not an easy task for deep learning, especially in some professional and niche fields where it is difficult to find relevant data resources on the Internet. Collecting and utilizing some existing videos and images, such as for model training, is a very wise and effective way. However, in many cases, the images or videos we obtain have watermarks, and these watermarks interfere with the annotation of the training set and subsequent training, reducing the efficiency of project promotion.

[0005] Existing watermark - removal technologies can be divided into two categories. One is the algorithm based on machine learning, and the other is the traditional algorithm. Most of the algorithms based on machine learning require the use of training data. Most of the existing traditional watermark - removal algorithms are based on static images, and they need to manually identify the watermarks or use more complex algorithms to detect the watermarks and then fill the watermark area with the area near the watermark. Template matching for detecting watermarks is for the case where the watermark style is fixed. When the watermark style is variable, the traditional template matching cannot be used to detect the watermark. There is also a more direct watermark - removal method, which directly covers the watermark part to add a new watermark or blurs the watermark part. This method is not helpful for the model training mentioned in the background art. The text - type watermarks mentioned in this article blend with the background, that is, the hollow part of the text is the background, and the watermark and the hollow background cannot be simply erased together, otherwise the image after watermark removal will look very abrupt.

[0006] Then, the above existing watermark removal technologies are not suitable for removing text watermarks in grayscale videos that change with the background, and cannot solve the problem of removing watermarks at specific positions in real-time for videos with grayscale imaging. Moreover, it is difficult to quickly batch process videos or images. Summary of the Invention

[0007] The technical problem to be solved by the present invention is that the existing watermark removal technologies are not suitable for removing text watermarks in grayscale videos that change with the background, and cannot solve the problem of removing watermarks at specific positions in real-time for videos with grayscale imaging. The object of the present invention is to provide a method and system for removing text watermarks in grayscale videos that change with the background, which can solve the problem of removing text watermarks in grayscale videos that change with the background, remove watermarks at specific positions in real-time for videos with grayscale imaging, and overcome the changes of watermarks according to the brightness and darkness changes of images. In addition, clean data without watermarks can be obtained in batches.

[0008] The present invention is achieved by the following technical solutions:

[0009] In the first aspect, the present invention provides a method for removing text watermarks in grayscale videos that change with the background, the method comprising:

[0010] Obtain a grayscale video to be processed, and preprocess the original image in the grayscale video to be processed to obtain a preliminarily located watermark area;

[0011] According to the preliminarily located watermark area, use a two-way watermark detection processing method to perform watermark detection processing (i.e., precise positioning) on the preliminarily located watermark area to obtain two intermediate results; perform an operation (find the intersection) on the two intermediate results to generate a watermark template, extract the pixel with the largest number of the same pixel values in the watermark template as the precisely located watermark area, and at the same time obtain the background area; wherein, the area outside the precisely located watermark area is the background area;

[0012] Use the background area to fill the precisely located watermark area to obtain an image after watermark removal.

[0013] The working principle is as follows: Existing traditional watermark removal techniques are not suitable for removing text - type watermarks in grayscale videos that change with the background, and cannot solve the problem of real - time removing watermarks at specific positions in grayscale - imaged videos. Most algorithms based on machine learning require the use of training data. Therefore, the present invention designs a method for removing text - type watermarks in grayscale videos that change with the background, which includes: First, obtaining the watermark image to be processed and pre - processing the watermark image to be processed to obtain a preliminarily located watermark area; the image pre - processing includes preliminary watermark area location and noise filtering; the main function of the preliminary watermark area location is to reduce the amount of calculation, and secondly, it can reduce the interference of the background on threshold segmentation; noise filtering is to reduce the interference on edge detection. Secondly, precisely locate the watermark within the preliminarily located watermark area to generate a watermark template; then, fill the watermark area according to the watermark template to remove the watermark; finally, perform image post - processing to improve the splitting feeling that appears at the boundary of the watermark area after watermark removal.

[0014] The process of the present invention is reasonable, solves the problem of removing text - type watermarks in grayscale videos that change with the background, can real - time remove watermarks at specific positions in grayscale - imaged videos, and overcomes the change of watermarks according to the brightness and darkness of the image; in addition, clean data without watermarks can be obtained in batches.

[0015] Further, the pre - processing of the watermark image to be processed includes preliminary watermark area location and noise filtering processing.

[0016] Further, the preliminary watermark area location is to preliminarily locate the watermark on the premise that the position of the watermark does not change. For watermarks at specific positions, only a rectangular frame needs to be drawn based on the center of the watermark. The long side of the rectangular frame should exceed the overall length of the watermark, and the short side is 3 times the width of the watermark, ensuring that the proportion of the background in the preliminary location is higher than that of the watermark, and at the same time, reducing the amount of calculation as much as possible.

[0017] Further, the two - path watermark detection processing method is used to perform watermark detection processing on the preliminarily located watermark area, specifically including:

[0018] The first - path watermark detection processing: For the preliminarily located watermark area, use the sobel edge detection method to perform edge detection in the horizontal and vertical directions respectively to obtain horizontal edges and vertical edges; and superimpose the horizontal edges and vertical edges to obtain a superimposed edge image; perform adaptive threshold segmentation on the superimposed edge image to obtain a first binary image; perform morphological dilation on the obtained first binary image to obtain a dilation result, and perform an operation on the dilation result and the intermediate result of the second path to obtain an intermediate result of the first path, that is, the first - path watermark template;

[0019] Second watermark detection processing: detect the watermark grayscale value of the initially located watermark area, use the watermark grayscale value as a threshold, perform threshold segmentation, and obtain a second binary image; and perform morphological expansion on the obtained second binary image to obtain a second intermediate result, that is, a second watermark template.

[0020] The above two-way watermark detection and processing method is based on the following design considerations: the first watermark detection and processing is to solve the watermark area based on the edge. This is because the watermark and the background are obviously different, and the edge of the watermark is easy to find. Therefore, the watermark area is first obtained based on the edge using the first watermark detection and processing. However, the background may interfere with the watermark in this process, so the second watermark detection and processing is combined next; the second watermark detection and processing is to find the watermark area based on the watermark grayscale value. This is based on the fact that the watermark grayscale value is consistent, but the individual grayscale values ​​of the background area will be mistaken for the watermark. In this way, the effect of using the second watermark detection and processing based on the watermark grayscale value alone is not so good. Therefore, the present invention considers combining the two detection methods of edge solution and watermark grayscale value solution to increase the confidence of watermark detection and make the detected watermark area more accurate.

[0021] Morphological dilation is added to both watermark detection methods. The reason for morphological dilation of the first edge image is that the watermark has a certain width. Dilation can fill the hollows between edge lines and include the missed edges as much as possible, following the principle of rather mistaking the background for the watermark than the watermark for the background. The reason for dilating the second segmentation result is also based on the principle of rather mistaking the background for the watermark than the watermark for the background, and treating the watermark as the background as little as possible.

[0022] Furthermore, the watermark area of ​​the first intermediate result is 1 or 255, and the background area is 0.

[0023] After the adaptive segmentation and morphological dilation of the first watermark detection process, the center point of the binary image is selected as the anchor point. A small rectangular frame is drawn by reducing the length and width of the watermark area initially located by 3 times. Similarly, a small rectangular frame of the same size is drawn at the same position on the binary image of the second intermediate result. The two small rectangular frames are intersected twice: the pixel values ​​of the small rectangular area of ​​the second intermediate result remain unchanged in the two intersections, and the pixel values ​​of the small rectangular area of ​​the first intermediate result remain unchanged in the first intersection, and the pixel values ​​are reversed in the second intersection. The number of pixels with pixel values ​​of 1 or 255 after the two intersections is counted, and it is checked whether the pixel values ​​of the small rectangular area of ​​the first binary image corresponding to the intersection with a larger number are reversed. If they are reversed, the pixel values ​​of the binary image after morphological dilation of the first intermediate result are reversed to obtain the first intermediate result. If they are not reversed, the binary image after morphological dilation of the first intermediate result is directly used as the first intermediate result.

[0024] After obtaining the grayscale value of the watermark in the second - path watermark detection process, threshold segmentation is performed using this grayscale value as the threshold. Calculate the average value of the grayscale values of the watermark area image with preliminary positioning, compare it with the watermark grayscale value, and select the corresponding parameters for threshold segmentation to ensure that the value of the watermark after segmentation is 1 or 255, and the value of the background is 0.

[0025] Furthermore, the detection of the watermark grayscale value is determined by means of a sliding window.

[0026] Furthermore, after removing the watermark by this method, it also includes image post - processing. The alpha - blending method is used to perform alpha - blending on the watermark area with preliminary positioning before watermark removal and the corresponding watermark area after watermark removal, and then superimpose it on the image of the background area. Among them, the corresponding watermark area after watermark removal is the area that is exactly the same as the watermark area with preliminary positioning before watermark removal.

[0027] Furthermore, the weight for blending by the alpha - blending method is a Gaussian coefficient.

[0028] In a second aspect, the present invention further provides a grayscale video text - type watermark removal system that changes with the background. This system supports the described grayscale video text - type watermark removal method that changes with the background; this system includes an acquisition unit, a pre - processing unit, a watermark detection unit, a watermark removal unit, and an image post - processing unit;

[0029] The acquisition unit is used to acquire the grayscale video to be processed;

[0030] The pre - processing unit is used to pre - process the original image in the grayscale video to be processed to obtain the watermark area with preliminary positioning;

[0031] The watermark detection unit is used to, according to the watermark area with preliminary positioning, perform watermark detection processing (i.e., precise positioning) on the watermark area with preliminary positioning by using a two - path watermark detection processing method to obtain two intermediate results; perform an operation (find the intersection) on the two intermediate results to generate a watermark template; extract the pixel with the largest number of identical pixel values in the watermark template as the watermark area with precise positioning, and at the same time obtain the background area; among them, the area outside the watermark area with precise positioning is the background area;

[0032] The watermark removal unit is used to fill the watermark area with precise positioning with the background area to obtain the image after watermark removal;

[0033] The image post - processing unit is used to perform alpha - blending on the watermark area with preliminary positioning before watermark removal and the corresponding watermark area after watermark removal by using the alpha - blending method, and then superimpose it on the image of the background area.

[0034] Further, the watermark detection unit includes a first - path watermark detection and processing sub - unit, a second - path watermark detection and processing sub - unit, and a calculation sub - unit;

[0035] The first - path watermark detection and processing sub - unit is used to perform edge detection on the preliminarily located watermark area in the horizontal and vertical directions respectively by using the sobel edge detection method to obtain a horizontal edge and a vertical edge; and superimpose the horizontal edge and the vertical edge to obtain a superimposed edge image; perform adaptive threshold segmentation on the superimposed edge image to obtain a first binary image; perform morphological dilation on the obtained first binary image to obtain a dilation result, and perform an operation on the dilation result and the second - path intermediate result to obtain a first - path intermediate result, that is, a first - path watermark template;

[0036] The second - path watermark detection and processing sub - unit is used to detect the watermark gray - scale value of the preliminarily located watermark area, use the watermark gray - scale value as a threshold to perform threshold segmentation to obtain a second binary image; and perform morphological dilation on the obtained second binary image to obtain a second - path intermediate result, that is, a second - path watermark template;

[0037] The calculation sub - unit is used to perform an operation (find the intersection) on the first - path intermediate result and the second - path intermediate result to generate a watermark template.

[0038] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0039] 1. The process of the present invention is reasonable, which solves the problem of removing text - type watermarks in gray - scale videos that change with the background, removes watermarks at specific positions in real - time for gray - scale imaging videos, and overcomes the change of watermarks according to the brightness and darkness of the image; in addition, clean data without watermarks can be obtained in batches.

[0040] 2. Gray - scale imaging is usually used in many fields, and artificial intelligence technology is used more and more frequently in these fields. Data collection and marking are crucial for artificial intelligence. The present invention can provide clean data for data marking and training. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The drawings described herein are used to provide a further understanding of the embodiments of the present invention, form a part of this application, and do not limit the embodiments of the present invention. In the drawings:

[0042] Figure 1 is a flowchart of a method for removing text - type watermarks in gray - scale videos that change with the background according to the present invention.

[0043] Figure 2 is a flowchart of two - path watermark detection in a method for removing text - type watermarks in gray - scale videos that change with the background according to the present invention.

[0044] Figure 3 This is a schematic diagram of a sliding window for detecting the grayscale value of the watermark of the present invention.

[0045] Figure 4 This is a schematic diagram of a fusion template for the alpha fusion method of the present invention.

[0046] Figure 5 This is a schematic diagram of the fusion template of the alpha fusion method of the present invention superimposed on an image.

[0047] Figure 6 This is a schematic diagram for counting the number of pixel values in the sliding window of the present invention.

[0048] Figure 7 This is a schematic diagram of the structure of a grayscale video text watermark removal system that changes with the background according to the present invention. Detailed implementation manners

[0049] To make the objectives, technical solutions, and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below in conjunction with embodiments and drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and do not limit the present invention.

[0050] Embodiment 1

[0051] As Figures 1 to 6 shown, a method for removing a grayscale video text watermark that changes with the background according to the present invention, as Figure 1 shown, the method includes:

[0052] Obtain a grayscale video to be processed, and preprocess the original image in the grayscale video to be processed to obtain a preliminarily located watermark area;

[0053] According to the preliminarily located watermark area, use a two-way watermark detection processing method to perform watermark detection processing (i.e., precise positioning) on the preliminarily located watermark area to obtain two intermediate results; perform an operation (find the intersection) on the two intermediate results to generate a watermark template; extract the pixels with the most identical pixel values in the watermark template as the precisely located watermark area, and at the same time obtain the background area; among them, the area outside the precisely located watermark area is the background area;

[0054] Use the background area to fill the precisely located watermark area to obtain an image after watermark removal.

[0055] Specifically, the preprocessing of the watermark image to be processed includes preliminary positioning of the watermark area and noise filtering processing; the main function of the preliminary positioning of the watermark area is to reduce the amount of calculation, and secondly, it can reduce the interference of the background on threshold segmentation. Noise filtering is to reduce the interference on edge detection.

[0056] Among them, the preliminary positioning of the watermark area is to preliminarily position the watermark. The prerequisite is that the watermark appears in a fixed area of the picture, such as the center, corners, etc.

[0057] Specifically, watermark detection is one of the cores of this method. As Figure 2 shown, the preliminarily positioned watermark area after input preprocessing is then subjected to watermark detection processing on the preliminarily positioned watermark area by using a two-way watermark detection processing method. The two-way watermark detection processing method is based on the following design considerations: The first-way watermark detection processing is to solve the watermark area according to the edge. This is because the difference between the watermark and the background is obvious, and the edge of the watermark is easy to find. Therefore, the watermark area is first obtained by the first-way watermark detection processing according to the edge. However, in this process, the background may have a certain interference on the watermark. Therefore, the second-way watermark detection processing is combined next; The second-way watermark detection processing is to find the watermark area according to the watermark gray value. This is based on the fact that the watermark gray value is constant, but individual gray values in the background area may be misidentified as the watermark. In this way, the effect of using the second-way watermark detection processing alone based on the watermark gray value is not so good. Therefore, the present invention considers combining two detection methods of edge solution and watermark gray value solution to increase the confidence of watermark detection and make the detected watermark area more accurate.

[0058] Specifically:

[0059] The first-way watermark detection processing: The sobel edge detection method is used to perform edge detection on the preliminarily positioned watermark area in the horizontal and vertical directions respectively to obtain the horizontal edge and the vertical edge; and the horizontal edge and the vertical edge are superimposed to obtain the superimposed edge image; the superimposed edge image is subjected to adaptive threshold segmentation to obtain the first binary image; the obtained first binary image is subjected to morphological dilation to obtain the dilation result, and the dilation result is operated with the second-way intermediate result to obtain the first-way intermediate result, that is, the first-way watermark template;

[0060] The second-way watermark detection processing: Detect the watermark gray value of the preliminarily positioned watermark area, and use the watermark gray value as the threshold to perform threshold segmentation to obtain the second binary image; and perform morphological dilation on the obtained second binary image to obtain the second-way intermediate result, that is, the second-way watermark template. Specific implementation: First, detect the watermark gray value, and set the center position of the preliminarily positioned watermark area as the anchor point, as Figure 3The center point of the dashed box shown. Set a small sliding window containing the watermark centered on the anchor point. The height of this sliding window should not be higher than the height of the watermark to ensure that the detected edges do not contain the edges of objects in the background to the greatest extent. Perform sobel edge detection on the sliding window area centered on the anchor point, detect horizontal and vertical edges and superimpose them. Then slide a sliding window one step to the left and right respectively with the width of the sliding window as the step, and obtain the edges using the same method to get 3 edge templates. Perform morphological closing operations on the 3 edge templates to stitch the small gaps and small breaks between the edges. Then respectively count the gray values of the original image covered by the edges, and count the number of pixels corresponding to a certain gray value as Figure 6 shown, and then sort the number num from largest to smallest. The three lists are represented as L1, L2, L3. The number of the most pixel values and the pixel value pairs of the corresponding lists are represented as (NumMax1, VMax1), (NumMax2, VMax 2), (NumMax3, VMax 3). NumMaxi represents the number of pixels with the most identical pixel values in the list Li, and the corresponding pixel value is VMax i. If at least two of VMax 1, VMax 2, and VMax 3 are the same, then this value is considered to be the pixel value of the watermark. If the number of identical values is less than two, that is, VMax 1, VMax 2, and VMax 3 are all different, then continue to slide the slider to the left and right, and count the number of each pixel value covered by the edge corresponding to the slider until the number of the same pixel values VMax i corresponding to NumMaxi in the generated list Li is greater than or equal to 3, then take the pixel value corresponding to the list with the largest number as the gray value of the edge. For example, now there are 5 lists, and the VMax corresponding to NumMax in 3 lists are the same, then the pixel value VMax is considered to be the pixel value of the watermark. If the number of lists with the same pixel value corresponding to the most pixels in the generated list is two or more, for example, there are 3 lists with the pixel value v1 corresponding to the most pixel number NumMax, and there are also 3 lists with the pixel value v2 corresponding to the most pixel number NumMax, then continue to slide the slider until there is a unique list with the largest number that meets the requirements. In practice, basically using three sliding windows can robustly determine the gray value of the watermark.

[0061] Among them, the watermark area of the intermediate result of the first path is 1 or 255, and the background area is 0.

[0062] On the basis of the above processing, perform an intersection operation on the intermediate results obtained from the two paths (the intermediate result of the first path, the intermediate result of the second path), and the intersection is the further reduced watermark contour, that is, the watermark template.

[0063] Since the watermark changes along with the background, there are obvious differences between the watermark and the background. Therefore, the first - stage watermark detection and processing can detect the edges of the watermark, and at the same time, it will also detect the edges of the objects in the background. Adaptive threshold segmentation can reduce the interference of the background edges because the edge gradient of the watermark is often larger than that of the background in many cases. The second - stage watermark detection and processing performs threshold segmentation, and its principle is to maximize the between - class variance. Here, it is divided into two categories: the watermark and the background. In the pre - processing stage, the watermark is initially located, and the background area is reduced to the surrounding of the watermark, which can largely avoid the situation that a large area of the background and the watermark belong to the same class, resulting in the failure of watermark segmentation. Taking the intersection of the results of the two paths can remove most of the interference of the background on the edge and the between - class variance, and at the same time increase the robustness of the obtained watermark.

[0064] Specifically, filling the accurately located watermark area with the background area, that is, removing the watermark; this is to dilate the watermark template after taking the intersection, and then use the inpaint function provided by opencv in combination with the dilated watermark template to remove the watermark. The principle is to fill the pixels of the background area into the watermark area. The idea of dilating the watermark template here is to minimize the situation of missing edges. Even if the background around the edge is mistakenly added to the edge, it can be compensated by the next - step background filling.

[0065] To further illustrate this embodiment, after the watermark is removed, the method further includes image post - processing. The alpha - blending method is used to perform alpha - blending on the initially located watermark area before watermark removal and the corresponding watermark area after watermark removal, and then superimpose it on the image of the background area. Among them, the corresponding watermark area after watermark removal is the area that is exactly the same as the initially located watermark area before watermark removal after watermark removal. This is because after removing the watermark from the watermark area, there may be side effects: some places in the background area may be misdetected as the watermark area, resulting in a sense of disconnection between this area and the background after filling. Image post - processing uses alpha - blending to perform alpha - blending on the initially located watermark area before watermark removal and the corresponding watermark area after watermark removal. The blending weight uses the Gaussian coefficient, and the alpha - blending template is as Figure 4 shown, and the schematic diagram of the alpha - blending template superimposed on the image is as Figure 5 shown.

[0066] The working principle is as follows: Existing traditional watermark removal techniques are not suitable for removing text - type watermarks in grayscale videos that change with the background, and cannot solve the problem of real - time removal of watermarks at specific positions in grayscale - imaged videos. Most algorithms based on machine learning require the use of training data. Therefore, the present invention designs a method for removing text - type watermarks in grayscale videos that change with the background, including: First, obtain the watermark image to be processed, and pre - process the watermark image to be processed to obtain a preliminarily located watermark area. Image pre - processing includes preliminary location of the watermark area and noise filtering. The main function of the preliminary location of the watermark area is to reduce the amount of calculation, and secondly, it can reduce the interference of the background on threshold segmentation. Noise filtering is to reduce the interference on edge detection. Secondly, accurately locate the watermark within the preliminarily located watermark area to generate a watermark template. Then, fill the watermark area according to the watermark template to remove the watermark. Finally, perform image post - processing to improve the splitting feeling that appears at the boundary of the watermark area after watermark removal.

[0067] The process of the present invention is reasonable, which solves the problem of removing text - type watermarks in grayscale videos that change with the background, can real - time remove watermarks at specific positions in grayscale - imaged videos, and overcomes the change of watermarks according to the brightness and darkness of the image. In addition, clean data without watermarks can be obtained in batches.

[0068] Grayscale imaging is usually used in many fields, and artificial intelligence technology is used more and more frequently in these fields. Data collection and marking are crucial for artificial intelligence. The present invention can provide clean data for data marking and training.

[0069] Embodiment 2

[0070] As Figure 7 shown, the difference between this embodiment and Embodiment 1 is that this embodiment provides a system for removing text - type watermarks in grayscale videos that change with the background. This system supports the method for removing text - type watermarks in grayscale videos that change with the background described in Embodiment 1. The system includes an acquisition unit, a pre - processing unit, a watermark detection unit, a watermark removal unit, and an image post - processing unit.

[0071] The acquisition unit is used to acquire the grayscale video to be processed.

[0072] The pre - processing unit is used to pre - process the original image in the grayscale video to be processed to obtain a preliminarily located watermark area.

[0073] The watermark detection unit is used to perform watermark detection processing (i.e., precise positioning) on the preliminarily located watermark area by using a two-way watermark detection processing method, and obtain two intermediate results; perform an operation (find the intersection) on the two intermediate results to generate a watermark template; extract the pixels with the largest number of identical pixel values in the watermark template as the precisely located watermark area, and at the same time obtain the background area; among them, the area outside the precisely located watermark area is the background area.

[0074] The watermark removal unit is used to fill the precisely located watermark area with the background area to obtain an image after watermark removal.

[0075] The image post-processing unit is used to perform alpha blending on the preliminarily located watermark area before watermark removal and the corresponding watermark area after watermark removal by using the alpha blending method, and superimpose it on the image of the background area.

[0076] In this embodiment, the watermark detection unit includes a first-way watermark detection processing sub-unit, a second-way watermark detection processing sub-unit, and a calculation sub-unit.

[0077] The first-way watermark detection processing sub-unit is used to perform edge detection on the preliminarily located watermark area in the horizontal and vertical directions respectively by using the sobel edge detection method to obtain a horizontal edge and a vertical edge; superimpose the horizontal edge and the vertical edge to obtain a superimposed edge image; perform adaptive threshold segmentation on the superimposed edge image to obtain a first binary image; perform morphological dilation on the obtained first binary image to obtain a dilation result, and perform an operation on the dilation result and the second intermediate result to obtain a first intermediate result, that is, a first-way watermark template.

[0078] The second-way watermark detection processing sub-unit is used to detect the watermark gray value of the preliminarily located watermark area, use the watermark gray value as a threshold, perform threshold segmentation to obtain a second binary image; and perform morphological dilation on the obtained second binary image to obtain a second intermediate result, that is, a second-way watermark template.

[0079] The calculation sub-unit is used to perform an operation (find the intersection) on the first intermediate result and the second intermediate result to generate a watermark template.

[0080] The execution processes of other units can be carried out according to the process steps of a method for removing gray video text class watermarks that changes with the background described in Embodiment 1, and will not be elaborated one by one in this embodiment.

[0081] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) that contain computer-usable program code.

[0082] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the embodiments of the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices produce means for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0083] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing devices to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufactured article including instruction means that implement the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0084] These computer program instructions can also be loaded onto a computer or other programmable data processing devices, such that a series of operation steps are executed on the computer or other programmable devices to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable devices provide steps for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.

[0085] The specific embodiments described above further elaborate on the purpose, technical solutions, and beneficial effects of the present invention. It should be understood that the above description is only the specific embodiments of the present invention and is not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for removing grayscale video text - type watermarks that vary with the background, characterized in that, the method includes: Obtain the grayscale video to be processed, preprocess the original image in the grayscale video to be processed, and obtain a preliminarily located watermark area; According to the preliminarily located watermark area, use a two - path watermark detection and processing method to perform watermark detection and processing on the preliminarily located watermark area to obtain two intermediate results; perform operations on the two intermediate results to generate a watermark template; extract the pixels with the largest number of the same pixel values in the watermark template as the accurately located watermark area, and at the same time obtain the background area; Use the background area to fill the accurately located watermark area to obtain an image after watermark removal; The use of the two - path watermark detection and processing method to perform watermark detection and processing on the preliminarily located watermark area specifically includes: The first - path watermark detection and processing: Use the sobel edge detection method to perform edge detection on the preliminarily located watermark area in the horizontal and vertical directions respectively to obtain horizontal edges and vertical edges; and superimpose the horizontal edges and vertical edges to obtain a superimposed edge image; perform adaptive threshold segmentation on the superimposed edge image to obtain a first binary image; perform morphological dilation on the obtained first binary image to obtain a dilation result, and perform an operation on the dilation result and the second - path intermediate result to obtain a first - path intermediate result; The second - path watermark detection and processing: Detect the watermark gray value of the preliminarily located watermark area, use the watermark gray value as a threshold to perform threshold segmentation to obtain a second binary image; and perform morphological dilation on the obtained second binary image to obtain a second - path intermediate result.

2. A method for removing grayscale video text - type watermarks that vary with the background according to claim 1, characterized in that, The preprocessing of the watermark image to be processed includes preliminary watermark area location and noise filtering processing.

3. A method for removing grayscale video text - type watermarks that vary with the background according to claim 2, characterized in that, The preliminary watermark area location is to preliminarily locate the watermark, and the types of preliminarily located watermarks include those at the corners of the image.

4. A method for removing grayscale video text - type watermarks that vary with the background according to claim 1, characterized in that, The watermark area of the first - path intermediate result is 1 or 255, and the background area is 0.

5. A method for removing grayscale video text - type watermarks that vary with the background according to claim 1, characterized in that, The detection of the watermark gray value is determined by using a sliding window method.

6. A method for removing grayscale video text - type watermarks that vary with the background according to claim 1, characterized in that, After the watermark is removed by this method, it also includes image post - processing. Use the alpha - fusion method to perform alpha - fusion on the preliminarily located watermark area before watermark removal and the corresponding watermark area after watermark removal, and superimpose it on the image of the background area.

7. A method for removing grayscale video text - type watermarks that vary with the background according to claim 6, characterized in that, The weight for fusion by the alpha - fusion method is a Gaussian coefficient.

8. A grayscale video text - type watermark removal system that varies with the background, characterized in that, the system supports a grayscale video text - type watermark removal method as described in any one of claims 1 to 7; the system includes an acquisition unit, a pre - processing unit, a watermark detection unit, a watermark removal unit, and an image post - processing unit; the acquisition unit is used to acquire the grayscale video to be processed; the pre - processing unit is used to pre - process the original image in the grayscale video to be processed to obtain a preliminarily located watermark area; the watermark detection unit is used to perform watermark detection processing on the preliminarily located watermark area by using a two - path watermark detection processing method to obtain two intermediate results; perform operations on the two intermediate results to generate a watermark template; extract the pixels with the largest number of the same pixel values in the watermark template as the accurately located watermark area, and at the same time obtain the background area; the watermark removal unit is used to fill the accurately located watermark area with the background area to obtain an image after watermark removal; the image post - processing unit is used to perform alpha fusion on the preliminarily located watermark area before watermark removal and the corresponding watermark area after watermark removal by using the alpha fusion method, and superimpose it on the image of the background area; the watermark detection unit includes a first - path watermark detection processing sub - unit, a second - path watermark detection processing sub - unit, and a calculation sub - unit; the first - path watermark detection processing sub - unit is used to perform edge detection on the preliminarily located watermark area in the horizontal and vertical directions respectively by using the sobel edge detection method to obtain a horizontal edge and a vertical edge; superimpose the horizontal edge and the vertical edge to obtain a superimposed edge image; perform adaptive threshold segmentation on the superimposed edge image to obtain a first binary image; perform morphological dilation on the obtained first binary image to obtain a dilation result, and perform operations on the dilation result and the second - path intermediate result to obtain a first - path intermediate result; the second - path watermark detection processing sub - unit is used to detect the watermark gray value of the preliminarily located watermark area, use the watermark gray value as a threshold to perform threshold segmentation to obtain a second binary image; and perform morphological dilation on the obtained second binary image to obtain a second - path intermediate result; the calculation sub - unit is used to perform operations on the first - path intermediate result and the second - path intermediate result to generate a watermark template.

Citation Information

Patent Citations

  • Method, device and equipment for removing watermark

    CN110163786A

  • Method and device for eliminating image watermark and electronic equipment

    CN111192190A