CN113691885B - Video watermark removal method and device, computer equipment and storage medium - Google Patents
Video watermark removal method and device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN113691885B CN113691885B CN202111055812.2A CN202111055812A CN113691885B CN 113691885 B CN113691885 B CN 113691885B CN 202111055812 A CN202111055812 A CN 202111055812A CN 113691885 B CN113691885 B CN 113691885B
- Authority
- CN
- China
- Prior art keywords
- watermark
- picture
- video
- pictures
- value
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 68
- 238000012545 processing Methods 0.000 claims abstract description 26
- 238000005457 optimization Methods 0.000 claims abstract description 25
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 18
- 230000002860 competitive effect Effects 0.000 claims abstract description 17
- 239000002245 particle Substances 0.000 claims description 64
- 238000004590 computer program Methods 0.000 claims description 16
- 238000011156 evaluation Methods 0.000 claims description 16
- 238000013441 quality evaluation Methods 0.000 claims description 6
- 230000008859 change Effects 0.000 claims description 5
- 238000000605 extraction Methods 0.000 claims description 4
- 238000004364 calculation method Methods 0.000 claims description 2
- 230000008569 process Effects 0.000 description 7
- 238000010586 diagram Methods 0.000 description 4
- 230000004044 response Effects 0.000 description 4
- 238000001514 detection method Methods 0.000 description 3
- 238000012854 evaluation process Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000007704 transition Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012935 Averaging Methods 0.000 description 1
- 241000197727 Euscorpius alpha Species 0.000 description 1
- 230000009471 action Effects 0.000 description 1
- 230000004075 alteration Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 235000019800 disodium phosphate Nutrition 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 239000005337 ground glass Substances 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/83—Generation or processing of protective or descriptive data associated with content; Content structuring
- H04N21/835—Generation of protective data, e.g. certificates
- H04N21/8358—Generation of protective data, e.g. certificates involving watermark
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/44—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Image Processing (AREA)
Abstract
The embodiment of the invention discloses a method and a device for removing video watermarks, computer equipment and a storage medium, and relates to the technical field of video processing. Wherein the method comprises: acquiring a video from which a watermark is to be removed; extracting multi-frame pictures from the video and forming a first picture set from all the extracted pictures; processing the pictures in the first picture set according to a preset method to obtain watermark pictures; calculating an optimal transparency value based on a competitive group optimization algorithm according to the watermark picture; and removing the watermark picture in the video according to the optimal transparency value through a removal formula of the video watermark. According to the method, the high-precision watermark picture is obtained through processing according to the first picture set, and the watermark removal area and the surrounding area are smoothly transited by combining the optimal transparency value which is rapidly calculated based on the competitive group optimization algorithm, so that the removal efficiency of the video watermark is improved, and the comfort level of a user for watching the video can be improved.
Description
Technical Field
The present invention relates to the field of video processing technologies, and in particular, to a method and apparatus for removing a video watermark, a computer device, and a storage medium.
Background
With the advent of short video feeds, there is an increasing need to edit video, which everyone can be the editor of self-media. However, watermarking on video gives an unpleasant experience from the media editor.
Current methods for picture watermarking have increasingly tended to be mature. However, these methods have a common problem in that it takes tens of seconds or even tens of seconds to process one picture. As is well known, video is assembled from a sheet Zhang Tupian, and it is apparent that these time consuming methods do not meet the requirements for removal of video watermarks. The existing video watermark removal methods mainly comprise two types: 1. mosaic or ground glass special effect treatment is added to the watermark area to blur the watermark area. 2. And shielding by using other pictures or characters. Although the two methods are fast, the watermark removal is incomplete, and the smooth transition of the picture cannot be ensured, so that the requirements of users cannot be met.
Disclosure of Invention
The embodiment of the invention provides a method, a device, computer equipment and a storage medium for removing video watermarks, which aim to solve the problems that the conventional method for removing video watermarks consumes long time, the watermarks are not thoroughly removed, and smooth transition of pictures cannot be ensured.
In a first aspect, an embodiment of the present invention provides a method for removing a video watermark, where the method for removing a video watermark includes: acquiring a video from which a watermark is to be removed; extracting multi-frame pictures from the video and forming a first picture set from all the extracted pictures; processing the pictures in the first picture set according to a preset method to obtain watermark pictures; and removing watermark pictures in the video according to the optimal transparency value through a removal formula of the video watermark.
In a second aspect, an embodiment of the present invention further provides a device for removing a video watermark, where the device includes:
the acquisition unit is used for acquiring the video from which the watermark is to be removed;
a first extraction unit, configured to extract multiple frames of pictures from the video and form a first picture set from all the extracted pictures;
the processing unit is used for processing the pictures in the first picture set according to a preset method to obtain watermark pictures;
the first calculation unit is used for calculating the optimal transparency value of the watermark picture based on a competitive group optimization algorithm;
and the removing unit is used for removing the watermark picture in the video through a video watermark removing formula according to the optimal transparency value.
In a third aspect, an embodiment of the present invention further provides a computer device, where the computer device includes a memory and a processor, where the memory stores a computer program, and the processor implements the method when executing the computer program.
In a fourth aspect, embodiments of the present invention also provide a computer-readable storage medium storing a computer program which, when executed by a processor, implements the above-described method.
The embodiment of the invention provides a method and a device for removing video watermarks, computer equipment and a storage medium, wherein the method comprises the following steps: acquiring a video from which a watermark is to be removed; extracting multi-frame pictures from the video and forming a first picture set from all the extracted pictures; processing the pictures in the first picture set according to a preset method to obtain watermark pictures; calculating an optimal transparency value based on a competitive group optimization algorithm according to the watermark picture; and removing watermark pictures in the video according to the optimal transparency value through a removal formula of the video watermark. According to the method, the high-precision watermark picture is obtained through processing according to the first picture set, and the watermark removal area and the surrounding area are smoothly transited by combining the optimal transparency value which is rapidly calculated based on the competitive group optimization algorithm, so that the removal efficiency of the video watermark is improved, and the comfort level of a user for watching the video can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of a method for removing video watermarks according to an embodiment of the present invention;
fig. 2 is a schematic sub-flowchart of a video watermark removal method according to an embodiment of the present invention;
fig. 3 is a schematic sub-flowchart of a video watermark removal method according to an embodiment of the present invention;
fig. 4 is a schematic sub-flowchart of a video watermark removal method according to an embodiment of the present invention;
fig. 5 is a schematic sub-flowchart of a video watermark removal method according to an embodiment of the present invention;
fig. 6 is a schematic block diagram of a video watermark removal apparatus according to an embodiment of the present invention;
fig. 7 is a schematic block diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be understood that the terms "comprising" and "including" when used in this specification and the appended claims, are also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in this specification and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
The video watermark removing method provided by the embodiment of the invention can be applied to intelligent equipment such as mobile phones, tablet computers, notebook computers, desktop computers and the like. Corresponding functions are realized through application software installed on the user terminal, and a mobile phone terminal is taken as an example for the following description.
Referring to fig. 1, fig. 1 is a flowchart illustrating a method for removing a video watermark according to an embodiment of the invention. As shown in FIG. 1, the method includes the following steps S1-S5.
S1, obtaining a video with the watermark to be removed.
In the implementation, firstly, a video to be watermark removed needs to be obtained, for example, a user selects or uploads the video with the watermark as the video to be watermark removed through a mobile phone terminal, and then the mobile phone terminal takes the video to be watermark removed as a processing object of a subsequent processing flow. Specifically, in the present embodiment, the position of the watermark in the video to be watermark-removed and the pixel value are fixed.
S2, extracting multi-frame pictures from the video and forming a first picture set from all the extracted pictures.
In a specific implementation, multiple frames of pictures are extracted from the video and all the extracted pictures form a first picture set. A frame is the smallest unit of a single picture in video, corresponding to each shot on a motion picture film. The frames appear as a grid or a mark on the timeline of the video software. In an embodiment, the watermark picture to be removed is obtained through operation according to the first picture set.
In one embodiment, as shown in fig. 2, the step S2 includes: steps S201 to S202.
And S201, playing the video so as to preview pictures in the video.
In an implementation, the video is played to preview pictures in the video. In one embodiment, the video to be watermarked is previewed by playing so as to extract multiple frames of pictures.
S202, extracting multi-frame pictures of the video according to preset video frame intervals and forming a first picture set from all the extracted pictures.
In specific implementation, multi-frame pictures of the video are extracted according to preset video frame intervals, and all the extracted pictures form a first picture set. In an embodiment, the preset video frame interval is 10 frames, that is, a frame of picture is extracted every ten frames as a target picture, specifically, the user may set the size of the preset interval according to the length of the video to be watermark removed and the specific picture condition, and the preset interval is not limited specifically herein. In one embodiment, the set of pictures is represented as U i Where i is the number of pictures in the set, typically i is 20 or 30, and forming the first set of pictures may stop previewing the video.
S3, processing the pictures in the first picture set according to a preset method to obtain watermark pictures.
In a specific implementation, the pictures in the first picture set are processed according to a preset method to obtain watermark pictures. In an embodiment, the extracted pixel differences between different frame pictures are used to pre-process the pictures to obtain the watermark picture.
In one embodiment, as shown in fig. 3, the step S3 includes: steps S301 to S302.
S301, two frames of pictures are extracted from the first picture set to serve as target pictures, a second picture set with the two target pictures removed is obtained, and difference operation is conducted on the two target pictures to obtain a watermark-free picture.
In a specific implementation, two frames of pictures are extracted from the first picture set to be taken as target pictures, and removedAnd performing difference operation on the two target pictures to obtain a watermark-free picture. In an embodiment, the positions of the watermark pictures in the two target pictures are fixed, the pixel values of the watermark pictures are the same, the pixel values outside the watermark region in the target pictures are changed, and the watermark pictures with the same pixel values can be subtracted by performing difference operation on the two target pictures, so that the watermark-free picture is obtained. In one embodiment, from set U i Target picture U is randomly extracted from the picture m And U n The two are differenced to obtain the non-watermark picture W o =U m -U n Wherein m is not equal to n, and the target picture U is removed m And U n The second picture set is U s 。
S302, performing preset operation on the pictures in the second picture set and the watermark-free picture to obtain a watermark picture.
In specific implementation, the pictures in the second picture set and the watermark-free picture are subjected to preset operation to obtain a watermark picture. In one embodiment, as shown in fig. 4, the step S302 includes: steps S3021 to S3022.
S3021, sequentially extracting each frame of picture in the second picture set, and performing a preset operation on each frame of picture and the watermark-free picture to obtain a watermark region pixel value set.
In specific implementation, each picture in the second picture set is extracted in turn, and a preset operation is performed on each frame of the picture and the non-watermark picture to obtain a watermark region pixel value set. In one embodiment, the picture includes a watermark picture, and the pixel value of the watermark region in the non-watermark picture is 0, and the pixel value of the non-watermark region is not 0. And carrying out preset operation on the two to obtain the pixel value of the watermark region. Specifically, the preset operation is to assign the pixel value corresponding to the region with the pixel value of zero in the non-watermark picture in the picture as the pixel value of the watermark region, i.e. extract the pixel value of the watermark region in the picture. In one embodiment, the set of pixel values is P s Wherein s=i-2. The second picture set removes two target pictures for finding the non-watermark picture, so the watermark areaThe number of elements in the domain pixel value set is equal to i-2, and the watermark region pixel value with smaller error can be obtained through the step of averaging.
S3022, solving the average value of the watermark region pixel values in the watermark region pixel value set, and extracting the average value of the watermark region pixels onto a blank frame to obtain the watermark picture.
In specific implementation, the average value of watermark region pixel values in a watermark region pixel value set is obtained, and the average value of watermark region pixels is extracted to a blank frame to obtain a watermark picture. In one embodiment, the pixel value set is averaged to be P s =(P 1 +P 2 +P 3 +...+P s ) And/s, because the position with the pixel value of 0 possibly appears in the non-watermark region in the watermark-free picture, the error of the watermark picture is effectively reduced by solving the average value of the pixel values of the watermark region in the watermark region pixel value set, and a more accurate watermark picture is obtained so as to improve the smoothness of watermark removal.
And S4, calculating an optimal transparency value based on a competitive group optimization algorithm according to the watermark picture.
In specific implementation, calculating an optimal transparency value based on a competitive group optimization algorithm according to the watermark picture. The transparency value α is the transparency of the watermark picture, no watermark is visible at all when α=0, and the watermark will cover the original video frame at all when α=1, in the watermarked video frame at the region α=0 where there is no watermark. The transparency value alpha of the watermark picture in the picture of the watermarked video is a value between 0 and 1. The video watermark can be removed by solving the transparency value alpha and then according to the obtained watermark picture. In an embodiment, the watermark picture and the random transparency value are used as particle populations of a competitive group optimization algorithm, winners and losers are distinguished through the merit and inferiority evaluation, and the losers are subjected to optimization learning and then subjected to the next round of merit and inferiority evaluation, and the process is circulated until the optimal transparency value is obtained.
In one embodiment, as shown in fig. 5, the step S4 includes: steps S401 to S404.
S401, establishing an initial particle population according to the watermark picture.
Detailed description of the preferred embodimentsIn the method, an initial particle population is established according to the watermark picture, wherein the particles are transparency values alpha i Product with watermark picture W, i.e. alpha i * W, wherein the transparency value is in the range of 0,1]. In one embodiment, α i A random number of 0 to 1.
S402, traversing the particle population to randomly group the particles in the population in pairs.
In particular, traversing the population of particles randomly groups particles in the population two by two. In one embodiment, the particles in the particle population are grouped in pairs in preparation for the next evaluation of the merit.
In the process of performing the random grouping of the particles in pairs, if an odd number of particles are present, the particles that are eventually added may be ignored, and only the particles in the grouping may be evaluated for the quality.
S403, evaluating the superiority and inferiority of the current round for the two particles in each group to obtain the winner and loser of each group in the current round.
In specific implementation, the two particles in each group are subjected to the quality evaluation of the current round, so that the winner and loser of each group in the current round are obtained. In one embodiment, the pixel gradient value between the watermark picture and the non-watermark picture corresponding to each particle is calculated; and calculating pixel gradient values of all pixel points in the watermark picture and pixel points of the picture in the non-watermark region, and then calculating an average value to be used as the pixel gradient value between the watermark picture and the non-watermark picture.
And comparing the pixel gradient values of the two particles in each group, taking the particle corresponding to the smaller pixel gradient value as a winner, and taking the particle corresponding to the larger pixel gradient value as a loser to obtain the winner and the loser of each group in the current round. The smaller the pixel gradient value is, the smaller the pixel change between the watermark picture and the non-watermark picture is, and particles with small pixel gradient value are taken as winners to optimize the value of alpha so that the removal of the watermark can obtain better smoothness.
S404, after optimization learning is carried out on the loser, the next round of merit evaluation is carried out until the winner meets a preset threshold value or the current cycle number reaches the preset cycle number, and the transparency value corresponding to the winner in the last round of cycle is output as the optimal transparency value.
In specific implementation, the loser is optimized and learned and then enters the next round of quality evaluation until the winner meets a preset threshold value or the current cycle number reaches the preset cycle number, and the transparency value corresponding to the winner in the last round of cycle is output as the optimal transparency value. Specifically, particles in the original population are grouped in pairs randomly, and then the two particles in each group are evaluated for the superiority and inferiority, so that winners and losers in each group are obtained. After the end of the current round of merit evaluation, no action is required for the winner in each group, and for the loser in each group, optimization learning is required to bring it closer to the winner.
The preset threshold value is a pixel gradient value, and when the pixel gradient value of a winner is smaller than the preset threshold value, the loop is stopped, and the transparency value is output as an optimal transparency value. A large number of experiments prove that the competitive group optimization algorithm can output the optimal transparency value in a short time.
In an embodiment, the optimizing learning of the loser includes:
the loser is optimally learned according to the following formula:
wherein l represents a loser, w represents a winner, n represents the current number of cycles, V l (n+1) represents the change value of the n+1-th round after the loser learns to the winner, X w (n) represents the n-th round winner, X l (n) represents the nth round of losers,mean value of all particles, X l (n+1) represents the n+1-th round of loser, c is a control parameter, r 1 、r 2 Are all random numbers, r 1 、r 2 The value range of (2) is [0,1]]。
In this embodiment, the loser in each group is optimally studied according to the above formula, so that the loser is closer to the winner after the optimal study. Wherein the control parameter may be set to 2.
In this embodiment, in each round of the merit evaluation process, whether the corresponding winner reaches the matching requirement, that is, whether the corresponding winner meets the preset threshold value, can be determined according to the evaluation result.
Of course, it should be noted that, if in the process of evaluating the quality of a round, there are winners in a plurality of groups that each satisfy the preset threshold, the minimum value may be selected from the transparency values of the winners in the plurality of groups as the optimal transparency value, and the average value of the transparency values of the plurality of winners may be obtained as the optimal transparency value.
If the winner in each group does not meet the preset threshold value in the current round of the merit evaluation process, the next round of the merit evaluation is needed, and whether the winner meeting the preset threshold value exists or not is continuously determined according to the preset threshold value in the next round of the merit evaluation process. It should be noted that before the next round of merit evaluation is performed, optimization learning needs to be performed on the losers in each packet in the current round, and the losers and winners after optimization learning are re-grouped in pairs and randomly.
It should be noted that, in order to avoid that the matching purpose still cannot be achieved after the multiple rounds of the merit evaluation, the embodiment may further set an optimized cycle number, that is, a preset cycle number. That is, when the number of rounds of the merit evaluation reaches the preset number of rounds, the merit evaluation is stopped, and at this time, the transparency value corresponding to the winner closest to the preset threshold in the last round of rounds is output as the optimal transparency value.
S5, removing watermark pictures in the video through a video watermark removal formula according to the optimal transparency value.
In specific implementation, removing watermark pictures in the video through a video watermark removal formula according to the optimal transparency value. In this embodiment, the removal formula of the video watermark is i= (y- α×w)/(1- α), where I represents an unwatered image, y represents a watermarked image, W represents a watermark picture, and α represents an optimal transparency value. The watermark picture W obtained through operation and the optimal transparency value calculated based on the competitive group optimization algorithm are substituted into a removal formula of the video watermark, so that the watermark picture in the video can be removed, the time for removing the video watermark is shortened, and the smoothness of watermark removal is improved.
The embodiment of the invention provides a method for removing video watermarks, which comprises the following steps: acquiring a video from which a watermark is to be removed; extracting multi-frame pictures from the video and forming a first picture set from all the extracted pictures; processing the pictures in the first picture set according to a preset method to obtain watermark pictures; calculating an optimal transparency value of the watermark picture based on a competitive group optimization algorithm; and removing watermark pictures in the video according to the optimal transparency value through a removal formula of the video watermark. According to the method, high-precision watermark pictures are obtained through processing according to the first picture set; the optimal transparency value calculated rapidly based on the competitive group optimization algorithm is combined, so that smooth transition between the watermark removing area and the surrounding area is realized, the video watermark removing efficiency is accelerated, and the video watching comfort level of a user can be improved.
Fig. 6 is a schematic block diagram of a video watermark removal apparatus according to an embodiment of the present invention. As shown in fig. 6, the present invention further provides a video watermark removal apparatus 100 corresponding to the above video watermark removal method. The video watermark removal apparatus 100 includes a unit for performing the video watermark removal method described above, and may be configured in a desktop computer, a tablet computer, a portable computer, or the like. Specifically, referring to fig. 6, the video watermark removing apparatus 100 includes an obtaining unit 101, a first extracting unit 102, a processing unit 103, a first calculating unit 104, and a removing unit 105.
The acquiring unit 101 is configured to acquire a video from which a watermark is to be removed; the first extracting unit 102 is configured to extract multiple frames of pictures from the video and form a first picture set from all the extracted pictures; the processing unit 103 is configured to process the pictures in the first picture set according to a preset method to obtain watermark pictures; the first calculating unit 104 is configured to calculate an optimal transparency value of the watermark picture based on a competitive group optimization algorithm; the removing unit 105 is configured to remove the watermark picture in the video according to the optimal transparency value by using a video watermark removal formula.
In an embodiment, the first computing unit 104 includes:
the establishing unit is used for establishing an initial particle population according to the watermark picture, wherein the particles are products of transparency values and the watermark picture, and the transparency values are in a value range of 0, 1;
the traversing unit is used for traversing the particle population to group particles in the population in a pairwise manner at random;
the evaluation unit is used for evaluating the superiority and inferiority of the current wheel on the two particles in each group to obtain a winner and a loser of each group in the current wheel;
the output unit is used for carrying out optimization learning on the loser and then entering the next round of quality evaluation until the winner meets a preset threshold value or the current cycle number reaches the preset cycle number, and outputting a transparency value corresponding to the winner in the last round of cycle as an optimal transparency value.
In an embodiment, the evaluation unit comprises:
the second calculating unit is used for calculating pixel gradient values between the watermark picture and the non-watermark picture corresponding to each particle;
and the comparison unit is used for comparing the pixel gradient values of the two particles in each group, taking the particle corresponding to the smaller pixel gradient value as a winner, and taking the particle corresponding to the larger pixel gradient value as a loser to obtain the winner and the loser of each group in the current wheel.
In an embodiment, the output unit includes:
the learning unit is used for optimally learning the loser according to the following formula:
wherein l represents a loser, w represents a winner, n represents the current number of cycles, V l (n+1) represents the change value of the n+1-th round after the loser learns to the winner, X w (n) represents the n-th round winner, X l (n) represents the nth round of losers,mean value of all particles, X l (n+1) represents the n+1-th round of loser, c is a control parameter, r 1 、r 2 Are all random numbers, r 1 、r 2 The value range of (2) is [0,1]]。
In one embodiment, the first extraction unit 102 includes;
a preview unit, configured to play the video to preview a picture in the video;
the second extraction unit is used for extracting multi-frame pictures of the video according to preset video frame intervals and forming a first picture set from all the extracted pictures.
In an embodiment, the processing unit 103 includes:
the difference operation unit is used for extracting two frames of pictures from the first picture set to serve as target pictures, obtaining a second picture set except for the two target pictures, and performing difference operation on the two target pictures to obtain a watermark-free picture;
the first preset operation unit is used for carrying out preset operation on the pictures in the second picture set and the watermark-free picture to obtain a watermark picture.
In an embodiment, the preset operation unit includes:
the second preset operation unit is used for sequentially extracting each frame of picture in the second picture set, and carrying out preset operation on each frame of picture and the watermark-free picture to obtain a watermark region pixel value set;
the average value calculating unit is used for calculating the average value of the pixel values of the watermark region in the watermark region pixel value set and extracting the average value of the pixels of the watermark region onto a blank frame to obtain the watermark picture.
It should be noted that, as those skilled in the art can clearly understand, the specific implementation process of the video watermark removing device and each unit may refer to the corresponding description in the foregoing method embodiment, and for convenience and brevity of description, the description is omitted here.
The above-described video watermark removal apparatus may be implemented in the form of a computer program which is executable on a computer device as shown in fig. 7.
Referring to fig. 7, the computer device 300 includes a processor 302, a memory, and a network interface 305 connected by a system bus 301, wherein the memory may include a non-volatile storage medium 303 and an internal memory 304.
The non-volatile storage medium 303 may store an operating system 3031 and a computer program 3032. The computer program 3032, when executed, may cause the processor 302 to perform a method of removing video watermarks.
The processor 302 is used to provide computing and control capabilities to support the operation of the overall computer device 300.
The internal memory 304 provides an environment for the execution of a computer program 3032 in the non-volatile storage medium 303, which computer program 3032, when executed by the processor 302, causes the processor 302 to perform a method of removing a video watermark.
The network interface 305 is used for network communication with other devices. Those skilled in the art will appreciate that the architecture shown in fig. 7 is merely a block diagram of a portion of the architecture in connection with the present application and is not intended to limit the computer device 300 to which the present application is applied, and that a particular computer device 300 may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
Wherein the processor 302 is configured to execute a computer program 3032 stored in a memory to implement the following steps:
acquiring a video from which a watermark is to be removed;
extracting multi-frame pictures from the video and forming a first picture set from all the extracted pictures;
processing the pictures in the first picture set according to a preset method to obtain watermark pictures;
calculating an optimal transparency value of the watermark picture based on a competitive group optimization algorithm;
and removing watermark pictures in the video according to the optimal transparency value through a removal formula of the video watermark.
In an embodiment, the calculating the optimal transparency value of the watermark picture based on the competitive group optimization algorithm includes:
establishing an initial particle population according to the watermark picture, wherein the particles are the product of a transparency value and the watermark picture, and the transparency value is in the range of 0, 1;
traversing the particle population to randomly group the particles in the population in pairs;
performing the quality evaluation of the current wheel on the two particles in each group to obtain winners and losers of each group in the current wheel;
and after the loser is subjected to optimization learning, the next round of merit evaluation is carried out until the winner meets a preset threshold value or the current cycle number reaches the preset cycle number, and the transparency value corresponding to the winner in the last round of cycle is output as an optimal transparency value.
In one embodiment, the evaluating the goodness of the current round for the two particles in each group to obtain the winner and the loser of each group in the current round includes:
calculating a pixel gradient value between a watermark picture and a non-watermark picture corresponding to each particle;
and comparing the pixel gradient values of the two particles in each group, taking the particle corresponding to the smaller pixel gradient value as a winner, and taking the particle corresponding to the larger pixel gradient value as a loser to obtain the winner and the loser of each group in the current round.
In an embodiment, the optimizing learning of the loser includes:
the loser is optimally learned according to the following formula:
wherein l represents a loser, w represents a winner, n represents the current number of cycles, V l (n+1) represents the change value of the n+1-th round after the loser learns to the winner, X w (n) represents the n-th round winner, X l (n) represents the nth round of losers,mean value of all particles, X l (n+1) represents the n+1-th round of loser, c is a control parameter, r 1 、r 2 Are all random numbers, r 1 、r 2 The value range of (2) is [0,1]]。
In an embodiment, the extracting multi-frame pictures from the video and forming all the extracted pictures into a first picture set includes;
playing the video to preview pictures in the video;
and extracting multi-frame pictures of the video according to preset video frame intervals, and forming a first picture set from all the extracted pictures.
In an embodiment, the processing the pictures in the first picture set according to the preset method to obtain the watermark picture includes:
extracting two frames of pictures from the first picture set to serve as target pictures, obtaining a second picture set except for the two target pictures, and performing difference operation on the two target pictures to obtain a watermark-free picture;
and carrying out preset operation on the pictures in the second picture set and the watermark-free pictures to obtain watermark pictures.
In an embodiment, the performing a preset operation on the pictures in the second picture set and the watermark-free picture to obtain a watermark picture includes:
sequentially extracting each frame of picture in the second picture set, and carrying out preset operation on each frame of picture and the watermark-free picture to obtain a watermark region pixel value set;
and solving the average value of the pixel values of the watermark region in the pixel value set of the watermark region, and extracting the average value of the pixels of the watermark region onto a blank frame to obtain the watermark picture.
It should be appreciated that in embodiments of the present application, the processor 302 may be a central processing unit (Central Processing Unit, CPU), the processor 302 may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSPs), application specific integrated circuits (Application Specific Integrated Circuit, ASICs), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. Wherein the general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Those skilled in the art will appreciate that all or part of the flow in a method embodying the above described embodiments may be accomplished by computer programs instructing the relevant hardware. The computer program may be stored in a storage medium that is a computer readable storage medium. The computer program is executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.
Accordingly, the present invention also provides a storage medium. The storage medium may be a computer readable storage medium. The storage medium stores a computer program. Which, when executed by a processor, causes the processor to perform any of the above-described embodiments of the video watermark removal method of the invention.
The storage medium is a physical, non-transitory storage medium, and may be, for example, a U-disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in the foregoing description to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be combined, divided and deleted according to actual needs. In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The integrated unit may be stored in a storage medium if implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present invention is essentially or a part contributing to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a terminal, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention.
In the foregoing embodiments, the descriptions of the embodiments are focused on, and for those portions of one embodiment that are not described in detail, reference may be made to the related descriptions of other embodiments.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present invention without departing from the spirit or scope of the invention. Thus, it is intended that the present invention also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.
While the invention has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.
Claims (8)
1. A method for removing a video watermark, comprising:
acquiring a video from which a watermark is to be removed;
extracting multi-frame pictures from the video and taking all the extracted pictures as a first picture set;
processing the pictures in the first picture set according to a preset method to obtain watermark pictures;
calculating an optimal transparency value of the watermark picture based on a competitive group optimization algorithm;
establishing an initial particle population according to the watermark picture, wherein the particles are the product of a transparency value and the watermark picture, and the transparency value is in the range of 0, 1;
traversing the particle population to randomly group the particles in the population in pairs;
performing the quality evaluation of the current wheel on the two particles in each group to obtain winners and losers of each group in the current wheel;
after optimizing learning, the loser enters the next round of merit evaluation until the winner meets a preset threshold value or the current cycle number reaches the preset cycle number, and the transparency value corresponding to the winner in the last round of cycle is output as an optimal transparency value;
calculating a pixel gradient value between a watermark picture and a non-watermark picture corresponding to each particle;
comparing the pixel gradient values of the two particles in each group, taking the particle corresponding to the smaller pixel gradient value as a winner, and taking the particle corresponding to the larger pixel gradient value as a loser to obtain the winner and the loser of each group in the current wheel;
and removing watermark pictures in the video according to the optimal transparency value through a removal formula of the video watermark.
2. The method for removing a video watermark according to claim 1, wherein said performing optimal learning on the loser comprises:
the loser is optimally learned according to the following formula:
wherein l represents a loser, w represents a winner, n represents the current number of cycles, vl (n+1) represents a change value of the n+1th cycle after the loser learns to the winner, xw (n) represents the n-th cycle winner, xl (n) represents the n-th cycle loser,/v>Representing the average value of all particles, wherein Xl (n+1) represents the n+1st round of losers, c is a control parameter, r1 and r2 are random numbers, and the value ranges of r1 and r2 are [0,1]]。
3. The method of removing a video watermark according to claim 1, wherein said extracting a plurality of frames of pictures from said video and forming all the extracted pictures into a first set of pictures comprises;
playing the video to preview pictures in the video;
and extracting multi-frame pictures of the video according to preset video frame intervals, and forming a first picture set from all the extracted pictures.
4. A method of removing a video watermark according to claim 3, wherein said processing the pictures in the first set of pictures according to a preset method to obtain a watermark picture comprises:
extracting two frames of pictures from the first picture set to serve as target pictures, obtaining a second picture set except for the two target pictures, and performing difference operation on the two target pictures to obtain a watermark-free picture;
and carrying out preset operation on the pictures in the second picture set and the watermark-free pictures to obtain watermark pictures.
5. The method for removing a video watermark according to claim 4, wherein said performing a preset operation on the pictures in the second picture set and the non-watermark picture to obtain a watermark picture includes:
sequentially extracting each frame of picture in the second picture set, and carrying out preset operation on each frame of picture and the watermark-free picture to obtain a watermark region pixel value set;
and solving the average value of the pixel values of the watermark region in the pixel value set of the watermark region, and extracting the average value of the pixels of the watermark region onto a blank frame to obtain the watermark picture.
6. A video watermark removal apparatus, comprising:
the acquisition unit is used for acquiring the video from which the watermark is to be removed;
a first extraction unit, configured to extract multiple frames of pictures from the video and form a first picture set from all the extracted pictures;
the processing unit is used for processing the pictures in the first picture set according to a preset method to obtain watermark pictures;
the first calculation unit is used for calculating the optimal transparency value of the watermark picture based on a competitive group optimization algorithm;
the establishing unit is used for establishing an initial particle population according to the watermark picture, wherein the particles are products of transparency values and the watermark picture, and the transparency values are in a value range of 0, 1;
the traversing unit is used for traversing the particle population to group particles in the population in a pairwise manner at random;
the evaluation unit is used for evaluating the superiority and inferiority of the current wheel on the two particles in each group to obtain a winner and a loser of each group in the current wheel;
the output unit is used for carrying out optimization learning on the loser and then entering the next round of quality evaluation until the winner meets a preset threshold value or the current cycle number reaches the preset cycle number, and outputting a transparency value corresponding to the winner in the last round of cycle as an optimal transparency value;
the second calculating unit is used for calculating pixel gradient values between the watermark picture and the non-watermark picture corresponding to each particle;
the comparison unit is used for comparing the pixel gradient values of the two particles in each group, taking the particle corresponding to the smaller pixel gradient value as a winner, and taking the particle corresponding to the larger pixel gradient value as a loser to obtain the winner and the failure of each group in the current wheel;
and the removing unit is used for removing the watermark picture in the video through a video watermark removing formula according to the optimal transparency value.
7. A computer device, characterized in that it comprises a memory and a processor, on which a computer program is stored, which processor implements the method according to any of claims 1-5 when executing the computer program.
8. A computer readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the method according to any of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111055812.2A CN113691885B (en) | 2021-09-09 | 2021-09-09 | Video watermark removal method and device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111055812.2A CN113691885B (en) | 2021-09-09 | 2021-09-09 | Video watermark removal method and device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113691885A CN113691885A (en) | 2021-11-23 |
CN113691885B true CN113691885B (en) | 2024-01-30 |
Family
ID=78585811
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111055812.2A Active CN113691885B (en) | 2021-09-09 | 2021-09-09 | Video watermark removal method and device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113691885B (en) |
Citations (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2006116270A2 (en) * | 2005-04-26 | 2006-11-02 | Verance Corporation | Security enhancements of digital watermarks for multi-media content |
KR20110101577A (en) * | 2010-03-09 | 2011-09-16 | 한국과학기술원 | The video watermarking system for inaccessible contents using overlay channel and the method thereof |
CN103295180A (en) * | 2013-05-02 | 2013-09-11 | 陕西师范大学 | Digital watermarking method with robustness and transparency in optimum balance |
CN103793874A (en) * | 2014-02-14 | 2014-05-14 | 中北大学 | Novel digital watermarking method capable of maintaining fidelity and robustness |
JP2016072706A (en) * | 2014-09-26 | 2016-05-09 | 大日本印刷株式会社 | Strength setting method for watermark embedding and computer program |
CN106780286A (en) * | 2017-01-23 | 2017-05-31 | 天津大学 | A kind of particle group optimizing water mark method extracted based on blind watermatking |
CN107240059A (en) * | 2017-04-07 | 2017-10-10 | 广东精点数据科技股份有限公司 | The modeling method of image digital watermark embedment strength regressive prediction model |
CN108055493A (en) * | 2017-12-13 | 2018-05-18 | 苏州科达科技股份有限公司 | The method and device of embedded watermark in video image |
CN109636710A (en) * | 2018-10-16 | 2019-04-16 | 平安好房(上海)电子商务有限公司 | Automatically remove method, equipment, storage medium and the device of watermark |
CN111696046A (en) * | 2019-03-13 | 2020-09-22 | 北京奇虎科技有限公司 | Watermark removing method and device based on generating type countermeasure network |
CN111932431A (en) * | 2020-07-07 | 2020-11-13 | 华中科技大学 | Visible watermark removing method based on watermark decomposition model and electronic equipment |
CN111968024A (en) * | 2020-07-24 | 2020-11-20 | 南昌大学 | Self-adaptive image watermarking method |
CN111984943A (en) * | 2020-07-29 | 2020-11-24 | 南京信息工程大学 | DWT-SVD digital watermarking method based on artificial bee colony algorithm |
CN112217958A (en) * | 2020-09-15 | 2021-01-12 | 陕西科技大学 | Method for preprocessing digital watermark carrier image irrelevant to device color space |
CN112653894A (en) * | 2020-12-15 | 2021-04-13 | 深圳万兴软件有限公司 | Interframe predictive coding searching method and device, computer equipment and storage medium |
CN113065631A (en) * | 2021-03-24 | 2021-07-02 | 安徽铜冠铜箔集团股份有限公司 | Parameter optimization method based on improved competition group algorithm |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
IL251149A0 (en) * | 2017-03-14 | 2017-06-29 | Google Inc | Semi-transparent watermarks for served content |
-
2021
- 2021-09-09 CN CN202111055812.2A patent/CN113691885B/en active Active
Patent Citations (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2006116270A2 (en) * | 2005-04-26 | 2006-11-02 | Verance Corporation | Security enhancements of digital watermarks for multi-media content |
KR20110101577A (en) * | 2010-03-09 | 2011-09-16 | 한국과학기술원 | The video watermarking system for inaccessible contents using overlay channel and the method thereof |
CN103295180A (en) * | 2013-05-02 | 2013-09-11 | 陕西师范大学 | Digital watermarking method with robustness and transparency in optimum balance |
CN103793874A (en) * | 2014-02-14 | 2014-05-14 | 中北大学 | Novel digital watermarking method capable of maintaining fidelity and robustness |
JP2016072706A (en) * | 2014-09-26 | 2016-05-09 | 大日本印刷株式会社 | Strength setting method for watermark embedding and computer program |
CN106780286A (en) * | 2017-01-23 | 2017-05-31 | 天津大学 | A kind of particle group optimizing water mark method extracted based on blind watermatking |
CN107240059A (en) * | 2017-04-07 | 2017-10-10 | 广东精点数据科技股份有限公司 | The modeling method of image digital watermark embedment strength regressive prediction model |
CN108055493A (en) * | 2017-12-13 | 2018-05-18 | 苏州科达科技股份有限公司 | The method and device of embedded watermark in video image |
CN109636710A (en) * | 2018-10-16 | 2019-04-16 | 平安好房(上海)电子商务有限公司 | Automatically remove method, equipment, storage medium and the device of watermark |
CN111696046A (en) * | 2019-03-13 | 2020-09-22 | 北京奇虎科技有限公司 | Watermark removing method and device based on generating type countermeasure network |
CN111932431A (en) * | 2020-07-07 | 2020-11-13 | 华中科技大学 | Visible watermark removing method based on watermark decomposition model and electronic equipment |
CN111968024A (en) * | 2020-07-24 | 2020-11-20 | 南昌大学 | Self-adaptive image watermarking method |
CN111984943A (en) * | 2020-07-29 | 2020-11-24 | 南京信息工程大学 | DWT-SVD digital watermarking method based on artificial bee colony algorithm |
CN112217958A (en) * | 2020-09-15 | 2021-01-12 | 陕西科技大学 | Method for preprocessing digital watermark carrier image irrelevant to device color space |
CN112653894A (en) * | 2020-12-15 | 2021-04-13 | 深圳万兴软件有限公司 | Interframe predictive coding searching method and device, computer equipment and storage medium |
CN113065631A (en) * | 2021-03-24 | 2021-07-02 | 安徽铜冠铜箔集团股份有限公司 | Parameter optimization method based on improved competition group algorithm |
Non-Patent Citations (5)
Title |
---|
A Competitive Swarm Optimizer for Large Scale Optimization;Ran Cheng等;IEEE TRANSACTIONS ON CYBERNETICS;第45卷(第2期);第191-202页 * |
Adaptive Watermark Strength Selection using Particle Swarm Optimization;Muhammad Ishtiaq等;ICIC Express Letters;第4卷(第5期);全文 * |
Optimized Audio Watermarking Scheme with Swarm Intelligence;Mustapha Hemis等;2015 First International Conference on New Technologies of Information and Communication;全文 * |
基于差分进化的小波域彩色图像盲水印算法;吴万旭;牛钰莹;刘甜甜;赵全超;;通信技术(第04期);全文 * |
基于粒子群优化和小波变换的视频水印算法研究;曾苑;中国优秀硕士学位论文全文数据库(第3期);第29-34页 * |
Also Published As
Publication number | Publication date |
---|---|
CN113691885A (en) | 2021-11-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110189285B (en) | Multi-frame image fusion method and device | |
CN108961303B (en) | Image processing method and device, electronic equipment and computer readable medium | |
US10438322B2 (en) | Image resolution enhancement | |
WO2017101489A1 (en) | Method and device for image filtering | |
US20180342045A1 (en) | Image resolution enhancement using machine learning | |
CN111145114B (en) | Image enhancement method and device and computer readable storage medium | |
CN108337551B (en) | Screen recording method, storage medium and terminal equipment | |
US8494267B2 (en) | Image processing device, image processing method, and program for normalizing a histogram | |
JP5457606B2 (en) | Image processing method and apparatus | |
JP2011070681A (en) | Method for measuring local image similarity based on l1 distance measure | |
CN111985281B (en) | Image generation model generation method and device and image generation method and device | |
WO2016197657A1 (en) | Photographing processing method and apparatus | |
US8983188B1 (en) | Edge-aware smoothing in images | |
CN109934789A (en) | Image de-noising method, device and electronic equipment | |
CN113992850A (en) | ISP-based image processing method and device, storage medium and camera equipment | |
CN110689496B (en) | Method and device for determining noise reduction model, electronic equipment and computer storage medium | |
WO2020098325A1 (en) | Image synthesis method, electronic device and storage medium | |
CN113691885B (en) | Video watermark removal method and device, computer equipment and storage medium | |
CN109727193B (en) | Image blurring method and device and electronic equipment | |
CN111340714B (en) | Moire pattern processing method and device and electronic equipment | |
CN113298723A (en) | Video processing method and device, electronic equipment and computer storage medium | |
CN111885371A (en) | Image occlusion detection method and device, electronic equipment and computer readable medium | |
CN108876691B (en) | Self-adaptive reversible watermarking method and system | |
CN113807234B (en) | Method, device, computer equipment and storage medium for checking mouth-shaped synthesized video | |
WO2017036386A1 (en) | Video denoising method and device, terminal and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |