Watermark extraction method and device, computer equipment, storage medium and product
By extracting candidate regions and text-occluded regions from webpage screenshots, determining the target scaling ratio and matching coordinates, and constructing a reference image for watermark extraction, the problem of watermark occlusion in webpage screenshots is solved, and complete watermark extraction is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- PEKING UNIV
- Filing Date
- 2026-02-12
- Publication Date
- 2026-05-29
AI Technical Summary
Because a large amount of foreground content in the image captured from the webpage covers the background watermark, it is impossible to effectively obtain the digital watermark.
The process involves first image extraction from a webpage crop to obtain candidate region images, followed by second image extraction to remove text occlusion. The target scaling ratio and matching coordinates of the clean region image are then determined, and a reference image is constructed for watermark extraction.
It effectively avoids text and components obscuring the watermark, ensuring the complete acquisition of the watermark and enabling accurate watermark extraction during the screenshot process.
Smart Images

Figure CN122115185A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of information security and digital image technology, and in particular to a watermark extraction method, apparatus, computer equipment, storage medium and product. Background Technology
[0002] In web page data leakage prevention and tracing, digital watermarks are usually embedded in the background image of the web page. The digital watermark contains the information of the currently logged-in user. If the user takes a screenshot and spreads it, the user can be traced back from the web page background in the screenshot.
[0003] However, since images captured from web pages often contain a lot of foreground content (such as text, tables, and buttons), this content covers the image background watermark and destroys the integrity of the watermark content, thus making it impossible to successfully obtain a valid watermark. Summary of the Invention
[0004] Therefore, it is necessary to provide a watermark extraction method, apparatus, computer equipment, storage medium, and product that can effectively obtain watermarks, addressing the aforementioned technical problems.
[0005] Firstly, this application provides a watermark extraction method. The method includes:
[0006] The first image extraction is performed on the captured image from the webpage to obtain a candidate region image containing the watermark to be extracted;
[0007] A second image extraction is performed on the captured image of the webpage to obtain a clean area image without text obstruction;
[0008] Determine the target scaling ratio of the clean area image relative to the original base image, and determine the matching coordinates of the clean area image in the original base image; wherein, the original base image is the image of the webpage background corresponding to the webpage cropped image;
[0009] Watermark extraction is performed based on the target scaling ratio, the matching coordinates, and the candidate region image to obtain the watermark to be extracted corresponding to the webpage cropped image.
[0010] In one embodiment, the step of extracting the watermark based on the target scaling ratio, the matching coordinates, and the candidate region image to obtain the watermark to be extracted corresponding to the webpage crop image includes:
[0011] Based on the target scaling ratio, the matching coordinates, and the candidate region image, an image is constructed to obtain a target image containing the candidate region image;
[0012] Watermark extraction is performed on the target image to obtain the watermark to be extracted corresponding to the webpage cropped image.
[0013] In one embodiment, the step of constructing an image based on the target scaling ratio, the matching coordinates, and the candidate region image to obtain a target image containing the candidate region image includes:
[0014] Construct a reference image; wherein the image size of the reference image is the same as the image size of the original background image of the webpage corresponding to the webpage screenshot image;
[0015] The candidate region image is mapped onto the reference image based on the target scaling ratio and the matching coordinates to obtain a target image containing the candidate region image.
[0016] In one embodiment, the step of mapping the candidate region image onto a reference image according to the target scaling ratio and the matching coordinates to obtain a target image containing the candidate region image includes:
[0017] Determine the relative offset of the clean area image with respect to the cropped image of the webpage;
[0018] Based on the target scaling ratio, the matching coordinates, and the relative offset, the candidate region image is mapped onto the reference image to obtain a target image containing the candidate region image.
[0019] In one embodiment, determining the target scaling ratio of the clean area image relative to the original base image includes:
[0020] At least one first scaling factor is filtered by a first scaling factor to obtain candidate scaling factors corresponding to the clean region image;
[0021] The candidate scaling ratios are divided proportionally to obtain at least one second scaling ratio;
[0022] The second scaling factor is filtered by a second scaling factor to obtain the target scaling factor of the clean area image relative to the original base image.
[0023] In one embodiment, the step of performing a first scaling factor selection on at least one first scaling factor to obtain candidate scaling factors corresponding to the clean region image includes:
[0024] Based on the clean area image and the original base image, determine the normalized cross-correlation coefficient corresponding to each of the first scaling ratios;
[0025] The first scaling factor with the largest normalized cross-correlation coefficient is selected as the candidate scaling factor.
[0026] In one embodiment, the second image extraction of the captured webpage image to obtain a clean area image without text obstruction includes:
[0027] The captured webpage image is converted to HSV space to obtain a webpage image in HSV space;
[0028] Based on the average brightness of the webpage cropped image in HSV space, determine the text occlusion area contained in the webpage cropped image;
[0029] Generate a binary mask corresponding to the text occlusion area;
[0030] Based on the binary mask, and according to the monotonic stack algorithm, the clean area image without text obstruction in the webpage crop image is determined.
[0031] Secondly, this application also provides a watermark extraction device. The device includes:
[0032] The first extraction module is used to perform first image extraction on the webpage cropped image to obtain a candidate region image containing the watermark to be extracted;
[0033] The second extraction module is used to perform a second image extraction on the captured image of the webpage to obtain a clean area image without text obstruction;
[0034] The determining module is used to determine the target scaling ratio of the clean area image relative to the original base image, and to determine the matching coordinates of the clean area image in the original base image; wherein, the original base image is the image of the webpage background corresponding to the webpage cropped image;
[0035] Watermark extraction is performed based on the target scaling ratio, the matching coordinates, and the candidate region image to obtain the watermark to be extracted corresponding to the webpage cropped image.
[0036] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0037] The first image extraction is performed on the captured image from the webpage to obtain a candidate region image containing the watermark to be extracted;
[0038] A second image extraction is performed on the captured image of the webpage to obtain a clean area image without text obstruction;
[0039] Determine the target scaling ratio of the clean area image relative to the original base image, and determine the matching coordinates of the clean area image in the original base image; wherein, the original base image is the image of the webpage background corresponding to the webpage cropped image;
[0040] Watermark extraction is performed based on the target scaling ratio, the matching coordinates, and the candidate region image to obtain the watermark to be extracted corresponding to the webpage cropped image.
[0041] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0042] The first image extraction is performed on the captured image from the webpage to obtain a candidate region image containing the watermark to be extracted;
[0043] A second image extraction is performed on the captured image of the webpage to obtain a clean area image without text obstruction;
[0044] Determine the target scaling ratio of the clean area image relative to the original base image, and determine the matching coordinates of the clean area image in the original base image; wherein, the original base image is the image of the webpage background corresponding to the webpage cropped image;
[0045] Watermark extraction is performed based on the target scaling ratio, the matching coordinates, and the candidate region image to obtain the watermark to be extracted corresponding to the webpage cropped image.
[0046] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0047] The first image extraction is performed on the captured image from the webpage to obtain a candidate region image containing the watermark to be extracted;
[0048] A second image extraction is performed on the captured image of the webpage to obtain a clean area image without text obstruction;
[0049] Determine the target scaling ratio of the clean area image relative to the original base image, and determine the matching coordinates of the clean area image in the original base image; wherein, the original base image is the image of the webpage background corresponding to the webpage cropped image;
[0050] Watermark extraction is performed based on the target scaling ratio, the matching coordinates, and the candidate region image to obtain the watermark to be extracted corresponding to the webpage cropped image.
[0051] The aforementioned watermark extraction method, apparatus, computer equipment, storage medium, and product perform a first image extraction on a webpage crop image to obtain a candidate region image containing the watermark to be extracted; and a second image extraction on the webpage crop image to obtain a clean region image without text occlusion; thereby determining the target scaling ratio of the clean region image relative to the original background image, and determining the matching coordinates of the clean region image in the original background image; and then, extracting the watermark based on the target scaling ratio, matching coordinates, and candidate region image to obtain the watermark to be extracted corresponding to the webpage crop image. As can be seen from the above, this application, when performing watermark extraction, avoids occlusion and damage to the watermark to be extracted by text and components in the webpage crop image by obtaining a clean region image. Determining the target scaling ratio and matching coordinates based on the clean region image ensures that the ratio of the webpage crop image relative to the original background image of the corresponding webpage during the cropping process is effectively determined based on the target scaling ratio, and the cropping position of the webpage crop image in the original background image is effectively determined based on the matching coordinates. This ensures that the complete watermark to be extracted is effectively obtained when performing watermark extraction based on the target scaling ratio, matching coordinates, and candidate region image. Attached Figure Description
[0052] Figure 1 An application environment diagram of a watermark extraction method provided in this application embodiment;
[0053] Figure 2 A flowchart illustrating the first watermark extraction method provided in this application embodiment;
[0054] Figure 3 A flowchart illustrating the second watermark extraction method provided in this application embodiment;
[0055] Figure 4 A flowchart illustrating the third watermark extraction method provided in this application embodiment;
[0056] Figure 5 A flowchart illustrating the fourth watermark extraction method provided in this application embodiment;
[0057] Figure 6 A structural block diagram of a watermark extraction device provided in an embodiment of this application;
[0058] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0060] The watermark extraction method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or placed on a cloud or other network server. The process involves: first image extraction from a captured webpage image to obtain a candidate region image containing the watermark to be extracted; second image extraction from the captured webpage image to obtain a clean region image without text occlusion; determining the target scaling ratio of the clean region image relative to the original background image, and determining the matching coordinates of the clean region image in the original background image; then, watermark extraction based on the target scaling ratio, matching coordinates, and candidate region image to obtain the watermark to be extracted corresponding to the captured webpage image. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster composed of multiple servers.
[0061] In one embodiment, such as Figure 2 As shown, a watermark extraction method is provided, which can be applied to... Figure 1 Taking server 104 as an example, the following steps are included:
[0062] S201, perform first image extraction on the webpage cropped image to obtain a candidate region image containing the watermark to be extracted.
[0063] Among them, the candidate region image refers to the image containing the region of the webpage crop image that contains the watermark to be extracted.
[0064] It should be noted that the first image extraction refers to extracting the area containing the watermark to be extracted from the webpage screenshot image; specifically, the first image extraction can include rectangular selection extraction and freehand brush extraction.
[0065] In one embodiment of this application, when it is necessary to perform a first image extraction on a webpage crop image to obtain a candidate region image containing the watermark to be extracted, the following may be included: selecting the region containing the watermark to be extracted in the webpage crop image by using a rectangular frame to obtain a candidate region image containing the watermark to be extracted.
[0066] The size and position of the rectangle can be adjusted manually to ensure the accuracy of the candidate region image selection.
[0067] In another embodiment of this application, when it is necessary to perform a first image extraction on a webpage crop image to obtain a candidate region image containing the watermark to be extracted, the following may also be included: manually smearing a clean area of arbitrary shape (such as the gap between text paragraphs) in the webpage crop image to achieve the first image extraction and obtain a candidate region image containing the watermark to be extracted.
[0068] Specifically, the minimum bounding rectangle of the smeared area can be extracted using the Alpha channel mask, thereby enabling the acquisition of candidate region images containing the watermark to be extracted.
[0069] S202, perform a second image extraction on the captured image from the webpage to obtain a clean area image without text obscuring it.
[0070] It should be noted that the second image extraction refers to extracting the regions in a webpage crop image that are not obscured by text. Therefore, when it is necessary to perform second image extraction on a webpage crop image, the text and background regions of the webpage crop image can be identified in advance, and then the second image extraction can be performed to obtain a clean image of the region without text obscuration.
[0071] To further explain, when it is necessary to perform a second image extraction on a webpage crop image to obtain a clean area image without text occlusion, the following steps may be included: converting the webpage crop image to HSV space to obtain a webpage crop image in HSV space; determining the text occlusion area contained in the webpage crop image based on the average brightness value of the webpage crop image in HSV space; generating a binary mask corresponding to the text occlusion area; and determining the clean area image without text occlusion in the webpage crop image based on the binary mask and the monotonic stack algorithm.
[0072] Specifically, if the average brightness is higher than the preset threshold (light background), low-brightness pixels are extracted as text occlusion areas; if the average brightness is lower than the preset threshold (dark background), high-brightness pixels are extracted as text occlusion areas.
[0073] In one embodiment of this application, when a second image extraction is required from a webpage crop image, the following steps may be included: converting the webpage crop image into an HSV (Hue, Saturation, Value) space, and then determining the text region and background region based on the mean of the Value channel; as an example, if the background is determined to be light based on the Value channel, then the black text region is extracted; if it is a dark region, then the white text region is extracted; the region outside the text region is the background region. A binary mask is generated, where the text region is 0 and the background region is 1. Using a dynamic programming algorithm, each row is considered as the bottom of a histogram, and the continuous upward height of each position is calculated. Using a monotonic stack algorithm, the largest rectangular region without text is found in O(N) time complexity (N is the number of pixels). This region is cropped out as the clean region image.
[0074] S203, determine the target scaling ratio of the clean area image relative to the original base map, and determine the matching coordinates of the clean area image in the original base map.
[0075] The original background image is the image of the webpage background corresponding to the cropped image of the webpage.
[0076] In one embodiment of this application, when it is necessary to determine the target scaling ratio of a clean area image relative to the original base image, the following steps may be included: performing a first scaling ratio screening on at least one first scaling ratio to obtain candidate scaling ratios corresponding to the clean area image; dividing the candidate scaling ratios by ratio to obtain at least one second scaling ratio; and performing a second scaling ratio screening on each second scaling ratio to obtain the target scaling ratio of the clean area image relative to the original base image.
[0077] In another embodiment of this application, when it is necessary to determine the matching coordinates of the clean area image in the webpage screenshot, the clean area image is matched with each region in the webpage screenshot. If the matching degree between the image of a certain region and the clean area image is greater than a preset threshold, then the coordinates of that region are used as the matching coordinates of the clean area image in the webpage screenshot.
[0078] S204, extract the watermark based on the target scaling ratio, matching coordinates and candidate region image to obtain the watermark to be extracted corresponding to the webpage cropped image.
[0079] It should be noted that when it is necessary to extract watermarks based on the target scaling ratio, matching coordinates, and candidate region images to obtain the watermark to be extracted corresponding to the webpage crop image, an image can be constructed based on the target scaling ratio, matching coordinates, and candidate region images to obtain a target image containing the candidate region images; watermark extraction can then be performed on the target image to obtain the watermark to be extracted corresponding to the webpage crop image.
[0080] The aforementioned watermark extraction method involves performing a first image extraction on a webpage crop image to obtain a candidate region image containing the watermark to be extracted; and performing a second image extraction on the webpage crop image to obtain a clean region image without text occlusion. This method determines the target scaling ratio of the clean region image relative to the original background image, and determines the matching coordinates of the clean region image in the original background image. Then, watermark extraction is performed based on the target scaling ratio, matching coordinates, and candidate region image to obtain the watermark to be extracted corresponding to the webpage crop image. As can be seen from the above, this application, when performing watermark extraction, avoids occlusion and damage to the watermark to be extracted by text and components in the webpage crop image by obtaining a clean region image. Determining the target scaling ratio and matching coordinates based on the clean region image ensures that the ratio of the webpage crop image relative to the original background image of the corresponding webpage during the cropping process is effectively determined based on the target scaling ratio, and the cropping position of the webpage crop image in the original background image is effectively determined based on the matching coordinates. This ensures that the complete watermark to be extracted is effectively obtained when performing watermark extraction based on the target scaling ratio, matching coordinates, and candidate region image.
[0081] In one embodiment, such as Figure 3 As shown, when it is necessary to extract watermarks based on the target scaling ratio, matching coordinates, and candidate region images to obtain the watermark to be extracted corresponding to the webpage crop image, the following can be included:
[0082] S301, construct an image based on the target scaling ratio, matching coordinates and candidate region images to obtain a target image containing candidate region images.
[0083] It should be noted that when it is necessary to construct an image based on the target scaling ratio, matching coordinates, and candidate region image to obtain a target image containing the candidate region image, the following can be included: constructing a reference image; wherein the image size of the reference image is the same as the image size of the original background image of the webpage corresponding to the webpage screenshot image; mapping the candidate region image into the reference image according to the target scaling ratio and matching coordinates to obtain a target image containing the candidate region image.
[0084] To further explain, in order to ensure the accuracy of the target image construction, when mapping the candidate region image to the reference image according to the target scaling ratio and matching coordinates to obtain the target image containing the candidate region image, the following may also be included: determining the relative offset of the clean region image relative to the cropped image of the webpage; mapping the candidate region image to the reference image according to the target scaling ratio, matching coordinates and relative offset to obtain the target image containing the candidate region image.
[0085] In one embodiment of this application, a reference image is constructed, which is a blank white canvas of the same size as the original base image; the candidate region image is proportionally adjusted according to the target scaling ratio, and the absolute position of the candidate region image in the coordinate system of the original base image is calculated according to the matching coordinates and relative offset; then, the adjusted candidate region image is "pasted" onto the absolute position of the reference image to obtain the target image, so that the image on the target image only has a clear, unobstructed screenshot area of the watermark to be extracted and a blank area with no signal.
[0086] S302, extract the watermark from the target image to obtain the watermark to be extracted corresponding to the webpage cropped image.
[0087] In one embodiment of this application, when it is necessary to extract a watermark from a target image, the following may be included: sending the reconstructed target image into a decoder to extract the watermark from the target image and obtain the watermark to be extracted corresponding to the webpage cropped image.
[0088] The above watermark extraction method constructs an image based on the target scaling ratio, matching coordinates, and candidate region images to obtain a target image containing the candidate region images. Through geometric inverse transformation, it can standardize and restore the candidate region images of arbitrary resolution, arbitrary cropping position, and arbitrary scaling ratio to the target image in the original base map coordinate system, ensuring the accuracy of subsequent watermark extraction and effectively obtaining the complete watermark to be extracted.
[0089] In one embodiment, such as Figure 4 As shown, when it is necessary to determine the target scaling ratio of the clean area image relative to the original base map, the following may be included:
[0090] S401, perform first scaling factor filtering on at least one first scaling factor to obtain candidate scaling factors corresponding to the clean area image.
[0091] The first scaling factor can be at least one of the predefined scaling factor selectable ranges divided according to a preset step size; as an example, the scaling factor can be from 0.2 times to 5.0 times.
[0092] It should be noted that when it is necessary to perform first scaling factor filtering on at least one first scaling factor to obtain candidate scaling factors corresponding to the clean area image, the following may be included: determining the normalized cross-correlation coefficient corresponding to each first scaling factor based on the clean area image and the original base image; and taking the first scaling factor with the largest normalized cross-correlation coefficient as the candidate scaling factor.
[0093] In one embodiment of this application, when it is necessary to determine a candidate scaling ratio, the following may be included: obtaining a scaling ratio (e.g., 0.2x to 5.0x), generating at least one first scaling ratio based on a larger step size (e.g., 1 / 10 of the total number of levels), using a multi-process pool (ProcessPool) to calculate the normalized cross-correlation coefficient (NCC) at each scale in parallel, and taking the first scaling ratio with the largest normalized cross-correlation coefficient as the candidate scaling ratio.
[0094] S402, divide the candidate scaling ratios proportionally to obtain at least one second scaling ratio.
[0095] In one embodiment of this application, a smaller minister is used to proportionally divide the candidate scaling ratios to obtain at least one second scaling ratio.
[0096] As an example, if the candidate scaling ratio is one to two times, then four steps are used to divide the candidate scaling ratio proportionally, with each step being 0.25, to obtain at least one second scaling ratio.
[0097] S403, perform second scaling on each second scaling ratio to obtain the target scaling ratio of the clean area image relative to the original base image.
[0098] In one embodiment of this application, the normalized cross-correlation coefficient corresponding to each second scaling ratio is determined based on the clean area image and the webpage screenshot image; the second scaling ratio with the largest normalized cross-correlation coefficient is selected as the candidate scaling ratio.
[0099] The watermark extraction method described above, by performing a first ratio screening and a second ratio screening, achieves a significant reduction in invalid calculations while ensuring matching accuracy (error controlled at the pixel level), thus guaranteeing the efficiency of determining the target scaling ratio.
[0100] In one embodiment, such as Figure 5 As shown, when it is necessary to obtain the watermark to be extracted from a webpage cropped image, the following can be included:
[0101] S501, perform first image extraction on the webpage cropped image to obtain a candidate region image containing the watermark to be extracted.
[0102] S502, perform a second image extraction on the captured image from the webpage to obtain a clean area image without text obstruction.
[0103] S503, perform first scaling factor filtering on at least one first scaling factor to obtain candidate scaling factors corresponding to the clean area image.
[0104] S504, divide the candidate scaling ratios proportionally to obtain at least one second scaling ratio.
[0105] S505, perform second scaling on each second scaling ratio to obtain the target scaling ratio of the clean area image relative to the original base image.
[0106] S506, Determine the matching coordinates of the clean area image on the original base map.
[0107] S507, Construct a reference image.
[0108] S508, determine the relative offset of the clean area image relative to the cropped image of the webpage.
[0109] S509, based on the target scaling ratio, matching coordinates and relative offset, the candidate region image is mapped onto the reference image to obtain the target image containing the candidate region image.
[0110] S510, extract the watermark from the target image to obtain the watermark to be extracted corresponding to the webpage cropped image.
[0111] The aforementioned watermark extraction method involves performing a first image extraction on a webpage crop image to obtain a candidate region image containing the watermark to be extracted; and performing a second image extraction on the webpage crop image to obtain a clean region image without text occlusion. This method determines the target scaling ratio of the clean region image relative to the original background image, and determines the matching coordinates of the clean region image in the original background image. Then, watermark extraction is performed based on the target scaling ratio, matching coordinates, and candidate region image to obtain the watermark to be extracted corresponding to the webpage crop image. As can be seen from the above, this application, when performing watermark extraction, avoids occlusion and damage to the watermark to be extracted by text and components in the webpage crop image by obtaining a clean region image. Determining the target scaling ratio and matching coordinates based on the clean region image ensures that the ratio of the webpage crop image relative to the original background image of the corresponding webpage during the cropping process is effectively determined based on the target scaling ratio, and the cropping position of the webpage crop image in the original background image is effectively determined based on the matching coordinates. This ensures that the complete watermark to be extracted is effectively obtained when performing watermark extraction based on the target scaling ratio, matching coordinates, and candidate region image.
[0112] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0113] Based on the same inventive concept, this application also provides a watermark extraction device for implementing the watermark extraction method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more watermark extraction device embodiments provided below can be found in the limitations of the watermark extraction method described above, and will not be repeated here.
[0114] In one embodiment, such as Figure 6 As shown, a watermark extraction device is provided, comprising: a first extraction module 10, a second extraction module 20, a determining module 30, and a third extraction module 40, wherein:
[0115] The first extraction module 10 is used to perform first image extraction on the webpage cropped image to obtain a candidate region image containing the watermark to be extracted.
[0116] The second extraction module 20 is used to perform second image extraction on the webpage cropped image to obtain a clean area image without text obstruction.
[0117] The determination module 30 is used to determine the target scaling ratio of the clean area image relative to the original base map, and to determine the matching coordinates of the clean area image in the original base map.
[0118] The third extraction module 40 is used to extract watermarks based on the target scaling ratio, matching coordinates, and candidate region images, to obtain the watermark to be extracted corresponding to the webpage cropped image.
[0119] In one embodiment, an image is constructed based on the target scaling ratio, matching coordinates, and candidate region images to obtain a target image containing candidate region images;
[0120] Watermark extraction is performed on the target image to obtain the watermark to be extracted corresponding to the webpage cropped image.
[0121] In one embodiment, a reference image is constructed; wherein the image size of the reference image is the same as the image size of the original background image of the webpage corresponding to the webpage screenshot image;
[0122] The candidate region image is mapped onto the reference image based on the target scaling ratio and matching coordinates to obtain the target image containing the candidate region image.
[0123] In one embodiment, the relative offset of the clean area image relative to the cropped image of the webpage is determined;
[0124] Based on the target scaling ratio, matching coordinates, and relative offset, the candidate region image is mapped onto the reference image to obtain the target image containing the candidate region image.
[0125] In one embodiment, at least one first scaling ratio is filtered by a first scaling ratio to obtain candidate scaling ratios corresponding to clean area images.
[0126] Divide the candidate scaling ratios proportionally to obtain at least one second scaling ratio;
[0127] The second scaling factor is then filtered to obtain the target scaling factor of the clean area image relative to the original base image.
[0128] In one embodiment, the normalized cross-correlation coefficient corresponding to each first scaling factor is determined based on the clean area image and the original base image.
[0129] The first scaling factor with the largest normalized cross-correlation coefficient is selected as the candidate scaling factor.
[0130] The aforementioned watermark extraction device performs a first image extraction on a webpage crop image to obtain a candidate region image containing the watermark to be extracted; and a second image extraction on the webpage crop image to obtain a clean region image without text occlusion; it determines the target scaling ratio of the clean region image relative to the original background image, and determines the matching coordinates of the clean region image in the original background image; then, it extracts the watermark based on the target scaling ratio, matching coordinates, and candidate region image to obtain the watermark to be extracted corresponding to the webpage crop image. As can be seen from the above, this application, when performing watermark extraction, avoids occlusion and damage to the watermark to be extracted by text and components in the webpage crop image by obtaining a clean region image. Determining the target scaling ratio and matching coordinates based on the clean region image ensures that the ratio of the webpage crop image relative to the original background image of the corresponding webpage during the cropping process is effectively determined based on the target scaling ratio, and the cropping position of the webpage crop image in the original background image is effectively determined based on the matching coordinates. This ensures that the complete watermark to be extracted is effectively obtained when performing watermark extraction based on the target scaling ratio, matching coordinates, and candidate region image.
[0131] Each module in the aforementioned watermark extraction device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0132] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a watermark extraction method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0133] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0134] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0135] The first image extraction is performed on the captured image from the webpage to obtain a candidate region image containing the watermark to be extracted;
[0136] A second image extraction is performed on the captured image from the webpage to obtain a clean area image without text obscuring it;
[0137] Determine the target scaling ratio of the clean area image relative to the original base image, and determine the matching coordinates of the clean area image in the original base image;
[0138] Watermark extraction is performed based on the target scaling ratio, matching coordinates, and candidate region images to obtain the watermark to be extracted corresponding to the webpage cropped image.
[0139] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0140] Based on the target scaling ratio, matching coordinates, and candidate region images, an image is constructed to obtain a target image containing the candidate region images;
[0141] Watermark extraction is performed on the target image to obtain the watermark to be extracted corresponding to the webpage cropped image.
[0142] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0143] Construct a reference image; wherein the image size of the reference image is the same as the image size of the original background image of the webpage corresponding to the webpage screenshot image;
[0144] The candidate region image is mapped onto the reference image based on the target scaling ratio and matching coordinates to obtain the target image containing the candidate region image.
[0145] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0146] Determine the relative offset of the clean area image with respect to the cropped image from the webpage;
[0147] Based on the target scaling ratio, matching coordinates, and relative offset, the candidate region image is mapped onto the reference image to obtain the target image containing the candidate region image.
[0148] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0149] Perform a first-scale filtering on at least one first scaling ratio to obtain candidate scaling ratios corresponding to the clean region image;
[0150] Divide the candidate scaling ratios proportionally to obtain at least one second scaling ratio;
[0151] The second scaling factor is then filtered to obtain the target scaling factor of the clean area image relative to the original base image.
[0152] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0153] Based on the clean area image and the original base map, determine the normalized cross-correlation coefficient corresponding to each first scaling factor;
[0154] The first scaling factor with the largest normalized cross-correlation coefficient is selected as the candidate scaling factor.
[0155] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0156] The first image extraction is performed on the captured image from the webpage to obtain a candidate region image containing the watermark to be extracted;
[0157] A second image extraction is performed on the captured image from the webpage to obtain a clean area image without text obscuring it;
[0158] Determine the target scaling ratio of the clean area image relative to the original base image, and determine the matching coordinates of the clean area image in the original base image;
[0159] Watermark extraction is performed based on the target scaling ratio, matching coordinates, and candidate region images to obtain the watermark to be extracted corresponding to the webpage cropped image.
[0160] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0161] Based on the target scaling ratio, matching coordinates, and candidate region images, an image is constructed to obtain a target image containing the candidate region images;
[0162] Watermark extraction is performed on the target image to obtain the watermark to be extracted corresponding to the webpage cropped image.
[0163] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0164] Construct a reference image; wherein the image size of the reference image is the same as the image size of the original background image of the webpage corresponding to the webpage screenshot image;
[0165] The candidate region image is mapped onto the reference image based on the target scaling ratio and matching coordinates to obtain the target image containing the candidate region image.
[0166] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0167] Determine the relative offset of the clean area image with respect to the cropped image from the webpage;
[0168] Based on the target scaling ratio, matching coordinates, and relative offset, the candidate region image is mapped onto the reference image to obtain the target image containing the candidate region image.
[0169] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0170] Perform a first-scale filtering on at least one first scaling ratio to obtain candidate scaling ratios corresponding to the clean region image;
[0171] Divide the candidate scaling ratios proportionally to obtain at least one second scaling ratio;
[0172] The second scaling factor is then filtered to obtain the target scaling factor of the clean area image relative to the original base image.
[0173] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0174] Based on the clean area image and the original base map, determine the normalized cross-correlation coefficient corresponding to each first scaling factor;
[0175] The first scaling factor with the largest normalized cross-correlation coefficient is selected as the candidate scaling factor.
[0176] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0177] The first image extraction is performed on the captured image from the webpage to obtain a candidate region image containing the watermark to be extracted;
[0178] A second image extraction is performed on the captured image from the webpage to obtain a clean area image without text obscuring it;
[0179] Determine the target scaling ratio of the clean area image relative to the original base image, and determine the matching coordinates of the clean area image in the original base image;
[0180] Watermark extraction is performed based on the target scaling ratio, matching coordinates, and candidate region images to obtain the watermark to be extracted corresponding to the webpage cropped image.
[0181] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0182] Based on the target scaling ratio, matching coordinates, and candidate region images, an image is constructed to obtain a target image containing the candidate region images;
[0183] Watermark extraction is performed on the target image to obtain the watermark to be extracted corresponding to the webpage cropped image.
[0184] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0185] Construct a reference image; wherein the image size of the reference image is the same as the image size of the original background image of the webpage corresponding to the webpage screenshot image;
[0186] The candidate region image is mapped onto the reference image based on the target scaling ratio and matching coordinates to obtain the target image containing the candidate region image.
[0187] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0188] Determine the relative offset of the clean area image with respect to the cropped image from the webpage;
[0189] Based on the target scaling ratio, matching coordinates, and relative offset, the candidate region image is mapped onto the reference image to obtain the target image containing the candidate region image.
[0190] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0191] Perform a first-scale filtering on at least one first scaling ratio to obtain candidate scaling ratios corresponding to the clean region image;
[0192] Divide the candidate scaling ratios proportionally to obtain at least one second scaling ratio;
[0193] The second scaling factor is then filtered to obtain the target scaling factor of the clean area image relative to the original base image.
[0194] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0195] Based on the clean area image and the original base map, determine the normalized cross-correlation coefficient corresponding to each first scaling factor;
[0196] The first scaling factor with the largest normalized cross-correlation coefficient is selected as the candidate scaling factor.
[0197] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0198] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0199] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0200] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A watermark extraction method, characterized in that, The method includes: The first image extraction is performed on the captured image from the webpage to obtain a candidate region image containing the watermark to be extracted; A second image extraction is performed on the captured image of the webpage to obtain a clean area image without text obstruction; Determine the target scaling ratio of the clean area image relative to the original base image, and determine the matching coordinates of the clean area image in the original base image; wherein, the original base image is the image of the webpage background corresponding to the webpage cropped image; Watermark extraction is performed based on the target scaling ratio, the matching coordinates, and the candidate region image to obtain the watermark to be extracted corresponding to the webpage cropped image.
2. The method according to claim 1, characterized in that, The step of extracting the watermark based on the target scaling ratio, the matching coordinates, and the candidate region image to obtain the watermark to be extracted corresponding to the webpage crop image includes: Based on the target scaling ratio, the matching coordinates, and the candidate region image, an image is constructed to obtain a target image containing the candidate region image; Watermark extraction is performed on the target image to obtain the watermark to be extracted corresponding to the webpage cropped image.
3. The method according to claim 2, characterized in that, The step of constructing an image based on the target scaling ratio, the matching coordinates, and the candidate region image to obtain a target image containing the candidate region image includes: Construct a reference image; wherein the image size of the reference image is the same as the image size of the original background image of the webpage corresponding to the webpage screenshot image; The candidate region image is mapped onto the reference image based on the target scaling ratio and the matching coordinates to obtain a target image containing the candidate region image.
4. The method according to claim 3, characterized in that, The step of mapping the candidate region image onto the reference image according to the target scaling ratio and the matching coordinates to obtain a target image containing the candidate region image includes: Determine the relative offset of the clean area image with respect to the cropped image of the webpage; Based on the target scaling ratio, the matching coordinates, and the relative offset, the candidate region image is mapped onto the reference image to obtain a target image containing the candidate region image.
5. The method according to any one of claims 1-4, characterized in that, Determining the target scaling ratio of the clean area image relative to the original base image includes: Perform a first scaling factor screening on at least one first scaling factor to obtain candidate scaling factors corresponding to the clean region image; The candidate scaling ratios are divided proportionally to obtain at least one second scaling ratio; The second scaling factor is filtered by a second scaling factor to obtain the target scaling factor of the clean area image relative to the original base image.
6. The method according to claim 5, characterized in that, The step of performing a first scaling factor selection on at least one first scaling factor to obtain candidate scaling factors corresponding to the clean region image includes: Based on the clean area image and the original base image, determine the normalized cross-correlation coefficient corresponding to each of the first scaling ratios; The first scaling factor with the largest normalized cross-correlation coefficient is selected as the candidate scaling factor.
7. The method according to any one of claims 1-4, characterized in that, The step of performing a second image extraction on the captured webpage image to obtain a clean area image without text obstruction includes: The captured webpage image is converted to the HSV color space to obtain the captured webpage image in the HSV space. Based on the average brightness of the webpage cropped image in HSV space, determine the text occlusion area contained in the webpage cropped image; Generate a binary mask corresponding to the text occlusion area; Based on the binary mask, and according to the monotonic stack algorithm, the clean area image without text obstruction in the webpage crop image is determined.
8. A watermark extraction device, characterized in that, The device includes: The first extraction module is used to perform first image extraction on the webpage cropped image to obtain a candidate region image containing the watermark to be extracted; The second extraction module is used to perform a second image extraction on the captured image of the webpage to obtain a clean area image without text obstruction; The determination module is used to determine the target scaling ratio of the clean area image relative to the original base image, and to determine the matching coordinates of the clean area image in the original base image; wherein, the original base image is the image of the webpage background corresponding to the webpage cropped image; The third extraction module is used to extract watermarks based on the target scaling ratio, the matching coordinates, and the candidate region image, to obtain the watermark to be extracted corresponding to the webpage cropped image.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.