CN112991137B - Method for dynamically identifying and removing watermark position of picture - Google Patents

Method for dynamically identifying and removing watermark position of picture Download PDF

Info

Publication number
CN112991137B
CN112991137B CN202110451530.8A CN202110451530A CN112991137B CN 112991137 B CN112991137 B CN 112991137B CN 202110451530 A CN202110451530 A CN 202110451530A CN 112991137 B CN112991137 B CN 112991137B
Authority
CN
China
Prior art keywords
watermark
picture
pixel
value
model
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
Application number
CN202110451530.8A
Other languages
Chinese (zh)
Other versions
CN112991137A (en
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.)
Hunan Yingke Mutual Entertainment Network Information Co ltd
Original Assignee
Hunan Yingke Mutual Entertainment Network Information 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 Hunan Yingke Mutual Entertainment Network Information Co ltd filed Critical Hunan Yingke Mutual Entertainment Network Information Co ltd
Priority to CN202110451530.8A priority Critical patent/CN112991137B/en
Publication of CN112991137A publication Critical patent/CN112991137A/en
Application granted granted Critical
Publication of CN112991137B publication Critical patent/CN112991137B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/0021Image watermarking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2201/00General purpose image data processing
    • G06T2201/005Image watermarking
    • G06T2201/0203Image watermarking whereby the image with embedded watermark is reverted to the original condition before embedding, e.g. lossless, distortion-free or invertible watermarking

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

The invention relates to a method for dynamically identifying and removing a watermark position of a picture, which comprises the following steps: s1 loads a watermark model picture to be identified, S2 scales the picture to be identified to be consistent with the original picture of the watermark model, S3 identifies the watermark position information of the picture to be processed, S4 records the watermark position information in continuous pictures, S5 scans 8 pixel points around the target pixel of the watermark matrix to be removed pixel by pixel, S6 uses balance mean value calculation to fill the target pixel of the watermark to be removed, S7 loops the step 5, 6 until the filling of the watermark matrix to be removed is completed, and S8 outputs the final picture with the removed watermark.

Description

Method for dynamically identifying and removing watermark position of picture
Technical Field
The invention relates to the technical field of image processing, in particular to a method for dynamically identifying and removing a watermark position of a picture.
Background
With the continuous development of internet technology, various media picture sharing platforms are developed endlessly, a home label or a watermark is marked on media or pictures shared or uploaded by the platforms, and a user can share the same picture on different platforms, sometimes pictures with watermarks of other companies are uploaded, and advertisements or other illegal information can be brought on the pictures to serve as a picture sharing platform.
In the prior art, picture contents uploaded by a user are generally manually checked, pictures containing watermarks or advertisements are downloaded, and then the contents are erased or deleted through a picture processing tool;
or by manually marking the watermark picture position and then overlaying it using a third party program or mosaic device.
The first scheme in the prior art depends on manual review, the image watermark is erased through an image processing tool, a plurality of processes are required in image processing, the image processing tool needs to be operated by professionals, the cost of manual operation is too high, and the processed effect has obvious mosaic traces or long processing time;
the second scheme relies on the manual marking position, solves the problem of the picture professional on the basis of the steps, but essentially depends on the manual marking position, has too low processing efficiency, cannot process pictures in time when more pictures exist, and also has the same defects of the defect 1: has obvious mosaic marks.
For example, chinese invention patent CN110544198A discloses a method, an apparatus and an electronic device for processing image watermark, which comprises the following steps: acquiring a picture to be processed; determining watermark specification information in the picture to be processed according to the picture source of the picture to be processed, wherein the watermark specification information comprises a watermark position, a watermark shape, a watermark area and a watermark color; and carrying out watermark processing on the picture to be processed according to the watermark specification information.
For another example, chinese patent CN110889795A discloses a method for automatically removing image watermarks, which comprises the following steps: 1. loading and reading all pictures to be processed; 2. screening and filtering pictures; 3. loading the picture into an image buffer area and replacing the picture watermark; 4. and outputting and storing the picture after replacing the watermark. The invention solves the problems of automation of image watermark removal, the need of a third-party tool for removing the watermark, complex operation, poor effect and low efficiency, and can be widely applied to WEB application and development.
And as the chinese invention patent CN110599387A discloses a method and device for automatically removing image watermarks, the method includes: acquiring a picture with a watermark; and inputting the image with the watermark into a trained preset neural network, and obtaining a watermark-removed image according to an output result of the trained preset neural network. The method comprises the steps of removing a watermarked picture set through a neural network classifier to generate a sample picture set after the watermark is removed, taking the sample picture set after the watermark is removed, an unwatered picture set and the watermarked picture set as training samples, carrying out antagonistic learning on the neural network generator and the neural network classifier by aiming at minimizing the average absolute error value of the sample picture set after the watermark is removed and the unwatered picture set, and carrying out training for multiple times to obtain a trained preset neural network capable of effectively removing the watermark, so that the watermarked picture can be subjected to the watermark removing treatment according to the trained preset neural network, and the watermarked picture is efficiently removed.
The above prior art has the following problems: the Chinese patent CN110544198A relies on the classification of the folder in the acquisition of the watermark position, acquires the fixed watermark position through the classification of the folder, or relies on the manual input of the watermark position, and does not explain the processing mode of the watermark in detail; the Chinese patent CN110889795A excessively depends on the color value of the pixel point of the watermark in the aspect of watermark position identification, and the color value is directly replaced by white when the color value is judged to be consistent, so that the scheme has the effect of easily identifying the normal picture content into the watermark content and replacing the watermark content with the white content in the aspect of watermark identification; the Chinese patent CN110599387A uses a deep learning model in the aspect of watermarking, the model needs a large number of material pictures and watermark sample materials for training, the training period is long, and watermark model pictures cannot be added quickly.
Disclosure of Invention
The invention aims to provide a method for dynamically identifying and removing a watermark position of a picture, which realizes automatic identification and removal of the watermark and effectively solves the problem that the watermark position needs to be marked manually to be removed so as to improve the processing efficiency.
The invention discloses a method for dynamically identifying and removing a watermark position of a picture, which comprises the following steps:
s1, loading the watermark model picture to be identified: specifically, 1) placing the manufactured watermark model and original model size information under the same directory structure, wherein the watermark model is stored by using a png picture, and the original watermark size information is stored by using a txt file and the same name as the watermark model picture;
2) loading a watermark model picture of a specified directory, and analyzing corresponding original picture size txt information;
3) graying the watermark model picture, and then loading the grayscale picture copy into an internal memory;
the image watermark model is watermark sample data which needs to be removed, the position of the watermark can be found on the watermark image to be identified only by identifying the watermark sample data, and the watermark model needs to be generated by using watermark image data in a real service scene;
s2, scaling the size of the picture to be identified to be consistent with the original picture of the watermark model:
1) acquiring a watermark model and corresponding original image size data according to the watermark model picture loaded in the step 1;
2) dividing the width and height of the size of the original image by the width and height of the image to be identified to obtain a corresponding width and height scaling ratio so as to realize scaling equal to the original image;
3) multiplying the calculated width and height scaling ratios by the width and height of the picture to be identified respectively to obtain the final width and height;
4) using opencv and a picture size adjusting function to adjust the size of the picture to be identified: cv2.resize (img, (width, height), interplation = cv2.inter _ CUBIC)
Graying the zoomed picture, and reducing the calculated amount through graying to accelerate the identification speed (one pixel of the color picture has rgb3 value ranges, and one pixel of the picture after graying is only one value, namely 0-255, thereby greatly reducing the calculated amount);
s3, identifying the watermark position information of the picture to be processed
1) Acquiring the size of a watermark model (T), namely the actual size of the watermark, sliding the watermark model (T) on the picture (I) to be identified frame by frame according to the size of the watermark model (T), moving one pixel on the picture (I) to be identified each time, and moving the pixel from left to right and from top to bottom;
2) at each position, measuring once to calculate the matching degree of the watermark template (T), namely the hash similarity of the watermark model (T) and the image of the sliding image block of the image (I) to be identified, storing a result value into a result image matrix (R) for a measuring result of each frame-by-frame sliding, storing a matching metric value, namely the hash similarity, at each position (x, y) in the R, wherein the hash value is the matching metric value and is used for judging whether the watermark position is identified;
after the sliding is finished, a result image R is generated, a result image R is found, a point which is the highest and matches with the watermark model is found, a pixel point with the minimum measurement value is found by scanning the R frame by frame, the point is taken as a vertex, the vertex x is added with the width of the watermark model (T), the vertex y is added with the height of the watermark model (T), and a result matrix which is the watermark position information of the picture (I) to be identified can be obtained.
The measurement is calculated in the following way: every time of sliding, the sliding position is taken as a vertex, the width and the height of the watermark model are extracted, the width of the vertex x position + the width of the watermark model, the height of the vertex y position + the watermark model are extracted, the color value after the gray scale of the corresponding position is extracted, the subtraction is carried out on the pixel points x and y corresponding to the watermark model to calculate the square, then the sum of all the points is accumulated to obtain the total difference value of the points x and y, the smaller the total difference value is, the higher the description similarity is, and the calculation formula is as follows:
Figure 287640DEST_PATH_IMAGE001
x 'and y' represent pixel point coordinates of the watermark picture model;
s4, recording watermark position information in continuous pictures
1) On continuous multiple images, such as video frame capture, gif images, animation and the like, the images of the type have the characteristic of continuous change, and the image position of the watermark and the watermark content can change in different frames;
2) because the watermark contents of the continuous pictures are different and the pictures are switched quickly, the original pictures need to be cut into frames for identifying the pictures, namely, the pictures which change quickly are decomposed into a plurality of static pictures according to the frame rate of the pictures;
3) performing watermark identification in step 3 on the static picture after frame truncation;
4) after the identification fails in the step 3 (because the watermark information of each frame is inconsistent, the identification may fail in the case of less than the threshold), no watermark position may be filled, and at this time, the continuous frame position of the picture which is successfully identified last time needs to be used as the watermark position of the picture, so as to solve the watermark removal effect of the picture;
s5, scanning 8 pixel points around the target pixel of the watermark matrix to be removed pixel by pixel, calculating the rgb color value of the pixel point of the watermark to be filled, and fusing the filled picture with the previous picture
1) Generating a watermark matrix to be removed according to the watermark position coordinates (x, y) output in the step 3;
2) performing pixel-by-pixel sliding in the matrix to be removed, moving one pixel on the matrix to be removed every time, and moving the pixel from left to right and from top to bottom;
3) recording 8 pixel points of the periphery of the sliding position, such as up, down, left, right, up, left, down, right and the like;
4) obtaining rgb color values such as rgb (255 ) of the 8 pixel points;
s6, using balance mean value calculation to fill target pixel point to be removed watermark
1) Carrying out balance mean calculation on the color values of the peripheral 8 points extracted in the step five
2) And after obtaining the balance mean value, performing pixel filling by using the balance mean value to cover the original watermark pixel point
Wherein, the calculation mode of the balance mean value is as follows:
firstly, rgb color values of upper and lower positions of a target pixel point are obtained, the rgb color value at the position is used for subtracting the rgb color value at the position, after a difference value is obtained, the difference value is divided by 2 to obtain a difference value intermediate value a,
acquiring rgb color values at the left position and the right position, and dividing the rgb color values at the left-position and the right position by 2 to obtain a middle value b;
then, rgb color values on the left side of the position and on the right side of the position are obtained, the rgb color values on the left side of the position and on the right side of the position are used, and after the rgb color values are divided by 2, a middle value c is obtained;
then rgb color values of the upper right position and the lower left position are obtained, and the rgb color values of the upper right position and the lower left position are used, and after the rgb color values are divided by 2, a middle value d is obtained;
accumulating the absolute values of the intermediate values abcd, and dividing the accumulated absolute values by 4 to obtain a final intermediate average value;
adding the final intermediate value to the position upper value and the position left value respectively, and accumulating to obtain a new value divided by 2 to obtain a color value to be filled in the target position;
3) filling pixel points with the calculated color values
S7, the steps 5 and 6 are circulated until the watermark matrix to be removed is filled completely
And S8, outputting the final picture with the watermark removed.
The method comprises the steps of carrying out watermark detection on a picture to be detected, carrying out image graying and size scaling on the picture to be detected through loaded watermark model data, carrying out measurement calculation after scaling, mapping a measurement calculation result onto a result picture R, finally finding a point with the highest similarity on the result picture R, taking the point as a vertex, adding the width and the height of a watermark model on the basis of the vertex to obtain a watermark position matrix, carrying out pixel-by-pixel scanning on the watermark position matrix and carrying out balanced mean calculation after dynamically calculating to obtain a final difference value between a target pixel point and peripheral pixels in the matrix, adding a final difference value to an existing color value on the target point position and on the left of the target point position, filling the color value into the target point, and finally outputting the filled picture.
Has the advantages that: the invention firstly adopts a pixel-by-pixel scanning mode, realizes the cutting of the picture block of the picture to be identified by sliding the picture to be identified, and then carries out measurement calculation on the cut picture block and the watermark model block, wherein the measurement calculation mode is as follows: and taking the sliding position point as a vertex, extracting the width and the height of the watermark model, subtracting the x and y pixel points corresponding to the watermark model from the vertex x position + the width of the watermark model and the vertex y position + the height of the watermark model, performing square calculation, then accumulating the sum of all the points, finally obtaining the total difference value of the points x and y, wherein the smaller the total difference value is, the higher the similarity is, and taking out the point with the highest similarity (the point with the smallest difference value on the result image R), namely the watermark position of the picture to be identified after obtaining the measurement calculation result.
After obtaining the watermark position information, pixel-by-pixel scanning is carried out on the matrix of the watermark position, the rgb color value of the periphery of each pixel point is calculated, then the difference value of the peripheral pixel points of the target pixel point is calculated by using the vertical lines, the left lines, the right lines, the upper left lines, the lower left lines, the upper right lines, the lower left lines and the oblique lines of two corners, the difference value is averaged, the fusion of the target pixel point and the peripheral pixel points is realized, the calculated pixel value achieves the effect basically consistent with the original image after being filled, and the picture with the watermark is removed without damage.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention.
In the drawings:
FIG. 1 is a block flow diagram of the present invention;
fig. 2 is a schematic diagram illustrating the calculation of the equilibrium mean value of rgb color values of pixels around a target;
FIG. 3 is a first illustration of a practical application of the present invention;
FIG. 4 is a second practical illustration of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Fig. 1 shows a flowchart of a method for dynamically identifying and removing a watermark from a picture according to an embodiment of the present invention, which includes the following steps: loading a picture to be detected for watermark detection; carrying out image gray scale and size scaling processing on a picture to be detected; then, carrying out measurement calculation; generating a result graph R; generating a watermark position matrix according to the watermark model; scanning frame by frame; filling a watermark matrix by using balance mean calculation; and outputting the watermark-free picture.
In the above process, if the generated result image R is not continuous frame image, the watermark position matrix is generated by using the identification result of the previous frame.
The specific content of each step in this embodiment is as follows:
s1, loading the watermark model picture to be identified: specifically, 1) placing the manufactured watermark model and original model size information under the same directory structure, wherein the watermark model is stored by using a png picture, and the original watermark size information is stored by using a txt file and the same name as the watermark model picture;
2) loading a watermark model picture of a specified directory, and analyzing corresponding original picture size txt information;
3) graying the watermark model picture, and then loading the grayscale picture copy into an internal memory;
the image watermark model is watermark sample data which needs to be removed, the position of the watermark can be found on the watermark image to be identified only by identifying the watermark sample data, and the watermark model needs to be generated by using watermark image data in a real service scene;
s2, scaling the size of the picture to be identified to be consistent with the original picture of the watermark model:
1) acquiring a watermark model and corresponding original image size data according to the watermark model picture loaded in the step 1;
2) dividing the width and height of the size of the original image by the width and height of the image to be identified to obtain a corresponding width and height scaling ratio so as to realize scaling equal to the original image;
3) multiplying the calculated width and height scaling ratios by the width and height of the picture to be identified respectively to obtain the final width and height;
4) using opencv and a picture size adjusting function to adjust the size of the picture to be identified: cv2.resize (img, (width, height), interplation = cv2.inter _ CUBIC)
Graying the zoomed picture, and reducing the calculated amount through graying to accelerate the identification speed (one pixel of the color picture has rgb3 value ranges, and one pixel of the picture after graying is only one value, namely 0-255, thereby greatly reducing the calculated amount);
s3, identifying the watermark position information of the picture to be processed
1) Obtaining the size of the watermark model (T), and sliding the picture (I) to be identified frame by frame according to the size of the watermark model (T) (moving one pixel on the picture (I) to be identified each time from left to right and from top to bottom)
2) At each position, measuring once to calculate the matching degree of the watermark template (T), namely the hash similarity of the watermark model (T) and the image of the sliding image block of the image (I) to be identified, storing a result value into a result image matrix (R) for a measuring result of each frame-by-frame sliding, storing a matching metric value, namely the hash similarity, at each position (x, y) in the R, wherein the hash value is the matching metric value and is used for judging whether the watermark position is identified;
after the sliding is finished, a result image R is generated, a result image R is found, a point which is the highest and is matched with the watermark model is found, a pixel point with the minimum measurement value is found by scanning the R frame by frame, the point is taken as a vertex, the vertex x is added with the width of the watermark model (T), and the vertex y is added with the height of the watermark model (T), so that a result matrix which is the watermark position information of the picture (I) to be identified can be obtained.
The measurement is calculated in the following way: every time of sliding, the sliding position is taken as a vertex, the width and the height of the watermark model are extracted, the width of the vertex x position + the width of the watermark model, the height of the vertex y position + the watermark model are extracted, the color value after the gray scale of the corresponding position is extracted, the subtraction is carried out on the pixel points x and y corresponding to the watermark model to calculate the square, then the sum of all the points is accumulated to obtain the total difference value of the points x and y, the smaller the total difference value is, the higher the description similarity is, and the calculation formula is as follows:
Figure 532676DEST_PATH_IMAGE001
x 'and y' represent the pixel point coordinates of the watermark picture model,
s4, recording watermark position information in continuous pictures
1) On continuous multiple images, such as video frame capture, gif images, animation and the like, the images of the type have the characteristic of continuous change, and the image position of the watermark and the watermark content can change in different frames;
2) because the watermark contents of the continuous pictures are different and the pictures are switched quickly, the original pictures need to be cut into frames for identifying the pictures, namely, the pictures which change quickly are decomposed into a plurality of static pictures according to the frame rate of the pictures;
3) performing watermark identification in step 3 on the static picture after frame truncation;
4) after the identification fails in the step 3 (because the watermark information of each frame is inconsistent, the identification may fail in the case of less than the threshold), no watermark position may be filled, and at this time, the continuous frame position of the picture which is successfully identified last time needs to be used as the watermark position of the picture, so as to solve the watermark removal effect of the picture;
s5, scanning 8 pixel points around the target pixel of the watermark matrix to be removed pixel by pixel, calculating the rgb color value of the pixel point of the watermark to be filled, and fusing the filled picture with the previous picture
1) Generating a watermark matrix to be removed according to the watermark position coordinates (x, y) output in the step 3;
2) performing pixel-by-pixel sliding in the matrix to be removed, moving one pixel on the matrix to be removed every time, and moving the pixel from left to right and from top to bottom;
3) recording 8 pixel points of the periphery of the sliding position, such as up, down, left, right, up, left, down, right and the like;
4) acquiring rgb color values such as rgb (255 ) of the 8 pixel points, referring to fig. 2, wherein a middle point is a single target pixel point of a watermark region to be filled, and the rgb color values of the target point are generated by calculating a balanced mean value of rgb color values of pixel points around the target through a vertical line formed by upper and lower pixel points, a straight line formed by left and right pixel points, and a diagonal line formed by upper left, lower right, upper right and lower left;
s6, using balance mean value calculation to fill target pixel point to be removed watermark
1) Carrying out balance mean calculation on the color values of the peripheral 8 points extracted in the step five
2) And after obtaining the balance mean value, performing pixel filling by using the balance mean value to cover the original watermark pixel point
Wherein, the calculation mode of the balance mean value is as follows:
firstly, rgb color values of upper and lower positions of a target pixel point are obtained, the rgb color value at the position is used for subtracting the rgb color value at the position, after a difference value is obtained, the difference value is divided by 2 to obtain a difference value intermediate value a,
acquiring rgb color values at the left position and the right position, and dividing the rgb color values at the left-position and the right position by 2 to obtain a middle value b;
then, rgb color values on the left side of the position and on the right side of the position are obtained, the rgb color values on the left side of the position and on the right side of the position are used, and after the rgb color values are divided by 2, a middle value c is obtained;
then rgb color values of the upper right position and the lower left position are obtained, and the rgb color values of the upper right position and the lower left position are used, and after the rgb color values are divided by 2, a middle value d is obtained;
accumulating the absolute values of the intermediate values abcd, and dividing the accumulated absolute values by 4 to obtain a final intermediate average value;
adding the final intermediate value to the position upper value and the position left value respectively, and accumulating to obtain a new value divided by 2 to obtain a color value to be filled in the target position;
3) filling pixel points with the calculated color values
S7, the steps 5 and 6 are circulated until the watermark matrix to be removed is filled completely
And S8, outputting the final picture with the watermark removed.
As shown in fig. 3 and 4, the small rectangular frame region of the picture with the watermark logo is a position that needs to be identified and determined, the left sides of fig. 3 and 4 are both the right sides of the picture to be processed as the processed picture, and the watermark target in the small rectangular frame region can be filled by determining the watermark position, wherein the filling manner is as follows: and performing balanced mean calculation according to the rgb color values of the pixels around the target point to generate the rgb color values of the pixels to be filled. And (4) filling the target pixel points by using the generated rgb color values, namely finishing the watermark removal of a single pixel point, scanning the watermark area pixel by pixel, and finishing the watermark removal of the whole area after the filling is finished.
The application of the patent method has the following beneficial effects:
the position of the watermark to be processed can be identified on the watermark picture, the position does not depend on manual marking, and the position of the watermark can be effectively calculated through the algorithm provided by the patent;
in the aspect of removing the watermark picture, a balanced mean algorithm is used, and the color value of the filling pixel point is obtained by calculating the pixel color value pair at the periphery of the watermark pixel point instead of white filling which is used violently;
the method can quickly iterate and increase the model of the watermark to be removed, does not need to spend a large amount of time to train and verify before application, and achieves good effect in practical application;
the above patents do not apply watermark identification to continuous pictures, and the patent can effectively calibrate the watermark position on a dynamic frame (continuous pictures).
The above-mentioned embodiments are preferred embodiments of the present invention, but the scope of the present invention is not limited to these embodiments, and for example, the number of graphene layers is changed within the range covered by the above-mentioned thin layer, and all of them belong to this scope. The invention is not described in detail, and is a conventional application method technology in the field.

Claims (6)

1. A method for dynamically identifying and removing a watermark position of a picture is characterized by comprising the following steps: s1 loading a watermark model picture to be identified, S2 zooming the picture to be identified to be consistent with the size of the original picture of the watermark model, S3 identifying the watermark position information of the picture to be processed, S4 recording the watermark position information in continuous pictures, S5 scanning 8 pixel points around the target pixel of the watermark matrix to be removed pixel by pixel, S6 filling the target pixel of the watermark to be removed by using balanced mean value calculation, S7 circulating S5 and S6 until the filling of the watermark matrix to be removed is completed, and S8 outputting the final picture with the watermark removed;
the specific steps of S4 are as follows: 1) on the continuous multiple pictures, the continuous multiple pictures comprise video frame cutting, gif pictures and animation types, the pictures of the types have the characteristic of continuous change, and the picture position of the watermark and the watermark content can change in different frames; 2) because the watermark contents of the continuous pictures are different and the pictures are switched quickly, the original pictures need to be cut into frames for identifying the pictures, namely, the pictures which change quickly are decomposed into a plurality of static pictures according to the frame rate of the pictures; 3) performing watermark identification in step 3 on the static picture after frame truncation; 4) after the identification in step 3 fails, no watermark position can be filled, and the continuous frame position of the picture which is successfully identified last time needs to be used as the watermark position of the picture, so as to solve the watermark removing effect of the picture.
2. The method according to claim 1, wherein the specific steps of S1 are: 1) placing the manufactured watermark model and the original model size information under the same directory structure, wherein the watermark model is stored by using a png picture, and the original watermark size information is stored by using a txt file and naming the same as the watermark model picture; 2) loading a watermark model picture of a specified directory, and analyzing corresponding original picture size txt information; 3) graying the watermark model picture, and then loading the grayscale picture copy into a memory.
3. The method according to claim 1, wherein the specific steps of S2 are: 1) acquiring a watermark model and corresponding original image size data according to the plurality of watermark model pictures loaded in the step 1; 2) dividing the width and height of the size of the original image by the width and height of the image to be identified to obtain a corresponding width and height scaling ratio so as to realize scaling equal to the original image;
3) multiplying the calculated width and height scaling ratios by the width and height of the picture to be identified respectively to obtain the final width and height; 4) using opencv and a picture size adjusting function to adjust the size of the picture to be identified: cv2.resize (img, (width, height), interpolation = cv2.inter _ cubc); 5) and graying the zoomed picture.
4. The method according to claim 1, wherein the specific steps of S3 are: 1) acquiring the size of a watermark model, sliding the watermark model on the picture to be identified frame by frame according to the size of the watermark model, moving one pixel on the picture to be identified each time, and moving the pixel from left to right and from top to bottom; 2) at each position, performing measurement calculation once to show the matching degree of the image with the watermark template, namely the hash similarity of the watermark model and the image of the sliding image block of the image to be identified, storing a result value into a result image matrix for the measurement result of each frame-by-frame sliding, and storing a matching metric value, namely the hash similarity at each position (x, y) in the result image matrix; 3) after the sliding is finished, a result image is generated, a result image is found, the point which is the highest and is matched with the watermark model is found, namely, the pixel point with the minimum measurement value is found by scanning frame by frame, and the point is taken as the vertex to obtain the watermark position information according to a result image matrix;
the measurement is calculated in the following way: and when the sliding is performed once, taking the sliding position as a vertex, extracting the width and the height of the watermark model, adding the width of the watermark model to the vertex x position, adding the height of the watermark model to the vertex y position, extracting the color value after the gray scale of the corresponding position, subtracting the x and y pixel points corresponding to the watermark model, squaring, accumulating the sum of all the points to obtain the total difference value of the points x and y, wherein the smaller the total difference value is, the higher the similarity is, and the measurement value calculation formula is as follows:
Figure 591911DEST_PATH_IMAGE001
and x 'and y' represent the pixel point coordinates of the watermark picture model.
5. The method according to claim 4, wherein the specific steps of S5 are as follows: 1) generating a watermark matrix to be removed according to the watermark position coordinates (x, y) output in the step 3; 2) performing pixel-by-pixel sliding in the matrix to be removed, moving one pixel on the matrix to be removed every time, and moving the pixel from left to right and from top to bottom; 3) recording 8 pixel points of the periphery of the sliding position, namely, upper pixel points, lower pixel points, left pixel points, right pixel points, upper right pixel points, lower left pixel points and lower right pixel points; 4) and acquiring rgb color values of the 8 pixel points.
6. The method according to claim 5, wherein 1) the color values of the peripheral 8 points extracted in the fifth step are subjected to equilibrium mean calculation; 2) after obtaining a balance mean value, carrying out pixel filling by using the balance mean value so as to cover the original watermark pixel points;
wherein, the calculation mode of the balance mean value is as follows:
obtaining rgb color values of upper and lower positions of a target pixel point, subtracting the rgb color value at the lower position from the rgb color value at the upper position to obtain a difference value, and then dividing the difference value by 2 to obtain a difference value intermediate value a;
acquiring rgb color values at the left position and the right position, subtracting the rgb color values at the right position from the left position, and dividing by 2 to obtain a middle value b;
then, rgb color values on the left side of the position and the right side of the position are obtained, the rgb color values on the right side of the position are subtracted from the left side of the position, and after the rgb color values are divided by 2, a middle value c is obtained;
then rgb color values of the upper right and the lower left of the position are obtained, the rgb color values of the upper right and the lower left of the position are subtracted from the upper right of the position, and after the rgb color values are divided by 2, a middle value d is obtained;
accumulating the absolute values of the intermediate values abcd, and dividing the accumulated absolute values by 4 to obtain a final intermediate average value;
adding the final intermediate value to the position upper value and the position left value respectively, and accumulating to obtain a new value divided by 2 to obtain a color value to be filled in the target position;
3) the pixel points are filled using the calculated color values described above.
CN202110451530.8A 2021-04-26 2021-04-26 Method for dynamically identifying and removing watermark position of picture Active CN112991137B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110451530.8A CN112991137B (en) 2021-04-26 2021-04-26 Method for dynamically identifying and removing watermark position of picture

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110451530.8A CN112991137B (en) 2021-04-26 2021-04-26 Method for dynamically identifying and removing watermark position of picture

Publications (2)

Publication Number Publication Date
CN112991137A CN112991137A (en) 2021-06-18
CN112991137B true CN112991137B (en) 2021-08-20

Family

ID=76340167

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110451530.8A Active CN112991137B (en) 2021-04-26 2021-04-26 Method for dynamically identifying and removing watermark position of picture

Country Status (1)

Country Link
CN (1) CN112991137B (en)

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105427233A (en) * 2015-12-29 2016-03-23 小米科技有限责任公司 Method and device for removing watermark
CN106934780B (en) * 2017-03-15 2019-11-01 北京思创科泰科技有限公司 A kind of automatic watermark minimizing technology based on image repair
CN108550099B (en) * 2018-04-13 2022-03-01 北京焦点新干线信息技术有限公司 Method and device for removing watermark in image
CN109636710A (en) * 2018-10-16 2019-04-16 平安好房(上海)电子商务有限公司 Automatically remove method, equipment, storage medium and the device of watermark
US10915809B2 (en) * 2019-02-04 2021-02-09 Bank Of America Corporation Neural network image recognition with watermark protection
CN110705126A (en) * 2019-10-24 2020-01-17 南京航空航天大学 Helicopter rotor wing profile determining method and system
CN110782385A (en) * 2019-12-31 2020-02-11 杭州知衣科技有限公司 Image watermark removing method based on deep learning
CN112419132B (en) * 2020-11-05 2024-06-18 广州海外扛把子网络科技有限公司 Video watermark detection method, device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112991137A (en) 2021-06-18

Similar Documents

Publication Publication Date Title
CN111814867B (en) Training method of defect detection model, defect detection method and related device
US9773302B2 (en) Three-dimensional object model tagging
US7941002B2 (en) Apparatus and methods of producing photorealistic image thumbnails
CN111028213A (en) Image defect detection method and device, electronic equipment and storage medium
CN110853015A (en) Aluminum profile defect detection method based on improved Faster-RCNN
CN111476758B (en) Defect detection method and device for AMOLED display screen, computer equipment and storage medium
CN110596120A (en) Glass boundary defect detection method, device, terminal and storage medium
CN112767369A (en) Defect identification and detection method and device for small hardware and computer readable storage medium
CN111325717B (en) Mobile phone defect position identification method and equipment
KR20120024799A (en) Apparatus and method for identifying the creator of a work of art
CN111489322A (en) Method and device for adding sky filter to static picture
CN115082450A (en) Pavement crack detection method and system based on deep learning network
CN111696079A (en) Surface defect detection method based on multi-task learning
CN115862131A (en) Video data screening method for human motion recognition
CN115170552A (en) Image quality evaluation method, device, equipment and storage medium
CN114399505A (en) Detection method and detection device in industrial detection
CN112991137B (en) Method for dynamically identifying and removing watermark position of picture
CN113392819A (en) Batch academic image automatic segmentation and labeling device and method
CN116797602A (en) Surface defect identification method and device for industrial product detection
CN117218633A (en) Article detection method, device, equipment and storage medium
CN116980549A (en) Video frame processing method, device, computer equipment and storage medium
CN116977190A (en) Image processing method, apparatus, device, storage medium, and program product
JP6788929B1 (en) Image processing device and image processing method for determining the test object
CN114782239A (en) Digital watermark adding method and system based on convolutional neural network
CN114581536A (en) Image color difference detection method based on feature perception and multi-channel learning

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