Webpage watermark anti-deletion method, system and device and medium
The method efficiently regenerates or repairs localized watermark deletions in web pages using bright and dark watermarks, optimizing resource use and ensuring timely protection against watermark deletion.
Patent Information
- Application Number
- CN202411172965.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-12-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing watermark deletion methods in web pages are computationally expensive and inefficient, particularly when dealing with partial deletions, leading to resource waste and performance degradation.
A method involving generating bright and dark watermarks, detecting their deletion, and regenerating or repairing only the damaged areas using localized image repair techniques, with cache mechanisms to optimize resource use and adapt repair strategies based on damage assessment.
Reduces computational overhead by regenerating only damaged areas, improves repair efficiency, and ensures timely and consistent watermark protection with reduced resource consumption.
Smart Images

Figure CN119150263A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of watermark anti-deletion, and in particular to a webpage watermark anti-deletion method, system, device and medium. Background Art
[0002] In the digital information age, copyright protection of web page content has become an urgent issue to be resolved. Among traditional copyright protection measures, embedding watermarks is a common and effective means. By embedding visible and hidden watermarks in web page content, effective proof of content copyright can be provided without affecting user experience. However, the presence of watermarks in web pages also faces the risk of being maliciously deleted or tampered with, which seriously weakens the copyright protection ability of watermarks.
[0003] The existing technology often adopts the strategy of regenerating and embedding the watermark after the watermark is deleted. Although this method can restore the existence of the watermark, it has significant disadvantages: first, the overall regeneration and embedding of the watermark is computationally expensive and consumes a lot of resources, especially in the case of large web pages or frequent detection. This problem is particularly prominent; second, for a watermark that is only partially deleted, the overall regeneration is undoubtedly a waste of resources, and may cause performance degradation due to repeated calculations. Summary of the invention
[0004] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention proposes a web page watermark anti-deletion method, system, device and medium.
[0005] In a first aspect, the present application proposes a webpage watermark anti-deletion method, comprising: generating a bright watermark and a dark watermark;
[0006] Embedding the generated bright watermark and dark watermark into the web page respectively;
[0007] Detecting whether the light watermark and the dark watermark in the webpage are deleted;
[0008] If deleted, regenerate or repair the light watermark and the dark watermark, and embed them into the webpage;
[0009] In the repair process, the area to be repaired of the watermark is regenerated.
[0010] More specifically, in the above technical solution, the repair process regenerates the area to be repaired of the watermark, which specifically includes:
[0011] Based on the position and size of the watermark area, the watermarked image is divided into several watermark sub-areas;
[0012] Acquire the watermark feature in the watermark sub-region and generate a feature vector of the watermark;
[0013] Based on the feature vector, obtaining the watermark area and adjacent non-watermark areas from the web page as samples;
[0014] Based on the sample, searching for a patch that is most similar to the edge of the area to be repaired;
[0015] Smoothing the splicing edges of the splicing blocks;
[0016] The splicing block is spliced to the area to be repaired.
[0017] More specifically, in the above technical solution, after splicing, the similarity index between the area to be repaired and the pattern of the watermark is calculated to determine whether the repair effect reaches a preset threshold;
[0018] If the threshold is not reached, the process returns to the step of obtaining the watermark feature, adjusts the parameters for obtaining the watermark feature or expands the sample search range, and performs image repair again.
[0019] More specifically, in the above technical solution, the repair process regenerates the area to be repaired of the watermark, which specifically includes:
[0020] Acquire edge features of the watermark, and determine whether the watermark is collapsed or distorted according to the edge features;
[0021] If it exists, then obtaining texture features of the watermark area, wherein the texture features include energy, contrast and entropy statistics;
[0022] According to the acquired edge features and texture features, a pixel block with the highest texture similarity is selected in the watermark area as a reference block;
[0023] Based on the pixel values of the reference block, performing distance-based inverse weighted interpolation on the pixel values in the watermark area, wherein the weight of the interpolation is inversely proportional to the distance from the pixel value to the edge;
[0024] Performing smoothing on the interpolated watermark area;
[0025] The watermark area after smoothing is subjected to Poisson image editing with the original image to obtain a repaired complete image.
[0026] More specifically, the above technical solution also includes:
[0027] After detecting that the watermark is deleted, a quantitative evaluation is performed on the degree of loss of the watermark to obtain a quantitative result, wherein the quantitative evaluation includes calculating the incomplete proportion and position distribution of the watermark;
[0028] If the quantitative assessment is that the watermark is slightly damaged, repairing the watermark;
[0029] If the quantitative assessment is severe damage, the watermark is regenerated.
[0030] More specifically, the above technical solution also includes:
[0031] Obtaining the grayscale histogram feature of the watermark and constructing a cache index of the watermark;
[0032] Determine the boundary of the area to be repaired, and calculate the grayscale histogram feature vector of the area to be repaired;
[0033] Searching the cache index for a matching item whose Euclidean distance of the grayscale histogram feature vector is less than a preset threshold;
[0034] If a match is found, the corresponding watermark image data is obtained from the cache index for repair.
[0035] More specifically, in the above technical solution, if no matching item is found, the corresponding watermark image data is obtained from the local storage or the network and added to the cache index.
[0036] In a second aspect, the present application also proposes a webpage watermark anti-deletion system, which is characterized by comprising:
[0037] The first processing module: generating bright watermark and dark watermark;
[0038] The second processing module: embeds the generated bright watermark and dark watermark into the web page respectively;
[0039] The third processing module: detecting whether the light watermark and the dark watermark in the webpage are deleted;
[0040] The fourth processing module: if deleted, regenerate or repair the light watermark and the dark watermark, and embed them into the web page;
[0041] In the repair process, the area to be repaired of the watermark is regenerated.
[0042] In a third aspect, the present application further proposes a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the methods described above when executing the computer program.
[0043] In a fourth aspect, the present application further proposes a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method as described in any one of the above items is implemented.
[0044] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0045] 1. The present invention only regenerates the deleted or damaged area to be repaired in the watermark, avoiding the huge computational overhead of regenerating the watermark as a whole and significantly improving the repair efficiency. Compared with the traditional method of regenerating the watermark as a whole, local repair reduces unnecessary waste of computing resources.
[0046] 2. After detecting that the watermark has been deleted, the degree of damage to the watermark is quantitatively evaluated by calculating the incomplete proportion and position distribution of the watermark, and different repair strategies are adopted according to the evaluation results; for slightly damaged watermarks, local repairs are performed, and for severely damaged watermarks, they are regenerated, which improves the pertinence and effectiveness of the repair.
[0047] 3. A cache mechanism is introduced to cache commonly used watermark images, feature values and other data in memory or local storage, avoiding repeated calculations and network transmission, significantly improving the patching speed and reducing resource consumption; the cache index construction and update strategy ensures the timeliness and consistency of the cached data.
[0048] 4. To solve the collapse or distortion problem in the watermark area, image repair technology is used for reconstruction and smoothing. By analyzing the edge features and texture information and using the surrounding pixel values for interpolation and repair, the repaired watermark area is naturally integrated with the background, thus improving the visual effect of the repair. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0050] Figure 1 It is a flow chart of a webpage watermark anti-deletion method provided by one embodiment of the present invention;
[0051] Figure 2 It is a structural schematic diagram of a webpage watermark anti-deletion system provided by an embodiment of the present invention;
[0052] Figure 3 It is a schematic diagram of the structure of the terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0054] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0055] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0056] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0057] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0058] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0059] See also Figure 1The present application proposes a webpage watermark anti-deletion method, comprising: S101, generating a light watermark and a dark watermark; S102, embedding the generated light watermark and the dark watermark into a webpage respectively; S103, detecting whether the light watermark and the dark watermark in the webpage are deleted; S104, if deleted, regenerating or repairing the light watermark and the dark watermark, and embedding them into the webpage; wherein, during the repairing process, the area to be repaired of the watermark is regenerated.
[0060] Optionally, the method includes: obtaining the content of the web page to be embedded with a watermark; using a text analysis tool to extract the keywords and themes of the web page; using a hash function to generate a light watermark and a dark watermark based on the extracted key information, wherein the light watermark is in the form of visible text, and the dark watermark is in the form of changing the text spacing; analyzing the structure of the web page to determine a suitable position for embedding the watermark, embedding the light watermark into the bottom or side of the web page, and embedding the dark watermark into the body paragraph; recording the position information of the watermark, and generating a web page carrying the watermark; scanning the web page carrying the watermark at preset time intervals; using image recognition technology to detect the watermarked web page; Describe whether a watermark exists, and detect whether the dark watermark exists by analyzing the text spacing; if no watermark is detected, determine the position and type of the deleted watermark; for the deleted watermark, regenerate a new watermark using a generation algorithm different from the original watermark, and embed the newly generated watermark into the original watermark position; detect whether the web page content has changed, and if the content has changed, re-extract key information and update the watermark, and only update the watermark of the changed part; record the historical information of watermark repair and update, analyze the law of watermark deletion based on the historical information, continuously improve the watermark generation and embedding algorithm, and improve the robustness and concealment of the watermark by dynamically adjusting the watermark strategy.
[0061] Exemplarily, the webpage content to be embedded with watermark is first obtained by web crawler technology, and then the natural language processing technology is used to analyze the webpage content, extract keywords, themes and other features, and generate a 64-bit bright watermark and a 128-bit dark watermark based on these features using a digital watermark algorithm. Then the bright watermark is embedded in a prominent position of the webpage, such as the text paragraph, and the dark watermark is embedded in a hidden position of the webpage, such as an HTML comment, to form a webpage carrying a watermark. In order to detect whether the watermark has been deleted, the system performs an integrity test on the webpage every 30 minutes, and uses a similarity algorithm to determine whether the watermark has been deleted by comparing the difference between the current webpage and the original webpage carrying the watermark. If it is detected that the bright watermark or the dark watermark is missing, the position and type of the deleted watermark are determined by difference comparison. According to the position and type of the deleted watermark, the digital watermark algorithm is re-called to generate a bright watermark or dark watermark consistent with the original watermark, and it is embedded in the original watermark position of the webpage, and the watermark is restored by fixed-point repair.
[0062] What is important is that the area to be repaired of the watermark is regenerated during the repair process, which avoids repeated calculation and transmission of the entire watermark and greatly reduces system overhead. Through the dynamic generation and automatic repair of watermarks, the copyright of web page content is effectively protected, preventing the content from being illegally copied and tampered with, while improving the system's operating efficiency and real-time performance.
[0063] In some embodiments, after detecting that the watermark has been deleted, the repair process needs to quantify the degree of watermark loss. The degree of watermark damage can be quantified by calculating indicators such as the incomplete proportion and position distribution of the watermark. According to the quantification results, the system can adopt different repair strategies. For slightly damaged watermarks, local repair can be performed; for severely damaged watermarks, comprehensive regeneration and embedding are required. Quantitative evaluation can help optimize the repair process and improve the efficiency and accuracy of repair.
[0064] The original watermark image and the image after the watermark is deleted are obtained, and the image difference function in the OpenCV library is used to calculate the pixel difference between the two images to obtain the watermark incomplete image.
[0065] The watermark defective image is binarized, the preset threshold is set to 128, the pixel values greater than the threshold are set to 255, and the pixel values less than the threshold are set to 0, and a binary watermark defective image is obtained.
[0066] Through the connected region analysis function of OpenCV, the number and distribution of white areas in the binary watermark defect image are counted to obtain the distribution of watermark defect positions.
[0067] If the watermark is slightly damaged, the image repair method based on OpenCV is used for local repair. According to the damaged position of the watermark, the watermark information of the corresponding area is extracted from the original watermark image.
[0068] If the watermark damage is severe, the pi x2pix model based on TensorFlow is used to regenerate the watermark image. The original watermark image and the severely damaged watermark image are used as training data to train the pi x2pix model.
[0069] The repaired watermark image or the regenerated watermark image is weightedly fused with the original carrier image using the addWeighted function of OpenCV, and the weight of the watermark image is set to 0.2 and the weight of the carrier image is set to 0.8 to obtain the carrier image embedded with the repaired watermark.
[0070] Exemplarily, first, feature points of the original watermark image and the image after the watermark is deleted are extracted through image processing algorithms such as SI FT and SURF, and the number of feature point matches of the two images is calculated. If the number of matches is less than 20% of the total number of feature points, it is considered that the watermark is incomplete. At the same time, the position distribution of the incomplete watermark area is statistically calculated, and the center coordinates and radius of the incomplete area are calculated. If the radius is greater than 30% of the watermark image size, it is considered that the incomplete position distribution is dispersed. The degree of watermark damage is judged according to the above two indicators, and the threshold of the incomplete ratio is set to 20%, and the threshold of the position dispersion radius is set to 30%. For slightly damaged watermarks, a local repair strategy is adopted. The Poisson image editing algorithm is used to extract pixel information around the incomplete area from the original watermark image, and the incomplete area is filled and repaired to ensure that the repaired area is consistent with the surrounding watermark texture. For severely damaged watermarks, the generative adversarial network (GAN) algorithm is used to regenerate, and the original watermark image is used as a training sample to construct a generator and discriminator network. The generator parameters are continuously optimized through adversarial training, and finally an image similar to the original watermark is generated. The generator adopts U-Net structure, the discriminator adopts PatchGAN structure, and the number of training iterations is 5000. The watermark information is embedded into the frequency domain coefficients of the original carrier image using the frequency domain watermark embedding algorithm, such as DCT transform domain embedding, DWT transform domain embedding, etc., for the repaired watermark image or the regenerated watermark image. The embedding strength is set to 10% of the frequency domain coefficient to ensure that the watermark embedding is imperceptible. When evaluating the repair effect, the PSNR and SSIM indicators of the repaired watermark image and the original watermark image are calculated. The PSNR reflects the pixel difference between the two images, and the SSIM reflects the structural similarity. The PSNR threshold is set to 35dB and the SSIM threshold is set to 9. If the index is lower than the threshold, return to step 4 to adjust the GAN network structure and parameters, such as increasing the network depth, adjusting the learning rate, etc., and retrain the generated watermark image until the similarity requirements are met. Finally, the carrier image embedded with the repaired watermark and the PSNR and SSIM indicators are output to complete the watermark repair. The local repair or global reconstruction strategy is adaptively selected through iterative optimization to ensure the accuracy and efficiency of watermark repair.
[0071] In some embodiments, during the process of repairing the watermark, the original watermark image may be frequently accessed or the characteristic value of the watermark may be repeatedly calculated, resulting in reduced repair efficiency. In order to optimize the repair performance, a cache mechanism can be introduced to cache commonly used watermark images, characteristic values and other data in memory or local storage to avoid repeated calculations and network transmission. The cache mechanism can significantly increase the speed of repair and reduce resource consumption. At the same time, it is also necessary to design a suitable cache update strategy to ensure the timeliness and consistency of cached data.
[0072] The grayscale histogram feature of the watermark image is obtained, and a watermark image cache index is established in the memory using a hash table structure, wherein the key of the hash table is the feature vector and the value is the watermark image data.
[0073] For the watermark to be repaired, a rectangular boundary of the area to be repaired is determined, and a grayscale histogram feature vector of the area to be repaired is calculated.
[0074] Search the watermark image cache index for a matching item whose Euclidean distance with the feature vector of the area to be repaired is less than a preset threshold.
[0075] If a match is found in the watermark image cache index, the corresponding watermark image data is obtained from the memory cache for repair; if no match is found, the corresponding watermark image data is obtained from the local storage or network and added to the memory cache.
[0076] Optionally, a heap-based priority queue is maintained in the memory cache, and a priority score is calculated according to the usage frequency and the most recent access timestamp of the watermark image, and the watermark image with a score lower than a preset threshold is eliminated from the memory cache.
[0077] Optionally, the producer-consumer model is used to implement multi-threaded parallel processing. The first thread is responsible for repairing the watermark and putting the repair request into the shared queue, and the second thread is responsible for taking the request from the shared queue and asynchronously updating the memory cache. Capture and log abnormal situations such as network connection interruption and insufficient disk space to ensure stable operation of the system.
[0078] Exemplarily, in the feature extraction process of the watermark image, a texture feature extraction algorithm based on local binary pattern (LBP) can be used. The algorithm first divides the watermark image into multiple 8x8 small blocks, and then compares each pixel and its surrounding 8 pixels to obtain an 8-bit binary code. The LBP codes of all small blocks are combined to form a 256-dimensional feature vector as the feature value of the watermark image. A hash table is established in the memory as a watermark image cache index, with the feature vector as the key and the watermark image data as the value. When the watermark needs to be repaired, the LBP feature vector of the area to be repaired is first extracted, and then searched in the hash table. If a matching feature vector is found, the corresponding watermark image data is directly obtained from the memory cache for repair. If no match is found, the corresponding watermark image data is obtained from the local storage or network and added to the memory cache. A minimum heap is maintained in the memory cache as a priority queue, and the elements in the heap include the usage frequency and timestamp of the watermark image. Each time the watermark image is accessed, its usage frequency is increased by 1 and the timestamp is updated. When the memory cache reaches the set maximum capacity, the low-priority watermark image at the top of the stack is eliminated. Set a scheduled task to scan the local storage and network every hour and synchronize the newly added or modified watermark images to the memory cache. The producer-consumer model is used to implement multi-threaded parallel processing. The main thread, as a producer, is responsible for receiving requests to repair watermarks and putting tasks into a blocking queue. The worker thread, as a consumer, obtains tasks from the blocking queue and processes them. Another background thread is responsible for asynchronously updating the memory cache, regularly obtaining update tasks from the blocking queue and executing them. In this way, the parallel processing capabilities of multi-core CPUs can be fully utilized to improve the efficiency of watermark repair.
[0079] In some embodiments, the repair process regenerates the area to be repaired of the watermark, specifically including:
[0080] Based on the position and size of the watermark area, the watermarked image is divided into several watermark sub-areas, the watermark features in the watermark sub-areas are obtained, the feature vectors of the watermark are formed, and similar feature vectors are grouped together; based on each group of feature vectors, the watermark area and the adjacent non-watermark area are obtained from the web page as samples, the splicing block that is most similar to the edge of the area to be repaired is searched, and the splicing block is spliced to the area to be repaired; the splicing edges of the splicing blocks are smoothed.
[0081] According to the position and size of the watermark area, the image is divided into multiple sub-areas. For each sub-area, the color histogram, grayscale co-occurrence matrix and Sobel edge features are extracted to form a watermark feature vector. The feature vectors are clustered using the K-means algorithm, and similar features are grouped together. For each group of features, a sample-based texture synthesis method is used to select a non-watermark area adjacent to the watermark area from the original image as a sample, and a sliding window is used to search for the texture block that is most similar to the edge of the area to be repaired in the sample area. The texture block found is spliced to the area to be repaired using the least squares method. The Poisson image editing algorithm is used to smooth the spliced edges to eliminate visible seams.
[0082] After stitching, the similarity index between the area to be repaired and the watermark pattern is calculated to determine whether the repair effect reaches a preset threshold; if the threshold is not reached, return to the step of obtaining the watermark feature, adjust the parameters for obtaining the watermark feature or expand the sample search range, and re-repair the image.
[0083] For example, according to the position and size of the watermark area, the watermark repair task is divided into multiple subtasks using image segmentation algorithms such as region growing method. The size of each subtask is controlled at about 64x64 pixels and assigned to different processing threads. For each subtask, the color histogram, LBP texture features and Canny edge features of the area are extracted to form a 72-dimensional feature vector. The feature vector is divided into three categories by K-means clustering algorithm, corresponding to three typical texture features of pure color, texture and edge. For the pure color class, the average color value of the area is directly calculated as the filling color; for the texture class, the most similar texture block is searched within the range of 80x80 pixels around the subtask area in the original image, and multiple texture blocks are fused by weighted average to form a repair texture; for the edge class, the edge contour of the subtask area is extracted, and similar contours are searched in the original image for repair, and Poisson fusion is used to eliminate the splicing traces. Finally, the SSIM index is used to evaluate the structural similarity between the repair area and the original image. If the SSIM value is lower than 85, it returns to re-extract features and texture synthesis, and the repair effect is improved through iterative optimization until the SSIM value exceeds 9. After many iterations, the watermark area is seamlessly integrated with the surrounding background, and the quality of the entire image is improved and enhanced.
[0084] In the process of repairing watermarks, the watermark area may collapse or distort, which will affect the repair quality. To solve this problem, image repair technology can be used to reconstruct and smooth the watermark area. By analyzing the edge features and texture information of the watermark area, the surrounding pixel values are used for interpolation and repair, so that the repaired watermark area blends naturally with the surrounding background. Collapse repair can improve the visual effect of the repair and reduce the impact of watermark incompleteness.
[0085] In some embodiments, a watermark image to be repaired is obtained, and an image segmentation algorithm is used to determine the position and range of the watermark area. For the watermark area obtained by segmentation, the Canny edge detection algorithm is used to extract the edge features of the watermark area. According to the extracted edge features, it is determined whether the watermark area has collapse or distortion. If there is collapse or distortion, the gray level co-occurrence matrix method is used to obtain the texture features of the watermark area, and the texture features include energy, contrast and entropy statistics. According to the acquired edge features and texture features, a pixel block with the highest texture similarity is selected around the watermark area as a reference block. Using the reference block pixel value, the pixels in the watermark area are subjected to distance-based inverse weighted interpolation, and the interpolation weight is inversely proportional to the distance from the pixel to the edge. The interpolated watermark area is smoothed by bilateral filtering, and the smoothed watermark area and the original image are subjected to Poisson image editing to obtain a repaired complete image.
[0086] Exemplarily, firstly, the pixel coordinate range of the watermark area is determined by an image segmentation algorithm such as the region growing method or the threshold segmentation method, such as (100, 200) to (400, 500). Then, the Canny operator is used to detect the edge of the watermark area and extract the gradient direction histogram features of the edge pixels. According to the edge continuity and curvature distribution, it is judged whether the watermark area has collapse or distortion. If it exists, the Gabor wavelet texture features are further extracted from the watermark area to obtain texture attribute values such as energy and uniformity. Then, with the watermark area as the center, a pixel block of size 50x50 is selected around it as a reference block. The pixels in the watermark area are interpolated by inverse distance weighted using the RGB mean of the reference block. During interpolation, the weight of the pixels close to the edge is set to 8, and the weight of the pixels far from the edge is set to 2. After repairing, the watermark area is smoothed with a 5x5 Gaussian kernel to eliminate the interpolation traces. Finally, the repaired watermark area is seamlessly spliced with the original image, and the brightness and color of the two areas are adjusted by the Poisson fusion algorithm to obtain the final repair result. When evaluating the repair effect, the PSNR peak signal-to-noise ratio and SSIM structural similarity between the watermark area and the surrounding background can be calculated. If they are less than 30dB and 8, repeat the above steps until the requirements are met.
[0087] In some embodiments, an original image to be watermarked is obtained, and an image segmentation algorithm is used to determine the position and range of the watermark area to obtain a binary mask image of the watermark area; based on the binary mask image, the original image is segmented into a watermark area and a non-watermark area, and the non-watermark area is used as a background image; image gradients are calculated for the watermark area and the background area respectively, and the gradients in the x and y directions are calculated using the Sobel operator; at the boundary of the watermark area, the gradient field of the watermark area is reconstructed using the Poisson equation based on the gradient information of the background area, and the pixel values of the watermark area are reconstructed by solving the Poisson equation to obtain a preliminary repaired image; for the preliminary repaired image, a sample-based texture synthesis algorithm is used, and the background area is used as a sample to perform texture reconstruction on the preliminary repaired watermark area to obtain a texture-synthesized image; the texture-synthesized image is post-processed, and a guided filtering algorithm is used to eliminate boundary traces of the repaired area to obtain a final watermark-free image.
[0088] Exemplarily, firstly, an image to be watermarked is obtained, and the position and range of the watermark area are determined by an image segmentation algorithm such as a region growing method, so as to obtain a binary watermark area mask image. Then, according to the watermark area mask, the original image is segmented into two parts, a watermark area and a non-watermark area, by using threshold segmentation, and the non-watermark area is used as the background image. Then, the gradient difference between the watermark area and the background area is calculated, and the horizontal and vertical gradients of the image are calculated using the Sobel operator to construct the gradient domain of the watermark area. At the boundary of the watermark area, the gradient domain of the watermark area is reconstructed using the Poisson equation according to the gradient information of the background area. By iteratively solving the Poisson equation, the watermark area and the background area are smoothly transitioned in the gradient domain. The number of iterations is set to 500 times, and the convergence threshold is 0.01. By solving the Poisson equation, the pixel values of the watermark area are reconstructed to obtain a preliminary repaired image, which achieves a smooth transition between the watermark area and the background area. Then, the texture synthesis algorithm based on Efros and Leung is used, and the texture features of the background area are used as samples. Texture synthesis is performed in the watermark area with a window size of 9×9, so that the repaired watermark area is harmonious with the surrounding background in texture. Finally, the repaired image is post-processed, and bilateral filtering is used to eliminate the boundary traces of the repaired area. The standard deviation of the spatial domain is set to 3, and the standard deviation of the value domain is set to 1, and the final watermark-free image is obtained. The entire watermark removal process makes full use of the gradient information and texture features of the image. Through Poisson image editing and texture synthesis technology, the natural repair of the watermark area is achieved, with a smooth transition and harmonious texture with the surrounding background, effectively removing the visual impact of the watermark.
[0089] See also Figure 2 , the present application also proposes a webpage watermark anti-deletion system, comprising:
[0090] First processing module 201: generating a bright watermark and a dark watermark;
[0091] The second processing module 202: embedding the generated bright watermark and dark watermark into the web page respectively;
[0092] The third processing module 203: detecting whether the light watermark and the dark watermark in the webpage are deleted;
[0093] Fourth processing module 204: if deleted, regenerate or repair the light watermark and the dark watermark, and embed them into the webpage;
[0094] In the repair process, the area to be repaired of the watermark is regenerated.
[0095] It is understandable that if Figure 1 The contents of the webpage watermark anti-deletion method embodiment shown in the figure are all applicable to the webpage watermark anti-deletion system embodiment. The functions specifically implemented by the webpage watermark anti-deletion system embodiment are similar to those in the embodiment shown in the figure. Figure 1 The webpage watermark anti-deletion method embodiment shown is the same as that shown in the embodiment, and the beneficial effects achieved are the same as those of the embodiment shown in the embodiment. Figure 1 The beneficial effects achieved by the web page watermark anti-deletion method embodiment shown are also the same.
[0096] It should be noted that the information interaction, execution process and other contents between the above-mentioned systems are based on the same concept as the embodiment of the method of the present invention. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0097] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the system can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0098] See also Figure 3The embodiment of the present invention further provides a computer device 3, comprising: a memory 302 and a processor 301 and a computer program 303 stored in the memory 302. When the computer program 303 is executed on the processor 301, a web page watermark anti-deletion method as described in any one of the above methods is implemented.
[0099] The computer device 3 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The computer device 3 may include, but is not limited to, a processor 301 and a memory 302. Those skilled in the art will appreciate that Figure 3 It is only an example of computer device 3 and does not constitute a limitation on computer device 3. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.
[0100] The processor 301 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0101] In some embodiments, the memory 302 may be an internal storage unit of the computer device 3, such as a hard disk or memory of the computer device 3. In other embodiments, the memory 302 may also be an external storage device of the computer device 3, such as a plug-in hard disk, a smart memory card (Smart Med iaCard, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 3. Further, the memory 302 may also include both an internal storage unit of the computer device 3 and an external storage device. The memory 302 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory 302 may also be used to temporarily store data that has been output or is to be output.
[0102] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the web page watermark anti-deletion method as described in any one of the above methods is implemented.
[0103] In this embodiment, if the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0104] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A webpage watermark anti-deletion method, characterized in that: include: Generate bright watermark and dark watermark; Embedding the generated bright watermark and dark watermark into the web page respectively; Detecting whether the light watermark and the dark watermark in the webpage are deleted; If deleted, regenerate or repair the light watermark and the dark watermark, and embed them into the webpage; In the repair process, the area to be repaired of the watermark is regenerated.
2. The webpage watermark anti-deletion method according to claim 1, characterized in that: The repair process regenerates the area to be repaired of the watermark, which specifically includes: Based on the position and size of the watermark area, the watermarked image is divided into several watermark sub-areas; Acquire the watermark feature in the watermark sub-region and generate a feature vector of the watermark; Based on the feature vector, the watermark area and the adjacent non-watermark area are obtained from the web page as samples; Based on the sample, searching for a patch that is most similar to the edge of the area to be repaired; Smoothing the splicing edges of the splicing blocks; The splicing block is spliced to the area to be repaired.
3. The webpage watermark anti-deletion method according to claim 2, characterized in that: After splicing, the similarity index between the area to be repaired and the watermark pattern is calculated to determine whether the repair effect reaches a preset threshold; If the threshold is not reached, the process returns to the step of obtaining the watermark feature, adjusts the parameters for obtaining the watermark feature or expands the sample search range, and performs image repair again.
4. The webpage watermark anti-deletion method according to claim 1, characterized in that: The repair process regenerates the area to be repaired of the watermark, which specifically includes: Acquire edge features of the watermark, and determine whether the watermark is collapsed or distorted according to the edge features; If it exists, then obtaining texture features of the watermark area, wherein the texture features include energy, contrast and entropy statistics; According to the acquired edge features and texture features, a pixel block with the highest texture similarity is selected in the watermark area as a reference block; Based on the pixel values of the reference block, performing distance-based inverse weighted interpolation on the pixel values in the watermark area, wherein the weight of the interpolation is inversely proportional to the distance from the pixel value to the edge; Performing smoothing on the interpolated watermark area; The watermark area after smoothing is subjected to Poisson image editing with the original image to obtain a repaired complete image.
5. The webpage watermark anti-deletion method according to claim 1, characterized in that: Also includes: After detecting that the watermark is deleted, a quantitative evaluation is performed on the degree of loss of the watermark to obtain a quantitative result, wherein the quantitative evaluation includes calculating the incomplete proportion and position distribution of the watermark; If the quantitative assessment is that the watermark is slightly damaged, repairing the watermark; If the quantitative assessment is severe damage, the watermark is regenerated.
6. The webpage watermark anti-deletion method according to claim 1, characterized in that: Also includes: Obtaining the grayscale histogram feature of the watermark and constructing a cache index of the watermark; Determine the boundary of the area to be repaired, and calculate the grayscale histogram feature vector of the area to be repaired; Searching the cache index for a matching item whose Euclidean distance of the grayscale histogram feature vector is less than a preset threshold; If a match is found, the corresponding watermark image data is obtained from the cache index for repair.
7. The webpage watermark anti-deletion method according to claim 6, characterized in that: If no match is found, the corresponding watermark image data is obtained from the local storage or the network and added to the cache index.
8. A webpage watermark anti-deletion system, characterized in that: include: The first processing module: generating bright watermark and dark watermark; The second processing module: embeds the generated bright watermark and dark watermark into the web page respectively; The third processing module: detecting whether the light watermark and the dark watermark in the webpage are deleted; The fourth processing module: if deleted, regenerate or repair the light watermark and the dark watermark, and embed them into the web page; In the repair process, the area to be repaired of the watermark is regenerated.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
MODIS image data incompleteness repairing method
CN106504210A
Webpage watermark tamper-proofing method and device, medium and electronic equipment
CN110909320A
Video watermark processing method and system, electronic device and storage medium
CN113947513A
Non-intrusive secure communication and access control system and use method thereof
CN115065535A
Warehouse-in and warehouse-out information acquisition method and system
CN118229588A
