Watermark Detection Method, Device, Electronic Device and Storage Medium
By performing frequency domain representation and restoration processing on the watermark area image in watermark detection, the problem of insufficient watermark detection accuracy when the image quality is poor is solved, and a more accurate watermark authorization judgment is achieved.
Patent Information
- Application Number
- CN202011644393.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-31
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2040-12-31
AI Technical Summary
The existing watermark detection technology has insufficient detection accuracy, especially in the case of poor image quality, it is difficult to accurately judge the authorization status of the watermark.
By extracting the watermark area image from the image to be identified, and representing and restoring it in the frequency domain, a better quality watermark area image is obtained, and then pasting it back into the original image to perform subsequent watermark detection to improve the accuracy of the detection.
In the case of poor image quality, more accurate watermark detection results can be obtained through the restoration process of the watermark area image, which improves the accuracy of watermark detection.
Smart Images

Figure CN114693496B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technologies, and in particular, to a watermark detection method, apparatus, electronic device, and storage medium. Background Art
[0002] Copyright is the legal ownership of the right to copy computer programs, literary works, musical works, photos, games, movies, etc. Copyright protection has always been a concern for enterprises and individuals. In the Internet era with a high frequency of piracy, watermarks have become an effective means of copyright protection, and an important part of this is watermark detection. Currently, the commonly used watermark detection technologies are image feature matching and deep learning. The method based on deep learning constructs an object detector to identify watermarks in images, which performs more superiorly in terms of efficiency and accuracy compared to the image feature matching method. However, there are still some factors that make the detection accuracy relatively low. Summary of the Invention
[0003] In view of the above problems, this application provides a watermark detection method, apparatus, electronic device, and storage medium, which is beneficial to improving the accuracy of watermark detection.
[0004] To achieve the above object, in the first aspect of the embodiments of this application, a watermark detection method is provided, and the method includes:
[0005] Obtain a watermark region image from a first image to be recognized;
[0006] Obtain the representation of the watermark region image in the frequency domain;
[0007] Restore the watermark region image based on the representation of the watermark region image in the frequency domain to obtain a restored watermark region image;
[0008] Paste the restored watermark region image back to the first image to be recognized to obtain a second image to be recognized;
[0009] Detect the second image to be recognized to obtain a first watermark detection box and the confidence level of the first watermark detection box;
[0010] Determine whether the watermark in the first watermark detection box is an authorized watermark or an unauthorized watermark according to the confidence level.
[0011] In combination with the first aspect, in a possible implementation manner, the step of restoring the watermark region image based on the representation of the watermark region image in the frequency domain to obtain a restored watermark region image includes:
[0012] Obtain a target filter;
[0013] Based on the representation of the watermark region image in the frequency domain and the target filter, the watermark region image is restored to obtain the restored watermark region image.
[0014] Combined with the first aspect, in a possible implementation, the obtaining of the target filter includes:
[0015] Obtain a point spread function based on a two-dimensional Gaussian distribution;
[0016] Obtain the signal-to-noise ratio representation of the watermark region image;
[0017] Obtain the target filter according to the point spread function and the signal-to-noise ratio representation.
[0018] Combined with the first aspect, in a possible implementation, the obtaining of the watermark region image according to the first image to be recognized includes:
[0019] Detect the first image to be recognized to obtain a second watermark detection frame;
[0020] Crop the first image to be recognized based on the second watermark detection frame to obtain the watermark region image.
[0021] Combined with the first aspect, in a possible implementation, the pasting the restored watermark region image back to the first image to be recognized to obtain a second image to be recognized includes:
[0022] Segment the watermark in the first image to be recognized to obtain a watermark mask;
[0023] Perform Gaussian blur on the edge of the watermark mask;
[0024] Paste the watermark in the restored watermark region image back to the first image to be recognized based on the position where the first image to be recognized is cropped according to the second watermark detection frame and the watermark mask to obtain the second image to be recognized.
[0025] Combined with the first aspect, in a possible implementation, when the confidence level is less than the first threshold, determine that the watermark in the first watermark detection frame is an unauthorized watermark;
[0026] When the confidence level is greater than or equal to the first threshold, extract features of the image region framed by the first watermark detection frame to obtain target image features;
[0027] Obtain reference image features of a reference watermark image; the watermark in the reference watermark image is an authorized watermark with a specified category;
[0028] Obtain the similarity between the reference image features and the target image features;
[0029] When the similarity is less than the second threshold, determine that the watermark in the first watermark detection box is an unauthorized watermark;
[0030] When the similarity is greater than or equal to the second threshold, determine that the watermark in the first watermark detection box is an authorized watermark.
[0031] A second aspect of the embodiments of the present application provides a watermark detection device, which includes:
[0032] A first detection module, configured to obtain a watermark region image according to a first image to be recognized;
[0033] The first acquisition module is further configured to acquire a representation of the watermark region image in the frequency domain;
[0034] An image restoration module, configured to restore the watermark region image based on the representation of the watermark region image in the frequency domain to obtain a restored watermark region image;
[0035] The image restoration module is further configured to paste the restored watermark region image back to the first image to be recognized to obtain a second image to be recognized;
[0036] A second detection module, configured to detect the second image to be recognized to obtain a first watermark detection box and a confidence level of the first watermark detection box;
[0037] A determination module, configured to determine whether the watermark in the first watermark detection box is an authorized watermark or an unauthorized watermark according to the confidence level.
[0038] A third aspect of the embodiments of the present application provides an electronic device, which includes an input device and an output device, and further includes a processor, which is adapted to implement one or more instructions; and a computer storage medium, the computer storage medium stores one or more instructions, and the one or more instructions are adapted to be loaded and executed by the processor to perform the following steps:
[0039] Obtain a watermark region image according to a first image to be recognized;
[0040] Acquire a representation of the watermark region image in the frequency domain;
[0041] Restore the watermark region image based on the representation of the watermark region image in the frequency domain to obtain a restored watermark region image;
[0042] Paste the restored watermark region image back to the first image to be recognized to obtain a second image to be recognized;
[0043] Detect the second image to be recognized to obtain a first watermark detection frame and the confidence of the first watermark detection frame;
[0044] Determine whether the watermark in the first watermark detection frame is an authorized watermark or an unauthorized watermark according to the confidence.
[0045] A fourth aspect of the embodiments of the present application provides a computer storage medium, which stores one or more instructions, and the one or more instructions are adapted to be loaded and executed by a processor to perform the following steps:
[0046] Obtain a watermark region image according to the first image to be recognized;
[0047] Obtain the representation of the watermark region image in the frequency domain;
[0048] Restore the watermark region image based on the representation of the watermark region image in the frequency domain to obtain a restored watermark region image;
[0049] Paste the restored watermark region image back to the first image to be recognized to obtain a second image to be recognized;
[0050] Detect the second image to be recognized to obtain a first watermark detection frame and the confidence of the first watermark detection frame;
[0051] Determine whether the watermark in the first watermark detection frame is an authorized watermark or an unauthorized watermark according to the confidence.
[0052] The above solution of the present application has at least the following beneficial effects: Compared with the prior art, in the embodiments of the present application, a watermark region image is obtained according to the first image to be recognized; the representation of the watermark region image in the frequency domain is obtained; the watermark region image is restored based on the representation of the watermark region image in the frequency domain to obtain a restored watermark region image; the restored watermark region image is pasted back to the first image to be recognized to obtain a second image to be recognized; the second image to be recognized is detected to obtain a first watermark detection frame and the confidence of the first watermark detection frame; and it is determined whether the watermark in the first watermark detection frame is an authorized watermark or an unauthorized watermark according to the confidence. In this way, when the quality of the first image to be recognized is poor, the watermark region image in the first image to be recognized can be restored to obtain a second image to be recognized with better quality, and then the second image to be recognized with better quality is detected for watermark, and the obtained confidence is relatively more accurate, so that it can more accurately judge the authorized watermark or the unauthorized watermark, and improve the accuracy of watermark detection. Description of the Drawings
[0053] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on these drawings.
[0054] Figure 1 A schematic diagram of an application environment provided by an embodiment of the present application;
[0055] Figure 2 A schematic flowchart of a watermark detection method provided by an embodiment of the present application;
[0056] Figure 3 A schematic diagram for determining the size of the watermark area image provided by an embodiment of the present application;
[0057] Figure 4 A schematic flowchart of another watermark detection method provided by an embodiment of the present application;
[0058] Figure 5 A schematic structural diagram of a watermark detection device provided by an embodiment of the present application;
[0059] Figure 6 A schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0060] In order to enable those skilled in the art to better understand the solutions of the present application, the following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0061] The terms "including" and "having" and any variations thereof that appear in the specification, claims, and drawings of the present application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally further include steps or units not listed, or may optionally further include other steps or units inherent to these processes, methods, products, or devices. In addition, the terms "first", "second", and "third", etc. are used to distinguish different objects, rather than to describe a specific order.
[0062] An embodiment of the present application provides a watermark detection method, which can be implemented based on Figure 1 the application environment shown. Please refer toFigure 1 , the application environment includes a terminal device and a server. The terminal device and the server are connected and communicate through a wired or wireless network. The terminal device is used to provide an image to be recognized to the server. Among them, the terminal device can be an image acquisition device, which is used to directly acquire the image to be recognized and then send it to the server. For example, a camera. It can also be a device providing a human-computer interaction interface. The user can input the image to be recognized through the human-computer interaction interface, and then the terminal device sends it to the server. The server is used to perform watermark detection on the image to be recognized sent by the terminal device, specifically, for example, performing operations such as image segmentation, image restoration, and determination of authorized (or unauthorized) watermarks. Among them, the server can be an independent physical server, or a server cluster or a distributed system. It can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms.
[0063] Based on Figure 1 the application environment shown above, the watermark detection method provided by the embodiments of the present application will be described in detail below in combination with other accompanying drawings.
[0064] Please refer to Figure 2 , Figure 2 which is a schematic flowchart of a watermark detection method provided by an embodiment of the present application. This method is applied to the server. As Figure 2 shown above, it includes steps S21 - S26:
[0065] S21, obtaining a watermark region image according to the first image to be recognized.
[0066] In a specific embodiment of the present application, the first image to be recognized refers to an image with poor quality provided by an image acquisition device. For example, there are problems such as blurring. After the server obtains the first image to be recognized, it executes relevant processes for watermark detection. For example, it calls a pre-stored watermark detector to perform watermark detection. Among them, the watermark detector can be Faster R-CNN (Faster Region-Convolutional Neural Networks, a faster region convolutional neural network detector), or YOLO (You Only Look Once, a one-glance object detector), and the specific type is not limited. Exemplarily, the first image to be recognized can be cropped based on the detection box (i.e., the second watermark detection box) obtained by detecting the first image to be recognized to obtain the watermark region image.
[0067] Exemplarily, as Figure 3 shown above, after obtaining the watermark region image, the method further includes:
[0068] Compare the size of the watermark region image with a preset size;
[0069] When the size of the watermark region image is greater than or equal to the preset size, perform the operation of obtaining the representation of the watermark region image in the frequency domain;
[0070] When the size of the watermark region image is less than the preset size, filter the first image to be recognized.
[0071] Specifically, the preset size refers to the standard size of the authorized watermark. When the size of the watermark region image is less than the preset size, it is considered that the watermark in the watermark region image is a low-quality watermark, and the first image to be recognized is directly filtered without performing subsequent operations. When the size of the watermark region image meets the preset size, it indicates that the watermark in the watermark region image is a standard watermark, and filtering the image with the low-quality watermark can save detection time.
[0072] S22. Obtain the representation of the watermark region image in the frequency domain.
[0073] In a specific embodiment of the present application, the representation of the watermark region image in the frequency domain can be obtained through an image degradation model, denoted as S = H * U + N, where S is the representation of the watermark region image in the frequency domain, H is the initial point spread function, U is the watermark region image, and N is the superimposed spectral noise. The frequency domain representation is used to represent the degradation degree of the watermark region image in the frequency domain and is used for subsequent filtering in the frequency domain when restoring the watermark region image.
[0074] Exemplarily, before obtaining the representation of the watermark region image in the frequency domain, the method further includes:
[0075] Perform occlusion determination on the watermark region image;
[0076] When there is occlusion in the watermark region image, do not perform the operation of obtaining the representation of the watermark region image in the frequency domain.
[0077] Specifically, for the watermark region image, determine an m * m detection window, where m is an integer greater than or equal to 1. Slide the detection window in this image region with a preset step length. For each region covered by the detection window, extract its features and calculate the feature mean. Compare the feature mean of each region with the feature means of its neighboring regions to obtain the difference between the feature mean of each region and the feature means of its neighboring regions. When this difference is greater than or equal to a threshold, it is determined that this region has occlusion, that is, the watermark region image has occlusion.
[0078] S23. Restore the watermark region image based on the representation of the watermark region image in the frequency domain to obtain the restored watermark region image.
[0079] In a specific embodiment of the present application, a method for restoring the watermark region image based on the representation of the watermark region image in the frequency domain to obtain the restored watermark region image includes:
[0080] Obtain a target filter;
[0081] Restore the watermark region image based on the representation of the watermark region image in the frequency domain and the target filter to obtain the restored watermark region image.
[0082] Specifically, it is necessary to obtain a point spread function based on a two-dimensional Gaussian distribution. First, determine a two-dimensional Gaussian function as the initial point spread function, denoted as: where A represents the amplitude, (x 0 , y 0 ) is the coordinate of the center point of the peak of the two-dimensional Gaussian function, σ x 2 and σ y 2 are variances, and their value ranges are (0, 1]. (x, y) are points of the two-dimensional Gaussian function in the x0y plane. Select different (x, y) points in the x0y plane to observe the denoising effect of the two-dimensional Gaussian function. At the same time, adjust the signal-to-noise ratio of the watermark region image within a preset signal-to-noise ratio range, and determine the (x, y) points and signal-to-noise ratio that make the quality of the watermark region image the best. Among them, the quality of the watermark region image can be determined according to the contrast during the adjustment process. For example, when the contrast reaches a preset value, it can be considered that the quality of the watermark region image is the best. Among them, the two-dimensional Gaussian function composed of the (x, y) points that make the quality of the watermark region image the best is determined as the above-mentioned point spread function, and the signal-to-noise ratio that makes the quality of the watermark region image the best is determined as the above-mentioned signal-to-noise ratio representation. Then the obtained target filter is expressed as: where H 1 is the point spread function obtained by debugging, SNR is the signal-to-noise ratio representation obtained by debugging, and its value range can be determined according to empirical values, such as [0, 30] decibels, and H 1 are conjugate complex numbers. After obtaining the target filter G, use the target filter G to convolve the watermark region image to calculate an approximate estimated image of the watermark region image, and this approximate estimated image is the restored watermark region image.
[0083] S24. Paste the restored watermark region image back to the first image to be recognized to obtain a second image to be recognized.
[0084] In a specific embodiment of the present application, a segmentation algorithm is used to segment the pixel points belonging to the watermark in the first image to be recognized, obtaining a watermark mask. Based on the position where the second watermark detection frame is cropped in the first image to be recognized, the position of the watermark region image in the first image to be recognized can be accurately known. Based on the portrait mask, the position of the watermark in the first image to be recognized can be accurately known. Combining these two positions, the watermark in the restored watermark region image can be pasted back to the first image to be recognized, and the other parts of the obtained second image to be recognized except the watermark are consistent with the first image to be recognized. In this way, not only can the quality of the watermark be made better and easier to recognize, but also the original information of the image can be retained.
[0085] S25, Detect the second image to be recognized to obtain a first watermark detection frame and the confidence level of the first watermark detection frame.
[0086] In a specific embodiment of the present application, the same detector used for detecting the first image to be recognized can be used to detect the second image to be recognized, or different detectors can be used, which is not limited here. For example, in Faster R-CNN, a branch of the feature map extracted by the feature extraction network enters the RPN (Region Proposal Network) to generate the offset value of the anchor box and the bounding box regression, and then the candidate detection box of the watermark in the second image to be recognized is calculated. The ROI Pooling (Region of interest Pooling) layer extracts the target feature map from the feature map and inputs it into the fully connected and softmax classifier for the classification of the watermark and the fine regression of the candidate detection box, and finally outputs the first detection box and the confidence level corresponding to the first detection box.
[0087] S26, Determine whether the watermark in the first watermark detection frame is an authorized watermark or an unauthorized watermark according to the confidence level.
[0088] In a specific embodiment of the present application, when the confidence level is less than the first threshold, it is directly determined that the watermark in the first watermark detection frame is an unauthorized watermark. When the confidence level is greater than or equal to the first threshold, feature extraction is performed on the image area framed by the first watermark detection frame to obtain target image features. For example, a convolutional neural network is used for feature extraction, and then the reference image features of the reference watermark image are obtained. The watermark in the reference watermark image is an authorized watermark, and its category includes at least one or a combination of multiple of numbers, letters, symbols, patterns, characters, etc. The similarity between the target image features and the reference image features is calculated. Specifically, the Manhattan distance can be used for measurement. When the similarity is less than the second threshold, it is determined that the watermark in the first watermark detection frame is an unauthorized watermark. When the similarity is greater than or equal to the second threshold, it is determined that the watermark in the first watermark detection frame is an authorized watermark, and the detection process ends.
[0089] Exemplarily, before obtaining the watermark region image according to the first image to be recognized, the method further includes:
[0090] Performing hash calculation on the reference image feature by using N hash functions to obtain N first hash values;
[0091] Determining N first databases from M databases according to the N first hash values; M is greater than or equal to N;
[0092] Storing the reference image feature into the N first databases.
[0093] Specifically, each of the M databases has a unique identifier, such as 1, 2, 3…, M. Assume that 5 hash functions are used to perform hash calculation on the reference image feature to obtain 5 first hash values, and the 5 first hash values are used as the identifiers of the databases to find 5 first databases. For example, if one of the first hash values is 1, then the database with the identifier 1 is found, and the reference image feature is stored into the database with the identifier 1. For example, if one of the first hash values is 3, then the database with the identifier 3 is found, and the reference image feature is stored into the database with the identifier 3. Among them, each of the M databases stores the features of multiple watermark images. Storing the reference image feature into N databases in this way is beneficial to improving the security of the reference image feature.
[0094] Exemplarily, a possible method for calculating the similarity between the target image feature and the reference image feature includes:
[0095] Performing hash calculation on the target image feature by using the N hash functions to obtain N second hash values;
[0096] Determining N second databases from M databases according to the N second hash values;
[0097] Calculating the Manhattan distance between the target image feature and the feature of each watermark image in each of the N second databases;
[0098] Determining the feature of a watermark image in each of the second databases that has the closest Manhattan distance to the target image feature;
[0099] Determining that the number P of the features of the watermark images in each of the second databases that have the closest Manhattan distance to the target image feature is the reference image feature; P is less than or equal to N;
[0100] Calculating the ratio of the number P to N, and using the ratio as the similarity between the target image feature and the reference image feature.
[0101] Specifically, the same five hash functions are used to perform hash calculation on the target image features to obtain five second hash values. These five second hash values may be exactly the same as the five first hash values, may be partially the same, or may be completely different. Similarly, using these five second hash values as the identifiers of the databases, five second databases are determined from M databases. The target image features are matched with each of the five second databases, and the Manhattan distance between the target image features and the features of each watermark image in each second database is calculated. Then, the watermark image with the closest distance is selected. If the features of the watermark image with the closest distance are the reference image features, then this second database is used as the target database. The number P of target databases is calculated, and the ratio P / N of P to N is calculated. This ratio P / N is used as the similarity between the target image features and the reference image features. In this way, when the reference image features may be stored in multiple databases, hash values are used to find N databases, and then the number of features that are the reference image features and are closest to the target image features in the N databases is obtained. The ratio of this number to N is used as the similarity. Since the matching covers N databases, it is beneficial to improve the comprehensiveness of similarity matching.
[0102] It can be seen that in the embodiment of the present application, a watermark region image is obtained from the first image to be recognized; the representation of the watermark region image in the frequency domain is obtained; the watermark region image is restored based on the representation of the watermark region image in the frequency domain to obtain a restored watermark region image; the restored watermark region image is pasted back to the first image to be recognized to obtain a second image to be recognized; the second image to be recognized is detected to obtain a first watermark detection frame and the confidence level of the first watermark detection frame; and according to the confidence level, it is determined whether the watermark in the first watermark detection frame is an authorized watermark or an unauthorized watermark. In this way, when the quality of the first image to be recognized is poor, the watermark region image in the first image to be recognized can be restored to obtain a second image to be recognized with better quality, and then the second image to be recognized with better quality is subjected to watermark detection, and the obtained confidence level is relatively more accurate, so that it can be more accurately determined whether it is an authorized watermark or an unauthorized watermark, improving the accuracy of watermark detection.
[0103] Please refer to Figure 4 , Figure 4 The flowchart of another watermark detection method provided by the embodiment of the present application is shown in Figure 4 as follows, including steps S41 - S47:
[0104] S41, obtaining a watermark region image from the first image to be recognized;
[0105] S42, obtaining the representation of the watermark region image in the frequency domain;
[0106] S43, obtain the target filter;
[0107] S44, based on the representation of the watermark region image in the frequency domain and the target filter, restore the watermark region image to obtain the restored watermark region image;
[0108] S45, paste the restored watermark region image back onto the first image to be recognized to obtain a second image to be recognized;
[0109] S46, detect the second image to be recognized to obtain a first watermark detection box and the confidence level of the first watermark detection box;
[0110] S47, determine whether the watermark in the first watermark detection box is an authorized watermark or an unauthorized watermark according to the confidence level.
[0111] Among them, the specific implementation manners of steps S41 - S47 are Figure 2 already described in the embodiments shown, and can achieve the same or similar beneficial effects. To avoid repetition, they will not be elaborated here.
[0112] Based on the description of the above embodiments of the watermark detection method, please refer to Figure 5 , Figure 5 which is a schematic structural diagram of a watermark detection device provided by an embodiment of the present application. As Figure 5 shown, the device includes:
[0113] A first detection module 51, configured to obtain a watermark region image according to a first image to be recognized;
[0114] The first acquisition module 51 is further configured to acquire the representation of the watermark region image in the frequency domain;
[0115] An image restoration module 52, configured to restore the watermark region image based on the representation of the watermark region image in the frequency domain to obtain a restored watermark region image;
[0116] The image restoration module 52 is further configured to paste the restored watermark region image back onto the first image to be recognized to obtain a second image to be recognized;
[0117] A second detection module 53, configured to detect the second image to be recognized to obtain a first watermark detection box and the confidence level of the first watermark detection box;
[0118] A determination module 54, configured to determine whether the watermark in the first watermark detection box is an authorized watermark or an unauthorized watermark according to the confidence level.
[0119] In a possible implementation, in terms of restoring the watermark region image based on the representation of the watermark region image in the frequency domain to obtain the restored watermark region image, the image restoration module 52 is specifically configured to:
[0120] Obtain a target filter;
[0121] Restore the watermark region image based on the representation of the watermark region image in the frequency domain and the target filter to obtain the restored watermark region image.
[0122] In a possible implementation, in terms of obtaining a target filter, the image restoration module 52 is specifically configured to:
[0123] Obtain a point spread function based on a two-dimensional Gaussian distribution;
[0124] Obtain the signal-to-noise ratio representation of the watermark region image;
[0125] Obtain the target filter according to the point spread function and the signal-to-noise ratio representation.
[0126] In a possible implementation, in terms of obtaining a watermark region image according to a first image to be recognized, the first detection module 51 is specifically configured to:
[0127] Detect the first image to be recognized to obtain a second watermark detection frame;
[0128] Crop the first image to be recognized based on the second watermark detection frame to obtain the watermark region image.
[0129] In a possible implementation, in terms of pasting the restored watermark region image back to the first image to be recognized to obtain a second image to be recognized, the image restoration module 52 is specifically configured to:
[0130] Segment the watermark in the first image to be recognized to obtain a watermark mask;
[0131] Perform Gaussian blur on the edge of the watermark mask;
[0132] Paste the watermark in the restored watermark region image back to the first image to be recognized based on the position where the first image to be recognized is cropped according to the second watermark detection frame and the watermark mask to obtain the second image to be recognized.
[0133] In a possible implementation, in terms of determining whether the watermark in the first watermark detection frame is an authorized watermark or an unauthorized watermark according to the confidence level, the determination module 54 is specifically configured to:
[0134] When the confidence level is less than the first threshold, determine that the watermark in the first watermark detection box is an unauthorized watermark;
[0135] When the confidence level is greater than or equal to the first threshold, perform feature extraction on the image area framed by the first watermark detection box to obtain target image features;
[0136] Obtain reference image features of a reference watermark image; the watermark in the reference watermark image is an authorized watermark with a specified category;
[0137] Obtain the similarity between the reference image features and the target image features;
[0138] When the similarity is less than the second threshold, determine that the watermark in the first watermark detection box is an unauthorized watermark;
[0139] When the similarity is greater than or equal to the second threshold, determine that the watermark in the first watermark detection box is an authorized watermark.
[0140] According to an embodiment of the present application, Figure 5 Each unit of the watermark detection device shown can be separately or all combined into one or several other units to form, or a certain (some) unit can be further split into multiple smaller units with functional division to form, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above units are divided based on logical functions. In actual applications, the function of one unit can also be realized by multiple units, or the functions of multiple units can be realized by one unit. In other embodiments of the present application, based on the watermark detection device, other units can also be included. In actual applications, these functions can also be assisted by other units and can be realized by the cooperation of multiple units.
[0141] According to another embodiment of the present application, it can be achieved by running a computer program (including program code) capable of executing the respective steps involved in the corresponding method shown in Figure 2 or Figure 4 on a general computing device such as a computer including processing elements and storage elements such as a central processing unit (CPU), a random access storage medium (RAM), and a read-only storage medium (ROM), to construct a watermark detection device as shown in Figure 5 and to implement the watermark detection method of the embodiments of the present application. The computer program can be recorded on a computer-readable recording medium, for example, and loaded into the above computing device through the computer-readable recording medium and run therein.
[0142] Based on the descriptions of the above method embodiments and device embodiments, the embodiments of the present application also provide an electronic device. Please refer toFigure 6 The electronic device at least includes a processor 61, an input device 62, an output device 63, and a computer storage medium 64. Among them, the processor 61, the input device 62, the output device 63, and the computer storage medium 64 in the electronic device can be connected through a bus or other means.
[0143] The computer storage medium 64 can be stored in the memory of the electronic device. The computer storage medium 64 is used to store a computer program. The computer program includes program instructions. The processor 61 is used to execute the program instructions stored in the computer storage medium 64. The processor 61 (or CPU (Central Processing Unit)) is the computing core and control core of the electronic device, and is adapted to implement one or more instructions. Specifically, it is adapted to load and execute one or more instructions to implement the corresponding method flow or corresponding function.
[0144] In one embodiment, the processor 61 of the electronic device provided in the embodiments of the present application can be used to perform a series of watermark detection processes:
[0145] Obtain a watermark region image according to a first image to be recognized;
[0146] Obtain the representation of the watermark region image in the frequency domain;
[0147] Restore the watermark region image based on the representation of the watermark region image in the frequency domain to obtain a restored watermark region image;
[0148] Paste the restored watermark region image back to the first image to be recognized to obtain a second image to be recognized;
[0149] Detect the second image to be recognized to obtain a first watermark detection box and the confidence level of the first watermark detection box;
[0150] Determine whether the watermark in the first watermark detection box is an authorized watermark or an unauthorized watermark according to the confidence level.
[0151] In another embodiment, when the processor 61 executes the operation of restoring the watermark region image based on the representation of the watermark region image in the frequency domain to obtain a restored watermark region image, it includes:
[0152] Obtain a target filter;
[0153] Restore the watermark region image based on the representation of the watermark region image in the frequency domain and the target filter to obtain the restored watermark region image.
[0154] In another embodiment, when the processor 61 executes the operation of obtaining the target filter, it includes:
[0155] Obtain a point spread function based on a two-dimensional Gaussian distribution;
[0156] Obtain a signal-to-noise ratio representation of the watermark region image;
[0157] Obtain the target filter according to the point spread function and the signal-to-noise ratio representation.
[0158] In another embodiment, the processor 61 executes obtaining the watermark region image according to the first image to be recognized, including:
[0159] Detect the first image to be recognized to obtain a second watermark detection frame;
[0160] Crop the first image to be recognized based on the second watermark detection frame to obtain the watermark region image.
[0161] In another embodiment, the processor 61 executes pasting the restored watermark region image back to the first image to be recognized to obtain a second image to be recognized, including:
[0162] Segment the watermark in the first image to be recognized to obtain a watermark mask;
[0163] Perform Gaussian blur on the edge of the watermark mask;
[0164] Paste the watermark in the restored watermark region image back to the first image to be recognized based on the position where the second watermark detection frame crops in the first image to be recognized and the watermark mask to obtain the second image to be recognized.
[0165] In another embodiment, the processor 61 executes determining whether the watermark in the first watermark detection frame is an authorized watermark or an unauthorized watermark according to the confidence level, including:
[0166] When the confidence level is less than a first threshold, determine that the watermark in the first watermark detection frame is an unauthorized watermark;
[0167] When the confidence level is greater than or equal to the first threshold, extract features of the image region framed by the first watermark detection frame to obtain target image features;
[0168] Obtain reference image features of a reference watermark image; the watermark in the reference watermark image is an authorized watermark with a specified category;
[0169] Obtain the similarity between the reference image features and the target image features;
[0170] When the similarity is less than the second threshold, determine that the watermark in the first watermark detection frame is an unauthorized watermark;
[0171] When the similarity is greater than or equal to the second threshold, determine that the watermark in the first watermark detection frame is an authorized watermark.
[0172] Exemplarily, the above electronic device may be a server, a cloud server, a computer host, a server cluster, a distributed system, etc. The electronic device includes but is not limited to a processor 61, an input device 62, an output device 63, and a computer storage medium 64. Those skilled in the art can understand that the schematic diagram is only an example of the electronic device, and does not constitute a limitation on the electronic device. It may include more or fewer components than shown in the figure, or combine some components, or different components.
[0173] It should be noted that since the processor 61 of the electronic device implements the steps in the above watermark detection method when executing a computer program, the embodiments of the above watermark detection method are all applicable to this electronic device and can achieve the same or similar beneficial effects.
[0174] The embodiment of the present application also provides a computer storage medium (Memory). The computer storage medium is a memory device in the electronic device and is used to store programs and data. It can be understood that the computer storage medium here can include both the built-in storage medium in the terminal and, of course, the extended storage medium supported by the terminal. The computer storage medium provides a storage space, and this storage space stores the operating system of the terminal. And, one or more instructions suitable for being loaded and executed by the processor 61 are stored in this storage space. These instructions can be one or more computer programs (including program codes). It should be noted that the computer storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory; optionally, it can also be at least one computer storage medium located far from the aforementioned processor 61. In one embodiment, one or more instructions stored in the computer storage medium can be loaded and executed by the processor 61 to implement the corresponding steps of the above watermark detection method; specifically, one or more instructions in the computer storage medium are loaded and executed by the processor 61 as follows:
[0175] Obtain a watermark region image according to the first image to be recognized;
[0176] Obtain the representation of the watermark region image in the frequency domain;
[0177] Restore the watermark region image based on the representation of the watermark region image in the frequency domain to obtain a restored watermark region image;
[0178] Paste the restored watermark region image back to the first image to be recognized to obtain a second image to be recognized;
[0179] Detect the second image to be recognized to obtain a first watermark detection box and the confidence level of the first watermark detection box;
[0180] Determine whether the watermark in the first watermark detection box is an authorized watermark or an unauthorized watermark according to the confidence level.
[0181] In another example, when one or more instructions in the computer storage medium are loaded by the processor 61, the following steps are further executed:
[0182] Obtain a target filter;
[0183] Restore the watermark region image based on the representation of the watermark region image in the frequency domain and the target filter to obtain the restored watermark region image.
[0184] In another example, when one or more instructions in the computer storage medium are loaded by the processor 61, the following steps are further executed:
[0185] Obtain a point spread function based on a two-dimensional Gaussian distribution;
[0186] Obtain the signal-to-noise ratio representation of the watermark region image;
[0187] Obtain the target filter according to the point spread function and the signal-to-noise ratio representation.
[0188] In another example, when one or more instructions in the computer storage medium are loaded by the processor 61, the following steps are further executed:
[0189] Detect the first image to be recognized to obtain a second watermark detection box;
[0190] Crop the first image to be recognized based on the second watermark detection box to obtain the watermark region image.
[0191] In another example, when one or more instructions in the computer storage medium are loaded by the processor 61, the following steps are further executed:
[0192] Segment the watermark in the first image to be recognized to obtain a watermark mask;
[0193] Perform Gaussian blur on the edge of the watermark mask;
[0194] Paste the watermark in the restored watermark region image back to the first image to be recognized based on the position where the second watermark detection frame crops in the first image to be recognized and the watermark mask, to obtain the second image to be recognized.
[0195] In another example, when one or more instructions in the computer storage medium are loaded by the processor 61, the following steps are further performed:
[0196] In the case where the confidence level is less than the first threshold, determine that the watermark in the first watermark detection frame is an unauthorized watermark;
[0197] In the case where the confidence level is greater than or equal to the first threshold, perform feature extraction on the image region framed by the first watermark detection frame to obtain target image features;
[0198] Obtain reference image features of a reference watermark image; the watermark in the reference watermark image is an authorized watermark with a specified category;
[0199] Obtain the similarity between the reference image features and the target image features;
[0200] In the case where the similarity is less than the second threshold, determine that the watermark in the first watermark detection frame is an unauthorized watermark;
[0201] In the case where the similarity is greater than or equal to the second threshold, determine that the watermark in the first watermark detection frame is an authorized watermark.
[0202] Exemplarily, the computer program of the computer storage medium includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium, etc.
[0203] It should be noted that since the computer program of the computer storage medium implements the steps in the above watermark detection method when executed by the processor, all embodiments of the above watermark detection method are applicable to this computer storage medium and can achieve the same or similar beneficial effects.
[0204] The above has introduced the embodiments of the present application in detail. Specific examples are used herein to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation on the present application.
Claims
1. A watermark detection method, characterized in that, the method includes: obtaining a watermark region image according to a first image to be recognized; acquiring the representation of the watermark region image in the frequency domain; restoring the watermark region image based on the representation of the watermark region image in the frequency domain to obtain a restored watermark region image; pasting the restored watermark region image back to the first image to be recognized to obtain a second image to be recognized; detecting the second image to be recognized to obtain a first watermark detection frame and the confidence level of the first watermark detection frame; determining whether the watermark in the first watermark detection frame is an authorized watermark or an unauthorized watermark according to the confidence level; the restoring the watermark region image based on the representation of the watermark region image in the frequency domain to obtain a restored watermark region image includes: obtaining a target filter; restoring the watermark region image based on the representation of the watermark region image in the frequency domain and the target filter to obtain the restored watermark region image; the obtaining a target filter includes: obtaining a point spread function based on a two-dimensional Gaussian distribution, and the point spread function is denoted as: Among them, A represents the amplitude, and (x 0 , y 0 ) is the coordinate of the center point of the peak of the two-dimensional Gaussian function. σ x 2 and σ y 2 are variances, and the value range is (0, 1]. (x, y) is a point of the two-dimensional Gaussian function in the x0y plane; acquiring the signal-to-noise ratio representation of the watermark region image; obtaining the target filter according to the point spread function and the signal-to-noise ratio representation.
2. The method according to claim 1, characterized in that, the obtaining a watermark region image according to a first image to be recognized includes: detecting the first image to be recognized to obtain a second watermark detection frame; cropping the first image to be recognized based on the second watermark detection frame to obtain the watermark region image.
3. The method according to claim 2, characterized in that, the pasting the restored watermark region image back to the first image to be recognized to obtain a second image to be recognized includes: segmenting the watermark in the first image to be recognized to obtain a watermark mask; performing Gaussian blur on the edge of the watermark mask; pasting the watermark in the restored watermark region image back to the first image to be recognized based on the position cropped by the second watermark detection frame in the first image to be recognized and the watermark mask to obtain the second image to be recognized.
4. The method according to claim 1, characterized in that, the determining whether the watermark in the first watermark detection frame is an authorized watermark or an unauthorized watermark according to the confidence level includes: when the confidence level is less than a first threshold, determining that the watermark in the first watermark detection frame is an unauthorized watermark; when the confidence level is greater than or equal to the first threshold, extracting features of the image region framed by the first watermark detection frame to obtain target image features; acquiring reference image features of a reference watermark image; the watermark in the reference watermark image is an authorized watermark with a specified category; acquiring the similarity between the reference image features and the target image features; when the similarity is less than a second threshold, determining that the watermark in the first watermark detection frame is an unauthorized watermark; when the similarity is greater than or equal to the second threshold, determining that the watermark in the first watermark detection frame is an authorized watermark.
5. A watermark detection device, characterized in that, the device comprises: a first detection module, configured to obtain a watermark region image according to a first image to be recognized; a first acquisition module, further configured to acquire a representation of the watermark region image in the frequency domain; an image restoration module, configured to restore the watermark region image based on the representation of the watermark region image in the frequency domain to obtain a restored watermark region image; the image restoration module is further configured to paste the restored watermark region image back to the first image to be recognized to obtain a second image to be recognized; a second detection module, configured to detect the second image to be recognized to obtain a first watermark detection frame and a confidence level of the first watermark detection frame; a determination module, configured to determine whether the watermark in the first watermark detection frame is an authorized watermark or an unauthorized watermark according to the confidence level; In terms of restoring the watermark region image based on the representation of the watermark region image in the frequency domain to obtain a restored watermark region image, the image restoration module specifically is configured to: obtain a target filter; restore the watermark region image based on the representation of the watermark region image in the frequency domain and the target filter to obtain the restored watermark region image; In terms of obtaining a target filter, the image restoration module specifically is configured to: obtain a point spread function based on a two-dimensional Gaussian distribution, and the point spread function is denoted as: Among them, A represents the amplitude, and (x 0 , y 0 ) is the coordinate of the center point of the peak of the two-dimensional Gaussian function, and σ x 2 and σ y 2 are variances, and the value range is (0, 1], and (x, y) is a point of the two-dimensional Gaussian function in the x0y plane; acquire a signal-to-noise ratio representation of the watermark region image; obtain the target filter according to the point spread function and the signal-to-noise ratio representation.
6. An electronic device, including an input device and an output device, characterized in that, it further comprises: a processor, adapted to implement one or more instructions; and, a computer storage medium storing one or more instructions, the one or more instructions being adapted to be loaded and executed by the processor to perform the method according to any one of claims 1-4.
7. A computer storage medium, characterized in that, the computer storage medium stores one or more instructions, the one or more instructions being adapted to be loaded and executed by a processor to perform the method according to any one of claims 1-4.
Citation Information
Patent Citations
Enhancement method and system of watermark characteristics
CN108573481A
Video processing method and device, electronic equipment and storage medium
CN110675310A
Watermark detection and video processing method and related equipment
CN111191591A
Watermark detection method and device, electronic equipment and storage medium
CN111798360A
Pathological section image processing method and device, electronic equipment and storage medium
CN111883237A