CN114419006A - Method and system for removing watermark of gray level video characters changing along with background - Google Patents

Method and system for removing watermark of gray level video characters changing along with background Download PDF

Info

Publication number
CN114419006A
CN114419006A CN202210073703.1A CN202210073703A CN114419006A CN 114419006 A CN114419006 A CN 114419006A CN 202210073703 A CN202210073703 A CN 202210073703A CN 114419006 A CN114419006 A CN 114419006A
Authority
CN
China
Prior art keywords
watermark
region
background
image
path
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210073703.1A
Other languages
Chinese (zh)
Inventor
黄凯
李君惠
姜山
何聪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Jiuzhou ATC Technology Co Ltd
Original Assignee
Sichuan Jiuzhou ATC Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Jiuzhou ATC Technology Co Ltd filed Critical Sichuan Jiuzhou ATC Technology Co Ltd
Priority to CN202210073703.1A priority Critical patent/CN114419006A/en
Publication of CN114419006A publication Critical patent/CN114419006A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/70Denoising; Smoothing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Quality & Reliability (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Image Processing (AREA)

Abstract

The invention discloses a method and a system for removing a watermark of a gray level video character class along with background change, which comprises the steps of obtaining a gray level video to be processed, preprocessing an original image in the gray level video to be processed to obtain a primarily positioned watermark area; according to the primarily positioned watermark region, performing watermark detection processing on the primarily positioned watermark region by adopting two watermark detection processing methods to obtain two intermediate results; calculating the two paths of intermediate results to generate a watermark template, and obtaining a background area and a precisely positioned watermark area; and filling the accurately positioned watermark region by using the background region to obtain the image with the watermark removed. The method solves the problem of removing the watermark of the gray level video text type which changes along with the background, removes the watermark at a specific position in real time aiming at the gray level imaging video, and overcomes the change of the watermark according to the light and shade change of the image. The invention can provide clean data for the data marking and training in the artificial intelligence field.

Description

Method and system for removing watermark of gray level video characters changing along with background
Technical Field
The invention relates to the technical field of watermark removal, in particular to a method and a system for removing a watermark of a gray video character type along with background change.
Background
Grayscale imaging is often used in video image applications, and various grayscale imaged videos carry video annotations, date, time, and other watermarks, which are collectively referred to herein as text-based watermarks. These watermarks have several main features: the first watermark is variable, such as time-varying; the brightness of the second watermark is changed, for example, the background is dark color, and the watermark is light color; the background is light color, and the watermark is dark color; the third watermark is provided with a slender line, and the watermark and the background are mutually blended; the grey value of the fourth watermark itself remains consistent.
It has become more common in recent years to process videos and images using artificial intelligence algorithms, such as object detection, object classification, etc. Artificial intelligence algorithms, especially the supervised deep learning algorithms that have prevailed in recent years, work on large amounts of data. Firstly, building a neural network, then inputting the marked training set data into the network for training to obtain a trained model, and finally using the trained model for real-time work.
Data acquisition is important for deep learning but is also an difficult thing, especially in some fields of profession and the small and popular, and related data resources are difficult to find in the internet. Collecting some of the existing video and images for use, such as for model training, is a very intelligent and efficient way. However, many times, images or videos obtained by people have watermarks, and the watermarks interfere with labeling of a training set and later training, so that the efficiency of project promotion is reduced.
Existing watermarking techniques can be divided into two broad categories, one is a machine learning based algorithm and the other is a traditional algorithm. Machine learning based algorithms mostly use training data. Most of the existing traditional watermark removing algorithms are based on static images, and need to manually remove identification watermarks, or use a more complex algorithm to detect watermarks and then fill watermark areas with areas near the watermarks. The template matching detection watermark aims at the condition that the watermark pattern is fixed and unchanged, and the watermark pattern cannot be detected by using the traditional template matching when being changed. And a watermarking removing method is more direct, and directly covers the watermark part to add a new watermark or carries out fuzzy processing on the watermark part, and the method does not help the model training mentioned in the background technology. The text watermark mentioned in the text is mutually blended with the background, that is to say, the hollow part of the text is the background, and the watermark cannot be simply erased together with the hollow background, so that the image after the watermark is removed looks very abrupt.
Then, the existing watermark removing technology is not suitable for removing the watermark of the gray level video character class changing along with the background, and the problem of removing the watermark at a specific position in real time aiming at the video of gray level imaging cannot be solved; and it is difficult to quickly batch process the video or image.
Disclosure of Invention
The invention aims to solve the technical problems that the existing watermark removing technology is not suitable for removing the watermark of gray level video characters changing along with the background, and cannot remove the watermark at a specific position in real time aiming at the video of gray level imaging. The invention aims to provide a method and a system for removing a watermark of a gray level video character class along with background change, which solve the problem of removing the watermark of the gray level video character class along with the background change, remove the watermark at a specific position in real time aiming at a gray level imaging video and overcome the change of the watermark according to the light and shade change of an image; in addition, clean data from which watermarks are removed can be obtained in bulk.
The invention is realized by the following technical scheme:
in a first aspect, the present invention provides a method for removing a watermark of a gray-scale video text type varying with a background, the method comprising:
acquiring a gray level video to be processed, and preprocessing an original image in the gray level video to be processed to obtain a primarily positioned watermark region;
according to the preliminarily positioned watermark region, carrying out watermark detection processing (namely, accurate positioning) on the preliminarily positioned watermark region by adopting two watermark detection processing methods to obtain two intermediate results; calculating (solving intersection) the two paths of intermediate results to generate a watermark template, extracting the pixels with the largest number of the same pixel values in the watermark template as accurately positioned watermark regions, and simultaneously obtaining background regions; wherein, the area outside the precisely positioned watermark area is the background area;
and filling the accurately positioned watermark region by using the background region to obtain the image with the watermark removed.
The working principle is as follows: the existing traditional watermark removing technology is not suitable for removing the watermark of gray level video characters changing along with the background, and cannot solve the problem of removing the watermark at a specific position in real time aiming at the video of gray level imaging; and most of the algorithms based on machine learning use training data. Therefore, the invention designs a method for removing the gray level video character watermark along with the change of the background, which comprises the steps of firstly, obtaining a watermark image to be processed, and preprocessing the watermark image to be processed to obtain a primarily positioned watermark area; image preprocessing comprises primary positioning of a watermark region and noise filtering; the primary positioning of the watermark region mainly has the advantages that the calculated amount is reduced, and then the interference of the background on threshold segmentation can be reduced; the noise filtering is to reduce interference with edge detection. Secondly, accurately positioning the watermark in the primarily positioned watermark area to generate a watermark template; then, filling the watermark area according to the watermark template, and removing the watermark; and finally, carrying out image post-processing to improve the fracture feeling at the boundary of the watermark region after removing the watermark.
The method has reasonable flow, solves the problem of removing the watermark of the gray level video character class along with the change of the background, removes the watermark at a specific position in real time aiming at the gray level imaging video, and overcomes the change of the watermark according to the light and shade change of the image; in addition, clean data from which watermarks are removed can be obtained in bulk.
Further, the preprocessing of the watermark image to be processed includes preliminary positioning of a watermark region and noise filtering processing.
Further, the preliminary positioning of the watermark region is to perform preliminary positioning on the watermark, provided that the position of the watermark is not changed. The watermark at a specific position only needs to draw a rectangular frame based on the center of the watermark, the long side of the rectangular frame exceeds the whole length of the watermark, and the short side is 3 times of the width of the watermark, so that the occupation ratio of a background in initial positioning is higher than that of the watermark, and meanwhile, the calculation amount is reduced as much as possible.
Further, the performing watermark detection processing on the preliminarily positioned watermark region by using two watermark detection processing methods specifically includes:
the first path of watermark detection processing: respectively carrying out edge detection on the preliminarily positioned watermark region in the horizontal direction and the vertical direction by adopting a sobel edge detection method to obtain a horizontal edge and a vertical edge; overlapping the horizontal edge and the vertical edge to obtain an overlapped edge image; performing self-adaptive threshold segmentation on the overlapped edge image to obtain a first binary image; performing morphological expansion on the obtained first binary image to obtain an expansion result, and performing operation on the expansion result and the second path of intermediate result to obtain a first path of intermediate result, namely a first path of watermark template;
and (3) second-path watermark detection processing: detecting the watermark gray value of the preliminarily positioned watermark region, and performing threshold segmentation by taking the watermark gray value as a threshold to obtain a second binary image; and performing morphological expansion on the obtained second binary image to obtain a second path of intermediate result, namely a second path of watermark template.
The above two watermark detection processing methods are based on the following design considerations: the first path of watermark detection processing is to solve a watermark area according to the edge, which considers that the difference between the watermark and the background is obvious, and the edge of the watermark is easy to find, so the first path of watermark detection processing is used for obtaining the watermark area according to the edge, but the background may have certain interference on the watermark in the process, so the second path of watermark detection processing is combined; the second way of watermark detection processing is to find the watermark area according to the watermark gray value, which is always based on the watermark gray value, but the individual gray value of the background area can be mistaken for the watermark, so that the effect of the second way of watermark detection processing based on the watermark gray value alone is not good. Therefore, the invention considers combining two detection modes of edge solution and watermark gray value solution to increase the confidence coefficient of the detected watermark and ensure that the detected watermark area is more accurate.
The two watermark detection methods are added with morphological expansion, wherein the reason for performing morphological expansion on the first path of edge image is that the watermark has a certain width, the expansion can fill the hollow-out between the edge lines, and the missed edge can be included as much as possible, so that the principle that the watermark can not be mistaken as the background by mistakenly using the background as the watermark is followed. The reason for expanding the segmentation result of the second path also follows the principle that the watermark can not be mistaken as the background rather than the background, and the watermark is mistaken as the background as little as possible.
Further, the watermark area of the first path intermediate result is 1 or 255, and the background area is 0.
After the first channel of watermark detection processing is carried out self-adaptive segmentation and morphological expansion, the central point of the binary image is selected as an anchor point, the length and the width of a primarily positioned watermark area are reduced by 3 times in an equal proportion, and a small rectangular frame with the same size is drawn at the same position on the binary image of the middle result of the second channel. Two intersections are made for the two small rectangular boxes: and in the two intersection processes, the pixel value of the small rectangular area of the intermediate result of the second path is kept unchanged, the pixel value of the small rectangular area of the first path is kept unchanged during the first intersection process, and the pixel value is inverted during the second intersection process. Counting the number of pixels with the pixel value of 1 or 255 after the two intersections, checking whether the pixel values of the small rectangular area of the first path of binary image corresponding to the intersection with the large number are inverted or not, if so, inverting the pixel values of the first path of binary image after morphological expansion to obtain an intermediate result of the first path, and if not, directly taking the first path of binary image after morphological expansion as the intermediate result of the first path.
And after the second way of watermark detection processing obtains the gray value of the watermark, threshold segmentation is carried out by taking the gray value as a threshold. And calculating the average value of the gray values of the primarily positioned watermark region images, comparing the average value with the watermark gray values, and selecting the corresponding threshold segmentation parameters to ensure that the segmented watermark value is 1 or 255 and the background value is 0.
Further, the detection of the watermark gray value is determined by adopting a sliding window mode.
Further, after the watermark is removed, the method also comprises image post-processing, and the primarily positioned watermark region before the watermark is removed and the corresponding watermark region after the watermark is removed are subjected to alpha fusion by adopting an alpha fusion method and are superposed on the image of the background region. The corresponding watermark area after the watermark is removed is the area which is completely consistent with the initially positioned watermark area before the watermark is removed.
Furthermore, the weight for fusion by the alpha fusion method adopts a Gaussian coefficient.
In a second aspect, the invention further provides a system for removing the watermark of the gray-scale video text type changing along with the background, which supports the method for removing the watermark of the gray-scale video text type changing along with the background; the system comprises an acquisition unit, a preprocessing unit, a watermark detection unit, a watermark removal unit and an image post-processing unit;
the acquisition unit is used for acquiring a gray level video to be processed;
the preprocessing unit is used for preprocessing an original image in the gray-scale video to be processed to obtain a primarily positioned watermark region;
the watermark detection unit is used for carrying out watermark detection processing (namely, accurate positioning) on the primarily positioned watermark region by adopting two watermark detection processing methods according to the primarily positioned watermark region to obtain two paths of intermediate results; calculating (solving intersection) the two paths of intermediate results to generate a watermark template; extracting the pixels with the largest number of the same pixel values in the watermark template as accurately positioned watermark areas, and simultaneously obtaining background areas; wherein, the area outside the precisely positioned watermark area is the background area;
the watermark removing unit is used for filling the accurately positioned watermark region by using the background region to obtain an image with the watermark removed;
and the image post-processing unit is used for performing alpha fusion on the preliminarily positioned watermark region before the watermark is removed and the corresponding watermark region after the watermark is removed by adopting an alpha fusion method, and superposing the preliminarily positioned watermark region and the corresponding watermark region on the image of the background region.
Furthermore, the watermark detection unit comprises a first path of watermark detection processing subunit, a second path of watermark detection processing subunit and a calculation subunit;
the first path of watermark detection processing subunit is configured to perform edge detection on the preliminarily positioned watermark region in the horizontal and vertical directions by using a sobel edge detection method, so as to obtain a horizontal edge and a vertical edge; overlapping the horizontal edge and the vertical edge to obtain an overlapped edge image; performing self-adaptive threshold segmentation on the overlapped edge image to obtain a first binary image; performing morphological expansion on the obtained first binary image to obtain an expansion result, and performing operation on the expansion result and the second path of intermediate result to obtain a first path of intermediate result, namely a first path of watermark template;
the second path of watermark detection processing subunit is configured to detect a watermark gray value of the primarily positioned watermark region, and perform threshold segmentation with the watermark gray value as a threshold to obtain a second binary image; performing morphological expansion on the obtained second binary image to obtain a second path of intermediate result, namely a second path of watermark template;
and the calculating subunit is configured to perform an operation (find an intersection) on the first path intermediate result and the second path intermediate result, and generate a watermark template.
Compared with the prior art, the invention has the following advantages and beneficial effects:
1. the method has reasonable flow, solves the problem of removing the watermark of the gray level video character class along with the change of the background, removes the watermark at a specific position in real time aiming at the gray level imaging video, and overcomes the change of the watermark according to the light and shade change of the image; in addition, clean data from which watermarks are removed can be obtained in bulk.
2. Gray scale imaging is commonly used in many fields, artificial intelligence technology is used more and more frequently in the fields, data collection and marking are important to artificial intelligence, and the invention can provide clean data for data marking and training.
Drawings
The accompanying drawings, which are included to provide a further understanding of the embodiments of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the principles of the invention. In the drawings:
fig. 1 is a flowchart of a method for removing watermarks in gray video texts varying with background according to the present invention.
Fig. 2 is a flow chart of two watermark detection processes in the method for removing the watermark of the gray video characters varying with the background according to the invention.
Fig. 3 is a schematic diagram of a sliding window for watermark gray scale value detection according to the present invention.
FIG. 4 is a schematic diagram of the fusion template by alpha fusion method according to the present invention.
FIG. 5 is a schematic diagram of the alpha fusion template superimposed on an image according to the present invention.
FIG. 6 is a diagram illustrating the statistics of the number of sliding window pixel values according to the present invention.
Fig. 7 is a schematic structural diagram of a system for removing a watermark in gray-scale video text varying with a background according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to examples and accompanying drawings, and the exemplary embodiments and descriptions thereof are only used for explaining the present invention and are not meant to limit the present invention.
Example 1
As shown in fig. 1 to 6, a method for removing a watermark in a gray scale video text type varying with a background according to the present invention is shown in fig. 1, and the method includes:
acquiring a gray level video to be processed, and preprocessing an original image in the gray level video to be processed to obtain a primarily positioned watermark region;
according to the preliminarily positioned watermark region, carrying out watermark detection processing (namely, accurate positioning) on the preliminarily positioned watermark region by adopting two watermark detection processing methods to obtain two intermediate results; calculating (solving intersection) the two paths of intermediate results to generate a watermark template; extracting the pixels with the largest number of the same pixel values in the watermark template as accurately positioned watermark areas, and simultaneously obtaining background areas; wherein, the area outside the precisely positioned watermark area is the background area;
and filling the accurately positioned watermark region by using the background region to obtain the image with the watermark removed.
Specifically, the preprocessing of the watermark image to be processed includes primary positioning of a watermark region and noise filtering processing; the primary positioning of the watermark region mainly aims to reduce the calculation amount, and can reduce the interference of the background on threshold segmentation. The noise filtering is to reduce interference with edge detection.
The initial positioning of the watermark region is to initially position the watermark if the watermark appears in a fixed region of the picture, such as the center, the corners, and the like.
In particular, watermark detection is one of the cores of the method. As shown in fig. 2, the preprocessed primarily located watermark regions are input, and then two watermark detection methods are used to perform watermark detection processing on the primarily located watermark regions. The two-way watermark detection processing method is based on the following design consideration: the first path of watermark detection processing is to solve a watermark area according to the edge, which considers that the difference between the watermark and the background is obvious, and the edge of the watermark is easy to find, so the first path of watermark detection processing is used for obtaining the watermark area according to the edge, but the background may have certain interference on the watermark in the process, so the second path of watermark detection processing is combined; the second way of watermark detection processing is to find the watermark area according to the watermark gray value, which is always based on the watermark gray value, but the individual gray value of the background area can be mistaken for the watermark, so that the effect of the second way of watermark detection processing based on the watermark gray value alone is not good. Therefore, the invention considers combining two detection modes of edge solution and watermark gray value solution to increase the confidence coefficient of the detected watermark and ensure that the detected watermark area is more accurate.
Specifically, the method comprises the following steps:
the first path of watermark detection processing: respectively carrying out edge detection on the preliminarily positioned watermark region in the horizontal direction and the vertical direction by adopting a sobel edge detection method to obtain a horizontal edge and a vertical edge; overlapping the horizontal edge and the vertical edge to obtain an overlapped edge image; performing self-adaptive threshold segmentation on the overlapped edge image to obtain a first binary image; performing morphological expansion on the obtained first binary image to obtain an expansion result, and performing operation on the expansion result and the second path of intermediate result to obtain a first path of intermediate result, namely a first path of watermark template;
and (3) second-path watermark detection processing: detecting the watermark gray value of the preliminarily positioned watermark region, and performing threshold segmentation by taking the watermark gray value as a threshold to obtain a second binary image; and performing morphological expansion on the obtained second binary image to obtain a second path of intermediate result, namely a second path of watermark template. The method comprises the following specific implementation steps: firstly, the watermark gray value is detected, and the central position of the primarily positioned watermark region is set as an anchor point, such as the central point of the dashed frame shown in fig. 3. A small sliding window containing the watermark is arranged by taking the anchor point as the center, and the height of the sliding window is not higher than that of the watermark so as to ensure that the detected edge does not contain the object edge in the background to the maximum extent. And performing sobel edge detection on a sliding window area with the anchor point as the center, detecting horizontal and vertical edges, superposing, sliding a sliding window leftwards and rightwards respectively by the step length of the width of the sliding window, and solving the edge by using the same method to obtain 3 edge templates. Performing morphological closing operation on the 3 edge templates, sewing small gaps and small fractures between the edges, then respectively counting gray values of the original image under the edge coverage, counting the number of pixels corresponding to a certain gray value as shown in fig. 6, and then sorting the number num from large to small. The three lists are denoted as L1, L2, L3. The number of the maximum pixel values and the pixel value pairs of the corresponding list are represented as (NumMax1, VMax1), (NumMax2, VMax 2), (NumMax3, VMax 3), NumMaxi represents the number of pixels having the most identical pixel values in the list Li, and the corresponding pixel value is VMax i. If two or more digits of VMax1, VMax 2, and VMax 3 are the same, the value is considered to be the pixel value of the watermark. If the same value is less than two, namely VMax1, VMax 2 and VMax 3 are all different, the slider is continuously slid leftwards and rightwards, the number of the pixel values covered by the edge corresponding to the slider is counted until the number of the pixel values VMax i corresponding to NumMaxi in the generated list Li is more than or equal to 3, and the same pixel value corresponding to the list with the largest number is taken as the gray value of the edge. For example, there are 5 lists, and VMax corresponding to NumMax in 3 lists are all the same, and the pixel value VMax is considered as the pixel value of the watermark. If two or more lists with the same pixel value corresponding to the maximum number of pixels in the generated list are the same, for example, 3 lists with the pixel value v1 corresponding to the maximum number NumMax of pixels and 3 lists with the pixel value v2 corresponding to the maximum number NumMax of pixels, the slider continues to slide until the only maximum number of lists meeting the requirement appears. In practice, three sliding windows are basically used to robustly determine the watermark gray value.
The watermark area of the first path of intermediate result is 1 or 255, and the background area is 0.
On the basis of the above processing, the two paths of intermediate results (the first path of intermediate result and the second path of intermediate result) are subjected to intersection calculation, and the intersection is a further reduced watermark outline, namely a watermark template.
Because the watermark changes along with the background, the watermark is obviously different from the background, so the edge of the watermark can be detected by the first watermark detection processing, and the object edge of the background can also be detected. Interference at the background edge can be reduced by adaptive threshold segmentation because the edge gradient of the watermark is often larger than the background. The second way of watermark detection processing carries out threshold segmentation, and the principle is that the inter-class variance is maximized, and the two categories are divided into watermarks and backgrounds. The watermark is preliminarily positioned in the preprocessing stage, the background area is reduced to the periphery of the watermark, and the problem that the watermark segmentation fails due to the fact that a large-area background and the watermark belong to the same class can be avoided to a great extent. And solving the intersection of the two paths of results, so that the interference of most backgrounds on the edge and the variance between the two paths of results can be eliminated, and the robustness of the obtained watermark is improved.
Specifically, the precisely located watermark region is filled by using the background region, that is, the watermark is removed; the expanded watermark template is expanded, and then an inpaint function carried by opencv is combined with the expanded watermark template to perform watermark removal. The idea of expanding the watermark template here is to reduce the missing of the edge as much as possible, and even if the background around the edge is mistakenly added to the edge, the background can be compensated by the next background filling.
To further explain the embodiment, after removing the watermark, the method further includes image post-processing, and alpha fusion is performed on the preliminarily positioned watermark region before removing the watermark and the corresponding watermark region after removing the watermark by using an alpha fusion method, and the preliminarily positioned watermark region and the corresponding watermark region are superimposed on the image of the background region. The corresponding watermark area after the watermark is removed is the area which is completely consistent with the initially positioned watermark area before the watermark is removed. This is to take into account that watermark removal of the watermark region may result in side effects: there may be places of the background area that are misdetected as watermark areas, which may result in the area appearing to split from the background after filling. The image post-processing uses alpha fusion, the watermark region which is preliminarily positioned before the watermark is removed and the corresponding watermark region after the watermark is removed are subjected to alpha fusion, the fusion weight adopts a Gaussian coefficient, an alpha fusion template is shown in figure 4, and a schematic diagram of the alpha fusion template superposed on the image is shown in figure 5.
The working principle is as follows: the existing traditional watermark removing technology is not suitable for removing the watermark of gray level video characters changing along with the background, and cannot solve the problem of removing the watermark at a specific position in real time aiming at the video of gray level imaging; and most of the algorithms based on machine learning use training data. Therefore, the invention designs a method for removing the gray level video character watermark along with the change of the background, which comprises the steps of firstly, obtaining a watermark image to be processed, and preprocessing the watermark image to be processed to obtain a primarily positioned watermark area; image preprocessing comprises primary positioning of a watermark region and noise filtering; the primary positioning of the watermark region mainly has the advantages that the calculated amount is reduced, and then the interference of the background on threshold segmentation can be reduced; the noise filtering is to reduce interference with edge detection. Secondly, accurately positioning the watermark in the primarily positioned watermark area to generate a watermark template; then, filling the watermark area according to the watermark template, and removing the watermark; and finally, carrying out image post-processing to improve the fracture feeling at the boundary of the watermark region after removing the watermark.
The method has reasonable flow, solves the problem of removing the watermark of the gray level video character class along with the change of the background, removes the watermark at a specific position in real time aiming at the gray level imaging video, and overcomes the change of the watermark according to the light and shade change of the image; in addition, clean data from which watermarks are removed can be obtained in bulk.
Gray scale imaging is commonly used in many fields, artificial intelligence technology is used more and more frequently in the fields, data collection and marking are important to artificial intelligence, and the invention can provide clean data for data marking and training.
Example 2
As shown in fig. 7, the present embodiment is different from embodiment 1 in that the present embodiment provides a system for removing a watermark of a gray-scale video text class varying with a background, and the system supports the method for removing a watermark of a gray-scale video text class varying with a background described in embodiment 1; the system comprises an acquisition unit, a preprocessing unit, a watermark detection unit, a watermark removal unit and an image post-processing unit;
the acquisition unit is used for acquiring a gray level video to be processed;
the preprocessing unit is used for preprocessing an original image in the gray-scale video to be processed to obtain a primarily positioned watermark region;
the watermark detection unit is used for carrying out watermark detection processing (namely, accurate positioning) on the primarily positioned watermark region by adopting two watermark detection processing methods according to the primarily positioned watermark region to obtain two paths of intermediate results; calculating (solving intersection) the two paths of intermediate results to generate a watermark template; extracting the pixels with the largest number of the same pixel values in the watermark template as accurately positioned watermark areas, and simultaneously obtaining background areas; wherein, the area outside the precisely positioned watermark area is the background area;
the watermark removing unit is used for filling the accurately positioned watermark region by using the background region to obtain an image with the watermark removed;
and the image post-processing unit is used for performing alpha fusion on the preliminarily positioned watermark region before the watermark is removed and the corresponding watermark region after the watermark is removed by adopting an alpha fusion method, and superposing the preliminarily positioned watermark region and the corresponding watermark region on the image of the background region.
In this embodiment, the watermark detection unit includes a first path of watermark detection processing subunit, a second path of watermark detection processing subunit, and a calculation subunit;
the first path of watermark detection processing subunit is configured to perform edge detection on the preliminarily positioned watermark region in the horizontal and vertical directions by using a sobel edge detection method, so as to obtain a horizontal edge and a vertical edge; overlapping the horizontal edge and the vertical edge to obtain an overlapped edge image; performing self-adaptive threshold segmentation on the overlapped edge image to obtain a first binary image; performing morphological expansion on the obtained first binary image to obtain an expansion result, and performing operation on the expansion result and the second path of intermediate result to obtain a first path of intermediate result, namely a first path of watermark template;
the second path of watermark detection processing subunit is configured to detect a watermark gray value of the primarily positioned watermark region, and perform threshold segmentation with the watermark gray value as a threshold to obtain a second binary image; performing morphological expansion on the obtained second binary image to obtain a second path of intermediate result, namely a second path of watermark template;
and the calculating subunit is configured to perform an operation (find an intersection) on the first path intermediate result and the second path intermediate result, and generate a watermark template.
The execution processes of other units are executed according to the flow steps of the method for removing the watermark of the gray-scale video text class changing along with the background in embodiment 1, and are not described in detail in this embodiment.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method for removing a watermark of a gray level video character class changing with a background is characterized by comprising the following steps:
acquiring a gray level video to be processed, and preprocessing an original image in the gray level video to be processed to obtain a primarily positioned watermark region;
according to the primarily positioned watermark region, performing watermark detection processing on the primarily positioned watermark region by adopting two watermark detection processing methods to obtain two intermediate results; calculating the two paths of intermediate results to generate a watermark template; extracting the pixels with the largest number of the same pixel values in the watermark template as accurately positioned watermark areas, and simultaneously obtaining background areas;
and filling the accurately positioned watermark region by using the background region to obtain the image with the watermark removed.
2. The method for removing a grayscale video text watermark according to claim 1, wherein the preprocessing of the watermark image to be processed includes preliminary positioning of watermark region and noise filtering.
3. The method as claimed in claim 2, wherein the preliminary positioning of the watermark region is to perform preliminary positioning of the watermark, and the type of the watermark that is preliminarily positioned is included in the type of the corner of the image.
4. The method for removing a grayscale video text watermark according to the background of claim 1, wherein the watermark detection processing is performed on the preliminarily located watermark region by using two watermark detection processing methods, specifically comprising:
the first path of watermark detection processing: respectively carrying out edge detection on the preliminarily positioned watermark region in the horizontal direction and the vertical direction by adopting a sobel edge detection method to obtain a horizontal edge and a vertical edge; overlapping the horizontal edge and the vertical edge to obtain an overlapped edge image; performing self-adaptive threshold segmentation on the overlapped edge image to obtain a first binary image; performing morphological expansion on the obtained first binary image to obtain an expansion result, and performing operation on the expansion result and the second path of intermediate result to obtain a first path of intermediate result;
and (3) second-path watermark detection processing: detecting the watermark gray value of the preliminarily positioned watermark region, and performing threshold segmentation by taking the watermark gray value as a threshold to obtain a second binary image; and performing morphological expansion on the obtained second binary image to obtain a second path of intermediate result.
5. The method as claimed in claim 4, wherein the watermark area of the first intermediate result is 1 or 255, and the background area is 0.
6. The method of claim 4, wherein the detection of the watermark gray level value is determined by a sliding window method.
7. The method for removing a watermark of a gray level video character class varying with a background as claimed in claim 1, wherein the method further comprises an image post-processing after the watermark removal, and alpha fusion is performed on the watermark region preliminarily positioned before the watermark removal and the corresponding watermark region after the watermark removal by using an alpha fusion method, and the alpha fusion is superimposed on the image of the background region.
8. The method for removing a watermark in a gray-scale video text varying with a background as claimed in claim 7, wherein the weight for the fusion by the alpha fusion method is Gaussian coefficient.
9. A background-varying grayscale video text watermark removal system, wherein the system supports a background-varying grayscale video text watermark removal method according to any one of claims 1 to 8; the system comprises an acquisition unit, a preprocessing unit, a watermark detection unit, a watermark removal unit and an image post-processing unit;
the acquisition unit is used for acquiring a gray level video to be processed;
the preprocessing unit is used for preprocessing an original image in the gray-scale video to be processed to obtain a primarily positioned watermark region;
the watermark detection unit is used for carrying out watermark detection processing on the preliminarily positioned watermark region by adopting two watermark detection processing methods according to the preliminarily positioned watermark region to obtain two paths of intermediate results; calculating the two paths of intermediate results to generate a watermark template; extracting the pixels with the largest number of the same pixel values in the watermark template as accurately positioned watermark areas, and simultaneously obtaining background areas;
the watermark removing unit is used for filling the accurately positioned watermark region by using the background region to obtain an image with the watermark removed;
and the image post-processing unit is used for performing alpha fusion on the preliminarily positioned watermark region before the watermark is removed and the corresponding watermark region after the watermark is removed by adopting an alpha fusion method, and superposing the preliminarily positioned watermark region and the corresponding watermark region on the image of the background region.
10. The system for removing a grayscale video text watermark according to the background of claim 9, wherein the watermark detection unit comprises a first path of watermark detection processing subunit, a second path of watermark detection processing subunit and a calculation subunit;
the first path of watermark detection processing subunit is configured to perform edge detection on the preliminarily positioned watermark region in the horizontal and vertical directions by using a sobel edge detection method, so as to obtain a horizontal edge and a vertical edge; overlapping the horizontal edge and the vertical edge to obtain an overlapped edge image; performing self-adaptive threshold segmentation on the overlapped edge image to obtain a first binary image; performing morphological expansion on the obtained first binary image to obtain an expansion result, and performing operation on the expansion result and the second path of intermediate result to obtain a first path of intermediate result;
the second path of watermark detection processing subunit is configured to detect a watermark gray value of the primarily positioned watermark region, and perform threshold segmentation with the watermark gray value as a threshold to obtain a second binary image; performing morphological expansion on the obtained second binary image to obtain a second path of intermediate result;
and the computing subunit is configured to perform an operation on the first path of intermediate result and the second path of intermediate result to generate a watermark template.
CN202210073703.1A 2022-01-21 2022-01-21 Method and system for removing watermark of gray level video characters changing along with background Pending CN114419006A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210073703.1A CN114419006A (en) 2022-01-21 2022-01-21 Method and system for removing watermark of gray level video characters changing along with background

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210073703.1A CN114419006A (en) 2022-01-21 2022-01-21 Method and system for removing watermark of gray level video characters changing along with background

Publications (1)

Publication Number Publication Date
CN114419006A true CN114419006A (en) 2022-04-29

Family

ID=81276194

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210073703.1A Pending CN114419006A (en) 2022-01-21 2022-01-21 Method and system for removing watermark of gray level video characters changing along with background

Country Status (1)

Country Link
CN (1) CN114419006A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115049837A (en) * 2022-08-11 2022-09-13 合肥高维数据技术有限公司 Characteristic diagram interference removing method and screen shot watermark identification method comprising same
CN115049840A (en) * 2022-08-11 2022-09-13 合肥高维数据技术有限公司 Screen shot watermark identification method, storage medium and electronic equipment

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115049837A (en) * 2022-08-11 2022-09-13 合肥高维数据技术有限公司 Characteristic diagram interference removing method and screen shot watermark identification method comprising same
CN115049840A (en) * 2022-08-11 2022-09-13 合肥高维数据技术有限公司 Screen shot watermark identification method, storage medium and electronic equipment
CN115049840B (en) * 2022-08-11 2022-11-08 合肥高维数据技术有限公司 Screen-shot watermark identification method, storage medium and electronic device
CN115049837B (en) * 2022-08-11 2022-11-18 合肥高维数据技术有限公司 Characteristic diagram interference removing method and screen shot watermark identification method comprising same

Similar Documents

Publication Publication Date Title
CN110598609B (en) Weak supervision target detection method based on significance guidance
CN101453575B (en) Video subtitle information extracting method
CN111814575B (en) Household pattern recognition method based on deep learning and image processing
WO2018103608A1 (en) Text detection method, device and storage medium
CN110717896B (en) Plate strip steel surface defect detection method based on significance tag information propagation model
CN107273896A (en) A kind of car plate detection recognition methods based on image recognition
CN107871125A (en) Architecture against regulations recognition methods, device and electronic equipment
CN107784301A (en) Method and apparatus for identifying character area in image
CN114419006A (en) Method and system for removing watermark of gray level video characters changing along with background
CN104751097A (en) Vehicle identification code detection processing method and device
CN111368682B (en) Method and system for detecting and identifying station caption based on master RCNN
CN110598566A (en) Image processing method, device, terminal and computer readable storage medium
CN113705673B (en) Text detection method, text detection device, text detection equipment and storage medium
CN110599453A (en) Panel defect detection method and device based on image fusion and equipment terminal
CN103455816B (en) Stroke width extraction method and device and character recognition method and system
CN113191358A (en) Metal part surface text detection method and system
Han et al. An enhanced image binarization method incorporating with Monte-Carlo simulation
Gooda et al. Automatic detection of road cracks using EfficientNet with residual U-net-based segmentation and YOLOv5-based detection
CN110276759A (en) A kind of bad line defect diagnostic method of Mobile phone screen based on machine vision
CN107481257A (en) The image background minimizing technology of Fusion of Color and local ternary parallel pattern feature
CN112749696A (en) Text detection method and device
CN109448010B (en) Automatic four-side continuous pattern generation method based on content features
CN108717699B (en) Ultrasonic image segmentation method based on continuous minimum segmentation
Zhang et al. Text extraction from images captured via mobile and digital devices
CN116206155A (en) Waste steel classification and identification method based on YOLOv5 network

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination