A zero-watermark generation method and device, equipment, medium and product and a zero-watermark detection method and device, equipment, medium and product
By constructing a code data feature matrix to generate zero-watermark images, the problem of difficulty in code copyright protection in existing technologies is solved, and copyright protection and post-event accountability are achieved without destroying the code logic.
Patent Information
- Application Number
- CN202511247812.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-03
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2045-09-03
AI Technical Summary
Existing digital watermarking methods cannot adapt to the characteristics of code data and may disrupt the business logic of the code, making it difficult to protect code copyright.
By constructing a feature matrix based on the number of key characters in the code data, a zero-watermark image is generated. Then, by using XOR operations and scrambling, a zero-watermark image that is not embedded in the code is generated, which is then monitored in conjunction with the registration management center.
It effectively protects the copyright of code files without affecting code usability, provides evidence for post-event accountability, resists attacks, and has high robustness.
Smart Images

Figure CN120823085B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the technical field of zero watermark, in particular to a zero watermark generation and detection method, device, equipment, medium and product. BACKGROUND
[0002] In the transmission process of the source code, it faces the risk of illegal transmission, copying and stealing, which not only seriously infringes the legitimate rights and interests of the developers, but also hinders the healthy development of the cloud computing industry.
[0003] As an important branch of information hiding technology, digital watermark technology can effectively protect copyright information and realize tracking and tracing in the data flow process, and has become a key technical means of data security.
[0004] However, the existing digital watermark method taking text data as a carrier mainly embeds digital watermark information by using text semantics and text format, and code data as a pure text file does not support the related settings of rich text (such as text style, document layout, etc.), and the embedded watermark method will have the risk of destroying the code business logic, so there is an urgent need for a solution that adapts to the characteristics of code data and does not destroy the code business logic to solve the current difficulties in code copyright protection. SUMMARY
[0005] The application provides a zero watermark generation and detection method, device, equipment, medium and product to solve the problem that the existing technology embeds digital watermark information by using text semantics and text format, which is not suitable for code data and will destroy the code business logic.
[0006] To achieve the above-mentioned purpose, the embodiment of the application provides a zero watermark generation method, comprising:
[0007] According to the number of each key character in the code data to be protected, a first character number set is constructed; wherein the key character is a single character defined in advance;
[0008] According to the size relationship of different elements in the first character number set, a first feature matrix is constructed;
[0009] Based on the preset watermark image and the first feature matrix, a zero watermark image is generated.
[0010] As an improvement of the above-mentioned scheme, the first feature matrix is constructed according to the size relationship of different elements in the first character number set, comprising:
[0011] The pth element and the qth element in the first character number set are compared;
[0012] determining the element in the mth row and the nth column of the first feature matrix as a first value when the pth element in the first character quantity set is greater than or equal to the qth element; wherein p and m have a first preset relationship, and q and n have a second preset relationship;
[0013] determining the element in the mth row and the nth column of the first feature matrix as a second value when the pth element in the first character quantity set is less than the qth element.
[0014] As an improvement of the above-mentioned scheme, the first character quantity set is constructed according to the quantity of each key character in the code data to be protected, comprising:
[0015] extracting all single characters of each element in the preset key data set to form a first single character set;
[0016] performing a scrambling process on the first single character set to obtain a second single character set;
[0017] traversing the code data to be protected, counting the quantity of each element in the second single character set in the code data to be protected, and forming the first character quantity set according to the element arrangement order of the second single character set.
[0018] As an improvement of the above-mentioned scheme, the zero watermark image is generated based on the preset watermark image and the first feature matrix, comprising:
[0019] performing an exclusive OR operation on the pixel value of the preset watermark image and the first feature matrix to generate the zero watermark image.
[0020] As an improvement of the above-mentioned scheme, the zero watermark image is generated based on the preset watermark image and the first feature matrix, comprising:
[0021] performing a scrambling process on the preset watermark image and / or the first feature matrix to obtain a first watermark image and / or a second feature matrix;
[0022] performing an exclusive OR operation on the pixel value of the first watermark image and the first feature matrix to obtain the zero watermark image, or performing an exclusive OR operation on the pixel value of the preset watermark image and the second feature matrix to obtain the zero watermark image, or performing an exclusive OR operation on the pixel value of the first watermark image and the second feature matrix to obtain the zero watermark image.
[0023] To achieve the above-mentioned purpose, the embodiments of the present application further provide a zero watermark detection method, comprising:
[0024] constructing a second character quantity set according to the quantity of each key character in the code data to be detected; wherein the key character is a single character defined in advance;
[0025] constructing a third feature matrix according to a size relationship of different elements in the second character quantity set;
[0026] obtaining a zero-watermark image from a registration management center;
[0027] obtaining a second watermark image based on the zero-watermark image and the third feature matrix;
[0028] judging whether the zero-watermark image is detected according to a similarity between a preset watermark image and the second watermark image.
[0029] As an improvement of the above-mentioned scheme, the third feature matrix is constructed according to a size relationship of different elements in the second character quantity set, and the method comprises the following steps.
[0030] comparing a pth element and a qth element in the second character quantity set;
[0031] when the pth element in the second character quantity set is greater than or equal to the qth element, determining that an element in an mth row and an n th column of the third feature matrix is a first value; wherein p and m have a first preset relationship, and q and n have a second preset relationship;
[0032] when the pth element in the second character quantity set is less than the qth element, determining that the element in the mth row and the n th column of the third feature matrix is a second value.
[0033] As an improvement of the above-mentioned scheme, the second character quantity set is constructed according to the number of each key character in the code data to be detected, and the method comprises the following steps.
[0034] extracting all single characters of each element in a preset key data set to form a first single character set;
[0035] performing a shuffling process on the first single character set to obtain a second single character set;
[0036] traversing the code data to be detected, counting the number of each element in the second single character set in the code data to be detected, and forming the second character quantity set according to the element arrangement order of the second single character set.
[0037] As an improvement of the above-mentioned scheme, the similarity between the preset watermark image and the second watermark image is judged to determine whether the zero-watermark image is detected, and the method comprises the following steps.
[0038] calculating the similarity according to the pixel value of the preset watermark image and the pixel value of the second watermark image;
[0039] when the similarity is greater than a preset similarity threshold, it is determined that the zero-watermark image is detected.
[0040] When the similarity is less than or equal to the preset similarity threshold, it is determined that the zero-watermark image is not detected.
[0041] As an improvement of the above scheme, the second watermark image is obtained based on the zero-watermark image and the third feature matrix, including:
[0042] The zero-watermark image and the third feature matrix are subjected to XOR operation to obtain the second watermark image.
[0043] As an improvement of the above scheme, the second watermark image is obtained based on the zero-watermark image and the third feature matrix, including:
[0044] The pixel value of the zero-watermark image and the third feature matrix are subjected to XOR operation to obtain a third watermark image; the third watermark image is subjected to inverse shuffling processing to obtain the second watermark image; or,
[0045] The third feature matrix is subjected to shuffling processing to obtain a fourth feature matrix; the pixel value of the zero-watermark image and the fourth feature matrix are subjected to XOR operation to obtain the second watermark image; or,
[0046] The third feature matrix is subjected to shuffling processing to obtain a fifth feature matrix; the pixel value of the zero-watermark image and the fifth feature matrix are subjected to XOR operation to obtain a fourth watermark image; the fourth watermark image is subjected to inverse shuffling processing to obtain the second watermark image.
[0047] To achieve the above object, the embodiment of the present application further provides a zero-watermark generation device, comprising:
[0048] A first construction module is configured to construct a first character number set according to the number of each key character in the code data to be protected.
[0049] A second construction module is configured to construct a first feature matrix according to the size relationship of different elements in the first character number set.
[0050] A first XOR module is configured to generate a zero-watermark image based on a preset watermark image and the first feature matrix.
[0051] To achieve the above object, the embodiment of the present application further provides a zero-watermark detection device, comprising:
[0052] A third construction module is configured to construct a second character number set according to the number of each key character in the code data to be detected.
[0053] A fourth construction module is configured to construct a third feature matrix according to the size relationship of different elements in the second character number set.
[0054] The acquisition module is configured to acquire the zero-watermark image from the registration management center.
[0055] The second XOR module is configured to obtain a second watermark image based on the zero-watermark image and the third feature matrix.
[0056] The detection module is configured to determine whether the zero-watermark image is detected according to the similarity between the preset watermark image and the second watermark image.
[0057] To achieve the above object, the embodiments of the present application further provide an electronic device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor implements the zero-watermark generation method or the zero-watermark detection method when executing the computer program.
[0058] To achieve the above object, the embodiments of the present application further provide a computer readable storage medium, comprising a stored computer program; wherein the computer program controls the device where the computer readable storage medium is located to execute the zero-watermark generation method or the zero-watermark detection method when running.
[0059] To achieve the above object, the embodiments of the present application further provide a computer program product, comprising computer programs / instructions, which implement the zero-watermark generation method or the zero-watermark detection method when executed by a processor.
[0060] Compared with the prior art, the zero-watermark generation and detection method, device, equipment, medium and product provided by the embodiments of the present application can construct a first character number set through the number of each key character in the code data to be protected, accurately capture the character distribution characteristics in the code data to be protected, provide a basis for subsequent construction of a first feature matrix, and realize deep adaptation with the characteristics of the code data. Moreover, the character distribution characteristics have strong stability, and the zero-watermark image constructed by using the character distribution characteristics can effectively resist increasing, deleting, reordering and composite attack behaviors, and has higher robustness. Further, the zero-watermark image constructed by the embodiments of the present application does not need to embed the code to be protected, does not modify the code file, and can avoid destroying the original business logic of the code. Finally, the copyright protection of the code file can be realized without affecting the usability of the code, an effective basis for post-factum accountability is provided for the event of leakage, theft or illegal transmission of the code file, and the interests of the owner of the code are protected. BRIEF DESCRIPTION OF DRAWINGS
[0061] Figure 1 is a flowchart of a zero-watermark generation method provided by the embodiments of the present application;
[0062] Figure 2 is a flowchart of a zero-watermark detection method provided by an embodiment of the present application;
[0063] Figure 3 is a flowchart of a zero-watermark generation and detection method provided by an embodiment of the present application;
[0064] Figure 4 is a structural block diagram of a zero-watermark generation apparatus provided by an embodiment of the present application;
[0065] Figure 5 is a structural block diagram of a zero-watermark detection apparatus provided by an embodiment of the present application;
[0066] Figure 6 is a structural block diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0067] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0068] In the description of the present application, the size of the serial number of each process does not mean the execution order. The execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0069] In the description of the present application, the term "exemplary" or "for example" is used to represent as an example, illustration or description. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. Rather, the term "exemplary" or "for example" is intended to present the relevant concept in a specific manner.
[0070] In the description of the application, the terms "first", "second", etc. are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices. The term "based on" is "at least partially based on". The term "according to" is "at least partially according to". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The term "and / or" means at least one of the connected objects, for example, A and / or B means three cases including A alone, B alone, and A and B both. Unless otherwise stated, the term "a plurality of" means two or more.
[0071] Referring to Figure 1 , Figure 1 is a flowchart of a zero watermark generation method provided by an embodiment of the application, the zero watermark generation method comprising:
[0072] S11, according to the number of each key character in the code data to be protected, a first character number set is constructed; wherein the key character is a pre-defined single character;
[0073] It is worth noting that, by the number of each key character in the code data to be protected, the first character number set is constructed, which can accurately capture the character distribution characteristics in the code data to be protected, providing a basis for subsequent construction of the first feature matrix, and realizing deep adaptation with the characteristics of the code data. Moreover, the character distribution characteristics have strong stability, and the zero watermark image constructed using them can effectively resist addition, deletion, reordering and composite attack behavior, and has higher robustness.
[0074] For example, the key character is a pre-defined single character, which can be directly defined by the user or extracted from the key information set defined by the user. Specifically, according to the data structure of the development language used by the code data to be protected, the mandatory text symbols in the data structure form a key information set; extract all single characters of each element in the key data set, which are the key characters.
[0075] Exemplarily, a single character set composed of key characters is set, the number of key characters appearing in the code data to be protected is directly counted to form a first character number set; the first character number set is composed of the number of key characters in the code data to be protected, and the total number of elements is the number of types of key characters in the code data to be protected.
[0076] Exemplarily, the number of each element in the single character set in the code data to be protected can also be counted to form the first character number set; the first character number set not only includes the number of key characters in the code data to be protected, but also includes the number of key characters appearing in the key character set but not appearing in the code data to be protected, and the set is specifically composed of the number of each element in the key character set in the code data to be protected, and the total number of elements is the total number of elements in the key character set.
[0077] S12, a first feature matrix is constructed according to the size relationship of different elements in the first character number set;
[0078] It is worth noting that the embodiment of the present application not only realizes the feature extraction of the code data to be protected, but also has strong stability by using the first feature matrix constructed by the character distribution feature on the basis of the extracted features, so that the zero watermark image constructed by using the first feature matrix can effectively resist the increase, deletion, sequence adjustment and composite attack behaviors, and has higher robustness.
[0079] S13, generating a zero watermark image based on a preset watermark image and the first feature matrix.
[0080] Exemplarily, the preset watermark image can be provided by a user, which is used as an original watermark image for generating and detecting a zero watermark image subsequently.
[0081] The zero watermark image constructed by the embodiment of the present application does not need to be embedded in the code to be protected, does not modify the code file, and can avoid destroying the original business logic of the code. Finally, the copyright protection of the code file can be realized without affecting the usability of the code, which provides an effective basis for the post-factum accountability of the code file in the event of leakage, theft or illegal transmission, and maintains the interests of the code owner.
[0082] Further, the generated zero watermark image is registered in a registration management center (for example, a third party institution) to facilitate dynamic monitoring by the registration management center and timely discovery of abnormal propagation behaviors. Of course, the generated zero watermark image and the required copyright information (for example, a key k) can also be registered in the registration management center to facilitate subsequent acquisition of the copyright information.
[0083] In an optional embodiment, the first feature matrix is constructed according to the size relationship of different elements in the first character number set, comprising:
[0084] comparing the pth element and the qth element in the first character quantity set;
[0085] when the pth element in the first character quantity set is greater than or equal to the qth element, determining the element in the mth row and the nth column of the first feature matrix as a first value; wherein p and m have a first preset relationship, and q and n have a second preset relationship;
[0086] when the pth element in the first character quantity set is less than the qth element, determining the element in the mth row and the nth column of the first feature matrix as a second value.
[0087] The embodiment of the application establishes an ordered first feature matrix construction process by determining whether the element in the mth row and the nth column of the first feature matrix is the first value or the second value according to the size relationship between the pth element and the qth element in the first character quantity set, and the corresponding relationship between p and m and q and n, which can effectively improve the construction speed and lay a foundation for efficient generation of zero watermark images.
[0088] For example, in order to enrich the first feature matrix, the mapping relationship between the element position of the first feature matrix and the element size of the first character quantity set needs to be preset as follows: the first preset relationship is p = m, and the second preset relationship is q = n + (total number of elements in the first character quantity set ÷ 2); or, the first preset relationship is p = m + (total number of elements in the first character quantity set ÷ 2), and the second preset relationship is q = n. In this way, the total number of elements of the first feature matrix can be maximized, thereby improving data security.
[0089] For example, the total number of elements of the first character quantity set is 60, that is, there are 60 elements in the first character quantity set . The first feature matrix of is constructed by traversing the first character quantity set , where r = 30. The value of the element in the mth row and the nth column of the first feature matrix is , as shown in the formula:
[0090]
[0091] In the formula, is the mth element of the first character quantity set, is the n+30th element of the first character quantity set.
[0092] Here the first feature matrix is composed of 0 and 1, in order to guarantee the subsequent XOR operation smoothly, the preset watermark image is a binary image, so that the first watermark image obtained after the shuffling processing is also a binary image.
[0093] In an alternative embodiment, the first character number set is constructed according to the number of each key character in the code data to be protected, comprising:
[0094] Extract all single characters of each element in the preset key data set to form a first single character set;
[0095] Shuffling the first single character set to obtain a second single character set;
[0096] Traverse the code data to be protected, count the number of each element in the second single character set in the code data to be protected, and form the first character number set according to the element arrangement order of the second single character set.
[0097] The embodiments of the present application obtain the second single character set by shuffling the first single character set, then count the number of each element in the second single character set in the code data to be protected, and form the first character number set, which improves the security of the first character number set, further guarantees the data security, and increases the difficulty of attackers to extract and forge zero watermark.
[0098] Specifically, the first single character set is shuffled by Logistic chaotic mapping to obtain the second single character set:
[0099] Generate a chaotic sequence with the same total number of elements as the total number of elements of the first single character set by Logistic chaotic mapping;
[0100] Establish a one-to-one correspondence between the elements of the first single character set and the chaotic sequence;
[0101] Resort the chaotic sequence according to the data size, and resort the first single character sequence according to the reordered chaotic sequence to obtain the second single character set.
[0102] For example, according to the data structure of the development language used by the code data to be protected, the key information set is constructed , wherein represents that the set includes mandatory text symbols contained in the development language (i.e. code engineering) used by the code data to be protected, such as const, let, {}, ( ), etc. represents the number of selected mandatory text symbols, i.e. the total number of elements of the key information set.
[0103] Let the first single character set , wherein represents all single characters constituting elements in K, including 52 capital and small letters and 60 symbols ',', '.', '{', '(', '[', '}', ')', ']'. Since the first single character set affects the subsequent constructed feature matrix, in order to ensure randomness, the set is preprocessed by using a Logistic chaotic mapping, and the mapping formula is: ; wherein, represents a control parameter, , , represents a state variable, represents a current state, represents a next state, represents a Logistic chaotic mapping function. Take the limit value , research shows that when , the mapping is in a chaotic state, here , let the initial state , represents the total number of elements of the key information set. After the permutation by the mapping formula, the second single character set is obtained as . Traverse the code data to be protected to obtain the first character quantity set , , wherein, represents the number of the jth element in in the code data to be protected.
[0104] In an optional embodiment, the generating of the zero watermark image based on the preset watermark image and the first feature matrix comprises:
[0105] performing exclusive OR operation on pixel values of the preset watermark image and the first feature matrix to generate the zero watermark image.
[0106] Embodiments of the present application can quickly generate a zero watermark image by directly performing exclusive OR operation on the zero watermark image and the first feature matrix to obtain a second watermark image.
[0107] In an optional embodiment, the generating of the zero watermark image based on the preset watermark image and the first feature matrix comprises:
[0108] performing permutation processing on the preset watermark image and / or the first feature matrix to obtain a first watermark image and / or a second feature matrix;
[0109] performing exclusive OR operation on pixel values of the first watermark image and the first feature matrix to obtain the zero-watermark image.
[0110] The embodiment of the present application changes the original pixel arrangement order of the preset watermark image and / or the original element arrangement order of the first feature matrix through the scrambling processing, so that the original watermark information and / or the first feature matrix become disordered, and the difficulty of extracting and forging the zero-watermark by an attacker is increased.
[0111] The embodiment of the present application provides three methods for generating a zero-watermark image based on exclusive OR operation and scrambling processing. Specifically, performing scrambling processing on the preset watermark image to obtain a first watermark image; performing exclusive OR operation on pixel values of the first watermark image and the first feature matrix to obtain the zero-watermark image.
[0112] Specifically, performing scrambling processing on the first feature matrix to obtain a second feature matrix; performing exclusive OR operation on pixel values of the preset watermark image and the second feature matrix to obtain the zero-watermark image.
[0113] Specifically, performing scrambling processing on the preset watermark image and the first feature matrix to obtain a first watermark image and a second feature matrix; performing exclusive OR operation on pixel values of the first watermark image and the second feature matrix to obtain the zero-watermark image.
[0114] The first feature matrix has a clear number of rows and columns, and based on this structural characteristic, it can be regarded as an image. Therefore, the scrambling processing of the preset watermark image and the first feature matrix can be realized through Arnold transformation (cat face transformation). The scrambling processing of the preset watermark image and the first feature matrix can be the same, and the scrambling processing of the preset watermark image is taken as an example below:
[0115] For a preset watermark image of order N, the scrambling processing of the preset watermark image is performed through positive transformation of Arnold transformation (cat face transformation). The positive transformation formula of Arnold transformation is: ; wherein is the pixel point coordinate of the image (for example, the preset watermark image) before positive transformation; is the pixel point coordinate of the image (for example, the first watermark image) after positive transformation; mod is a modulus operation, N is the order of the image to be Arnold transformed (for example, the preset watermark image here); A is a transformation matrix, which can be set according to actual needs, for example The embodiment of the present application does not make specific limitation.
[0116] Further, in order to enhance the security of the first watermark image, the preset watermark image is subjected to a positive transformation of Arnold transformation using a key k, which can be expressed as wherein C is the image before the positive transformation, and I is the image after the positive transformation. Specifically, the number of Arnold transformations is taken as the key k, and the first watermark image is obtained by subjecting the first watermark image to k times of positive transformation of Arnold transformation. Compared with only one Arnold transformation, the security can be improved, and the difficulty of extracting and forging the zero watermark by an attacker is further increased.
[0117] Referring to Figure 2 , Figure 2 is a flowchart of a zero watermark detection method provided by an embodiment of the present application. The zero watermark detection method comprises the following steps:
[0118] S21, a second character quantity set is constructed according to the number of each key character in the code data to be detected, wherein the key character is a single character defined in advance;
[0119] It should be noted that the construction logic of the first character quantity set of the code data to be protected is reused to reconstruct the second character quantity set of the code data to be detected, so as to ensure the uniformity of the feature extraction logic in zero watermark detection and zero watermark generation, and to provide protection for accurate detection of the zero watermark image. The construction method of the second character quantity set can refer to the construction method of the first character quantity set, which will not be described here.
[0120] Specifically, the code data to be detected is a code file to be detected, and can also be other forms of data with character features, which will not be specifically limited here.
[0121] S22, a third feature matrix is constructed according to the size relationship of different elements in the second character quantity set;
[0122] Specifically, the construction logic of the first feature matrix of the code data to be protected is reused to reconstruct the third character quantity set of the code data to be detected, so as to ensure the uniformity of the feature extraction logic in zero watermark detection and zero watermark generation, and to provide protection for accurate detection of the zero watermark image. The construction method of the third feature matrix can refer to the construction method of the first character quantity set, which will not be described here.
[0123] S23, a zero watermark image is obtained from a registration management center;
[0124] It should be noted that the registration management center registers the zero watermark image, avoids tampering of the zero watermark image, guarantees the reliability of the zero watermark detection, and avoids interference of false zero watermark without registration. Further, the registration management center also stores corresponding copyright information, such as the key k.
[0125] S24, obtaining a second watermark image based on the zero watermark image and the third feature matrix;
[0126] It is worth noting that when the code data to be detected has copyright protection, the third feature matrix and the first feature matrix generated thereby are aligned in features, and thus the second watermark image that matches the preset watermark image can be restored by using the zero watermark image and the third feature matrix.
[0127] S25, judging whether the zero watermark image is detected according to the similarity between the preset watermark image and the second watermark image.
[0128] The embodiment of the present application generates the zero watermark image based on the above method, and uses a corresponding method to detect whether the code data to be detected has the zero watermark image. If yes, it indicates that the code data to be detected has copyright protection, otherwise, the code data to be detected has no copyright protection.
[0129] The embodiment of the present application multiplexes the first feature matrix of the code data to be protected to construct logic, reconstructs the third feature matrix of the code data to be detected, ensures the uniformity of the feature extraction logic in the zero watermark detection and the zero watermark generation from the root, accurately reproduces the third feature matrix, improves the accuracy of the zero watermark detection, generates the second watermark image from the zero watermark image of the registration management center, compares it with the preset watermark image, and accurately identifies the copyright association between the code data to be detected and the preset watermark image, i.e. the original watermark image. The embodiment of the present application relies on the character distribution characteristics of the code data to be detected, determines the copyright ownership of the code data to be detected through similarity, realizes the copyright protection of the code file without affecting the usability of the code, provides an effective basis for the after-the-fact accountability of the code file leakage, theft and illegal transmission events, and maintains the interests of the code owner.
[0130] In an optional embodiment, the third feature matrix is constructed according to the size relationship of different elements in the second character quantity set, comprising:
[0131] Comparing the pth element and the qth element in the second character quantity set;
[0132] When the pth element in the second character quantity set is greater than or equal to the qth element, the mth row and the nth column element of the third feature matrix is determined as the first value; wherein p and m have a first preset relationship, q and n have a second preset relationship;
[0133] When the pth element in the second character quantity set is less than the qth element, the mth row and the nth column element of the third feature matrix is determined as the second value.
[0134] The embodiment of the application establishes an ordered third feature matrix construction process by determining whether the element in the mth row and the nth column of the third feature matrix is the first value or the second value according to the size relationship between the pth element and the qth element in the second character quantity set, the corresponding relationship between p and m, and the corresponding relationship between q and n, so as to effectively improve the construction speed and lay a foundation for efficient detection of the zero watermark image.
[0135] The specific construction method of the third feature matrix can refer to the construction method of the first character quantity set, which is not described herein again.
[0136] In an optional embodiment, the construction of the second character quantity set according to the quantity of each key character in the code data to be detected comprises:
[0137] All single characters of each element in the preset key data set are extracted to form a first single character set;
[0138] The first single character set is subjected to a shuffling process to obtain a second single character set;
[0139] The quantity of each element in the second single character set in the code data to be detected is counted, and the second character quantity set is formed according to the element arrangement order of the second single character set.
[0140] The embodiment of the application forms the second character quantity set by counting the quantity of each element in the shuffled second single character set in the code data to be detected, which is adapted to the generation of the first character quantity set, ensures the uniformity of the feature extraction logic in zero watermark detection and zero watermark generation, and improves the detection accuracy.
[0141] The specific construction method of the second character quantity set can refer to the construction method of the first character quantity set, which is not described herein again.
[0142] In an optional embodiment, the determination of whether the zero watermark image is detected according to the similarity between the preset watermark image and the second watermark image comprises:
[0143] The similarity is calculated according to the pixel value of the preset watermark image and the pixel value of the second watermark image;
[0144] When the similarity is greater than a preset similarity threshold, it is determined that the zero watermark image is detected;
[0145] When the similarity is less than or equal to the preset similarity threshold, it is determined that the zero watermark image is not detected.
[0146] The embodiment of the present application compares the preset watermark image with the second watermark image in similarity; when the similarity is greater than a preset similarity threshold, it is determined that the zero watermark image is detected, which indicates that the code data to be detected has copyright protection; when the similarity is less than or equal to the preset similarity threshold, it is determined that the zero watermark image is not detected, which indicates that the code data to be detected does not have copyright protection and may be illegally transmitted or copied.
[0147] Specifically, the preset watermark image and the second watermark image are binary images, and a pixel-based algorithm is preferably used to calculate the similarity between the two, for example, Mean Squared Error (MSE), Peak Signal-to-Noise Ratio (PSNR), Structural Similarity Index Measure (SSIM), Normalized Correlation (NC), etc. The embodiment of the present application is not limited to the calculation method of the similarity.
[0148] For example, NC is used to calculate the similarity between the preset watermark image and the second watermark image:
[0149]
[0150] In the formula, M represents the number of rows of the preset watermark image, N represents the number of columns of the preset watermark image, represents the pixel value of the second watermark image, represents the pixel value of the preset watermark image, and XNOR represents the exclusive-NOR operation.
[0151] The closer the calculated NC value is to 1, the more similar the preset watermark image and the second watermark image are. For example, the preset similarity threshold = 0.75, and when the calculated NC value > 0.75, it is determined that the zero watermark image is detected.
[0152] In an optional embodiment, the second watermark image is obtained based on the zero watermark image and the third feature matrix, including:
[0153] The exclusive-NOR operation is performed on the zero watermark image and the third feature matrix to obtain the second watermark image.
[0154] In the embodiment of the present application, when the exclusive-NOR operation is directly performed on the pixel value of the preset watermark image and the first feature matrix in the zero watermark generation method to generate the zero watermark image, based on the reversibility of the exclusive-NOR operation, the exclusive-NOR operation is directly performed on the zero watermark image and the third feature matrix to restore the second watermark image that matches the features of the preset watermark image.
[0155] In an alternative embodiment, the second watermark image is obtained based on the zero-watermark image and the third feature matrix, comprising:
[0156] performing XOR operation on the pixel value of the zero-watermark image and the third feature matrix to obtain a third watermark image; performing inverse scrambling processing on the third watermark image to obtain the second watermark image; or,
[0157] performing scrambling processing on the third feature matrix to obtain a fourth feature matrix; performing XOR operation on the pixel value of the zero-watermark image and the fourth feature matrix to obtain the second watermark image; or,
[0158] performing scrambling processing on the third feature matrix to obtain a fifth feature matrix; performing XOR operation on the pixel value of the zero-watermark image and the fifth feature matrix to obtain a fourth watermark image; performing inverse scrambling processing on the fourth watermark image to obtain the second watermark image.
[0159] The embodiments of the present application provide three restoration methods of the second watermark image, which correspond to the three methods of generating the zero-watermark image based on XOR operation and scrambling processing described above, respectively.
[0160] (1) The generation method is: performing scrambling processing on the preset watermark image to obtain a first watermark image; performing XOR operation on the pixel value of the first watermark image and the first feature matrix to obtain the zero-watermark image. The restoration method is: performing XOR operation on the pixel value of the zero-watermark image and the third feature matrix to obtain a third watermark image; performing inverse scrambling processing on the third watermark image to obtain the second watermark image.
[0161] It is worth noting that, based on the reversibility of XOR operation, performing XOR operation on the zero-watermark image and the third feature matrix can restore the image (here, the third watermark image) that matches the scrambled preset watermark image (i.e., the first watermark image) in feature, and then by performing inverse scrambling processing on the third watermark image, the scrambling processing of the first watermark image in the zero-watermark generation stage is restored to recover the original watermark image, i.e., the preset watermark image, to provide reliable data for subsequent similarity judgment.
[0162] For example, inverse Arnold transformation (cat face transformation) is performed on the third watermark image to perform inverse scrambling processing. The inverse Arnold transformation formula is: ; wherein is the pixel point coordinate of the image after inverse transformation (e.g., the second watermark image); is the pixel point coordinate of the image before inverse transformation (e.g., the third watermark image); mod is the modulus operation, and N is the order of the image to be Arnold transformed (e.g., the second watermark image here). is an inverse transform matrix, A and are inverse matrices of each other, for example .
[0163] Further, the inverse transform of the Arnold transform of the third watermark image using the key k can be expressed as where C is the image after the inverse transform and I is the image before the inverse transform. Specifically, the number of Arnold transforms is taken as the key k, and the second watermark image is obtained by performing the inverse transform of k times of Arnold transform on the third watermark image.
[0164] (2) The generation method is: performing shuffling processing on the first feature matrix to obtain a second feature matrix; performing XOR operation on the pixel value of the preset watermark image and the second feature matrix to obtain the zero watermark image. The restoration method is: performing shuffling processing on the third feature matrix to obtain a fourth feature matrix; performing XOR operation on the pixel value of the zero watermark image and the fourth feature matrix to obtain the second watermark image.
[0165] The embodiment of the present application constructs the fourth feature matrix by multiplexing the construction logic of the second feature matrix, which ensures the uniformity of the feature extraction logic in zero watermark detection and zero watermark generation. Then, based on the reversibility of the XOR operation, the XOR operation is performed on the zero watermark image and the fourth feature matrix, which can restore the image (here, the second watermark image) matching the features of the preset watermark image, thereby providing reliable data for subsequent similarity judgment.
[0166] The specific shuffling processing can be implemented by Arnold transform, which can be referred to the shuffling processing of the preset watermark image described above, and will not be described here.
[0167] (3) The generation method is: performing shuffling processing on the preset watermark image and the first feature matrix to obtain the first watermark image and the second feature matrix; performing XOR operation on the pixel value of the first watermark image and the second feature matrix to obtain the zero watermark image. The restoration method is: performing shuffling processing on the third feature matrix to obtain a fifth feature matrix; performing XOR operation on the pixel value of the zero watermark image and the fifth feature matrix to obtain a fourth watermark image; performing inverse shuffling processing on the fourth watermark image to obtain the second watermark image. The generation method and the restoration method realize the zero watermark generation and detection method provided by the embodiment of the present application as shown in Figure 3 .
[0168] The embodiment of the application constructs the fifth feature matrix by using the construction logic of the second feature matrix, and ensures that the feature extraction logic in zero watermark detection and zero watermark generation is uniform. Then, based on the reversibility of the XOR operation, the zero watermark image and the fifth feature matrix are subjected to XOR operation, which can restore the image (here, the fourth watermark image) that matches the feature of the preset watermark image (i.e., the first watermark image) after scrambling. Finally, by performing anti-scrambling processing on the fourth watermark image, the scrambling processing of the first watermark image in the zero watermark generation stage is restored, so as to restore the original watermark image, i.e., the preset watermark image, and provide reliable data for subsequent similarity judgment.
[0169] Referring to Figure 4 , Figure 4 is a structural block diagram of a zero watermark generation device 10 provided by the embodiment of the application. The zero watermark generation device 10 comprises:
[0170] A first construction module 11 is configured to construct a first character quantity set according to the number of each key character in the code data to be protected. The key character is a single character defined in advance.
[0171] A second construction module 12 is configured to construct a first feature matrix according to the size relationship of different elements in the first character quantity set.
[0172] A first XOR module 13 is configured to generate a zero watermark image based on a preset watermark image and the first feature matrix.
[0173] Optionally, the second construction module 12 is specifically configured to:
[0174] compare the pth element and the qth element in the first character quantity set;
[0175] when the pth element in the first character quantity set is greater than or equal to the qth element, determine that the element in the mth row and the nth column of the first feature matrix is a first value; wherein p and m have a first preset relationship, and q and n have a second preset relationship;
[0176] when the pth element in the first character quantity set is less than the qth element, determine that the element in the mth row and the nth column of the first feature matrix is a second value.
[0177] Optionally, the first construction module 11 is specifically configured to:
[0178] extract all single characters of each element in the preset key data set to form a first single character set;
[0179] perform scrambling processing on the first single character set to obtain a second single character set;
[0180] Traverse the to-be-protected code data, count the number of each element in the second single character set in the to-be-protected code data, and form the first character number set according to the element arrangement order of the second single character set.
[0181] Optionally, the first exclusive or module 13 is specifically configured to:
[0182] The pixel value of the preset watermark image and the first feature matrix are subjected to exclusive or operation to generate the zero watermark image.
[0183] Optionally, the first exclusive or module 13 is specifically configured to:
[0184] The preset watermark image and / or the first feature matrix are subjected to scrambling processing to obtain a first watermark image and / or a second feature matrix;
[0185] The pixel value of the first watermark image and the first feature matrix are subjected to exclusive or operation to obtain the zero watermark image, or the pixel value of the preset watermark image and the second feature matrix are subjected to exclusive or operation to obtain the zero watermark image, or the pixel value of the first watermark image and the second feature matrix are subjected to exclusive or operation to obtain the zero watermark image.
[0186] It is worth noting that the working process of each module in the zero watermark generation device 10 described in the embodiments of the present application can refer to the working process of the zero watermark generation method described in the above embodiments, and achieve the same beneficial effects, which will not be described here.
[0187] Referring to Figure 5 , Figure 5 is a structural block diagram of a zero watermark detection device 20 provided by an embodiment of the present application, the zero watermark detection device 20 comprises:
[0188] A third construction module 21 is configured to construct a second character number set according to the number of each key character in the to-be-detected code data; wherein the key character is a pre-defined single character;
[0189] A fourth construction module 22 is configured to construct a third feature matrix according to the size relationship of different elements in the second character number set;
[0190] An acquisition module 23 is configured to acquire a zero watermark image from a registration management center;
[0191] A second exclusive or module 24 is configured to obtain a second watermark image based on the zero watermark image and the third feature matrix;
[0192] A detection module 25 is configured to judge whether the zero watermark image is detected according to the similarity between a preset watermark image and the second watermark image.
[0193] Optionally, the fourth construction module 22 is specifically configured to:
[0194] compare the pth element and the qth element in the second character quantity set;
[0195] when the pth element in the second character quantity set is greater than or equal to the qth element, determine the element in the mth row and the nth column of the third feature matrix as a first value; wherein p and m have a first preset relationship, and q and n have a second preset relationship;
[0196] when the pth element in the second character quantity set is less than the qth element, determine the element in the mth row and the nth column of the third feature matrix as a second value.
[0197] Optionally, the third construction module 21 is specifically configured to:
[0198] extract all single characters of each element in the preset key data set to form a first single character set;
[0199] perform shuffling processing on the first single character set to obtain a second single character set;
[0200] traverse the to-be-detected code data, count the number of each element in the second single character set in the to-be-detected code data, and form the second character quantity set according to the element arrangement order of the second single character set.
[0201] Optionally, the detection module 25 is specifically configured to:
[0202] calculate the similarity according to the pixel value of the preset watermark image and the pixel value of the second watermark image;
[0203] when the similarity is greater than a preset similarity threshold, determine that a zero watermark image is detected;
[0204] when the similarity is less than or equal to the preset similarity threshold, determine that no zero watermark image is detected.
[0205] Optionally, the second XOR module 24 is specifically configured to:
[0206] perform XOR operation on the zero watermark image and the third feature matrix to obtain the second watermark image.
[0207] Optionally, the second XOR module 24 is specifically configured to:
[0208] perform XOR operation on the pixel value of the zero watermark image and the third feature matrix to obtain a third watermark image; perform inverse shuffling processing on the third watermark image to obtain the second watermark image; or
[0209] performing scrambling processing on the third feature matrix to obtain a fourth feature matrix, and performing exclusive OR operation on the pixel value of the zero-watermark image and the fourth feature matrix to obtain the second watermark image; or
[0210] performing scrambling processing on the third feature matrix to obtain a fifth feature matrix, performing exclusive OR operation on the pixel value of the zero-watermark image and the fifth feature matrix to obtain a fourth watermark image, and performing inverse scrambling processing on the fourth watermark image to obtain the second watermark image.
[0211] It is worth noting that the working process of each module in the zero-watermark detection device 20 described in the embodiments of the present application can refer to the working process of the zero-watermark detection method described in the above embodiments, and achieve the same beneficial effects, which will not be described here.
[0212] In addition, the embodiments of the present application also provide a computer readable storage medium, which includes a stored computer program; wherein the computer program controls the device where the computer readable storage medium is located to execute the zero-watermark generation method according to any one of the above embodiments, or the zero-watermark detection method according to any one of the above embodiments when running.
[0213] In addition, the embodiments of the present application also provide a computer program product, which includes computer programs / instructions, and the computer programs / instructions are executed by a processor to implement the zero-watermark generation method according to any one of the above embodiments, or the zero-watermark detection method according to any one of the above embodiments.
[0214] Referring to Figure 6 , Figure 6 is a structural block diagram of an electronic device 30 provided by the embodiments of the present application, which includes a processor 31, a memory 32, and a computer program stored in the memory 32 and executable on the processor 31. The processor 31 implements the steps in the above zero-watermark generation method embodiments when executing the computer program. Alternatively, the processor 31 implements the functions of each module / unit in the above device embodiments when executing the computer program.
[0215] For example, the computer program can be divided into one or more modules / units, which are stored in the memory 32 and executed by the processor 31 to complete the present application. The one or more modules / units can be a series of computer program instruction segments capable of completing a specific function, which are used to describe the execution process of the computer program in the electronic device 30.
[0216] The electronic device 30 can include, but is not limited to, a processor 31, a memory 32. Those skilled in the art can understand that the schematic diagram is only an example of the electronic device 30, and does not constitute a limitation on the electronic device 30, and can include more or fewer components than the diagram, or combine certain components, or different components, for example, the electronic device 30 can also include an input / output device, a network access device, a bus, etc.
[0217] The processor 31 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The processor 31 is the control center of the electronic device 30, and connects various parts of the entire electronic device 30 through various interfaces and lines.
[0218] The memory 32 can be used to store computer programs and / or modules, and the processor 31 realizes various functions of the electronic device 30 by running or executing computer programs and / or modules stored in the memory 32, and calling data stored in the memory 32. The memory 32 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required by a function (such as a sound playing function, an image playing function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 32 can include a high-speed random access memory, and can also include a non-volatile memory, for example, a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other volatile solid-state memory devices.
[0219] The modules / units integrated in the electronic device 30 can be stored in a computer readable storage medium if they are realized in the form of software function units and sold or used as independent products. Based on this understanding, all or part of the processes in the above-mentioned embodiment methods can also be completed by a computer program instructing related hardware, and the computer program can be stored in a computer readable storage medium. The computer program can be executed by the processor 31 to implement the steps of the above-mentioned various method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or some intermediate forms, etc. The computer readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc.
[0220] It should be noted that the apparatus embodiments described above are merely illustrative, and the units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, i.e., they can be located in one place or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiment scheme according to actual needs. In addition, the connection relationship between the modules in the apparatus embodiment provided by the present application indicates that there is a communication connection between them, which can be realized as one or more communication buses or signal lines. Those of ordinary skill in the art can understand and implement it without creative labor.
[0221] The above is the preferred embodiment of the present application. It should be noted that those of ordinary skill in the art can make several improvements and refinements without departing from the principles of the present application, and these improvements and refinements are also considered within the protection scope of the present application.
Claims
1. A method for generating zero watermarks, characterized in that, include: A first character count set is constructed based on the number of each key character in the code data to be protected; wherein, the key character is a predefined single character, and the first character count set records at least the number of the key characters in the code data to be protected; Construct a first feature matrix based on the size relationship of different elements in the first character quantity set; A zero-watermark image is generated based on the preset watermark image and the first feature matrix; The step of constructing the first feature matrix based on the size relationship of different elements in the first character quantity set includes: Compare the p-th element and the q-th element in the first character count set; When the p-th element in the first character count set is greater than or equal to the q-th element, the element in the m-th row and n-th column of the first feature matrix is determined as the first value; where p and m have a first preset relationship, and q and n have a second preset relationship; When the p-th element in the first character count set is less than the q-th element, the element in the m-th row and n-th column of the first feature matrix is determined to be the second value.
2. The zero-watermark generation method as described in claim 1, characterized in that, The step of constructing a first character count set based on the number of each key character in the code data to be protected includes: Extract all single characters from each element in the preset key data set to form the first single character set; The first set of single characters is scrambled to obtain the second set of single characters. The code data to be protected is traversed, the number of each element in the second single character set in the code data to be protected is counted, and the first character count set is formed according to the element arrangement order of the second single character set.
3. The zero-watermark generation method as described in claim 1, characterized in that, The step of generating a zero-watermark image based on a preset watermark image and the first feature matrix includes: The pixel values of the preset watermark image and the first feature matrix are XORed to generate the zero-watermark image.
4. The zero-watermark generation method as described in claim 1, characterized in that, The step of generating a zero-watermark image based on a preset watermark image and the first feature matrix includes: The preset watermark image and / or the first feature matrix are scrambled to obtain the first watermark image and / or the second feature matrix; The zero-watermark image is obtained by performing an XOR operation on the pixel values of the first watermark image and the first feature matrix; or, the zero-watermark image is obtained by performing an XOR operation on the pixel values of the preset watermark image and the second feature matrix; or, the zero-watermark image is obtained by performing an XOR operation on the pixel values of the first watermark image and the second feature matrix.
5. A zero-watermark detection method, characterized in that, include: A second character count set is constructed based on the number of each key character in the code data to be detected; wherein, the key character is a predefined single character, and the second character count set records at least the number of the key characters in the code data to be detected; Construct a third feature matrix based on the size relationship of different elements in the second character quantity set; Obtain zero-watermark images from the registration management center; Based on the zero-watermark image and the third feature matrix, a second watermark image is obtained; Based on the similarity between the preset watermark image and the second watermark image, determine whether a zero-watermark image is detected; The step of constructing a third feature matrix based on the size relationship of different elements in the second character quantity set includes: Compare the p-th element and the q-th element in the second character count set; When the p-th element in the second character count set is greater than or equal to the q-th element, the element in the m-th row and n-th column of the third feature matrix is determined as the first value; where p and m have a first preset relationship, and q and n have a second preset relationship; When the p-th element in the second character count set is less than the q-th element, the element in the m-th row and n-th column of the third feature matrix is determined to be the second value.
6. The zero-watermark detection method as described in claim 5, characterized in that, The step of constructing a second character count set based on the count of each key character in the code data to be detected includes: Extract all single characters from each element in the preset key data set to form the first single character set; The first set of single characters is scrambled to obtain the second set of single characters. The code data to be detected is traversed, the number of each element in the second single character set in the code data to be detected is counted, and the second character count set is formed according to the element arrangement order of the second single character set.
7. The zero-watermark detection method as described in claim 5, characterized in that, The step of determining whether a zero-watermark image is detected based on the similarity between the preset watermark image and the second watermark image includes: The similarity is calculated based on the pixel values of the preset watermark image and the pixel values of the second watermark image; When the similarity is greater than a preset similarity threshold, a zero-watermark image is detected. When the similarity is less than or equal to the preset similarity threshold, it is determined that no zero-watermark image has been detected.
8. The zero-watermark detection method as described in claim 5, characterized in that, The process of obtaining the second watermark image based on the zero-watermark image and the third feature matrix includes: The second watermarked image is obtained by performing an XOR operation on the zero-watermark image and the third feature matrix.
9. The zero-watermark detection method as described in claim 5, characterized in that, The process of obtaining the second watermark image based on the zero-watermark image and the third feature matrix includes: Perform an XOR operation on the pixel values of the zero-watermark image and the third feature matrix to obtain the third watermark image; perform descrambling processing on the third watermark image to obtain the second watermark image; or, The third feature matrix is scrambled to obtain the fourth feature matrix; the pixel values of the zero-watermark image and the fourth feature matrix are XORed to obtain the second watermark image; or, The third feature matrix is scrambled to obtain the fifth feature matrix; the pixel values of the zero-watermark image and the fifth feature matrix are XORed to obtain the fourth watermark image; the fourth watermark image is de-scrambled to obtain the second watermark image.
10. A zero-watermark generation device, characterized in that, include: The first construction module is used to construct a first character quantity set based on the quantity of each key character in the code data to be protected; wherein, the key character is a predefined single character, and the first character quantity set records at least the quantity of the key character in the code data to be protected; The second construction module is used to construct a first feature matrix based on the size relationship of different elements in the first character quantity set; The first XOR module is used to generate a zero-watermark image based on the preset watermark image and the first feature matrix; The second building module is specifically used for: Compare the p-th element and the q-th element in the first character count set; When the p-th element in the first character count set is greater than or equal to the q-th element, the element in the m-th row and n-th column of the first feature matrix is determined as the first value; where p and m have a first preset relationship, and q and n have a second preset relationship; When the p-th element in the first character count set is less than the q-th element, the element in the m-th row and n-th column of the first feature matrix is determined to be the second value.
11. A zero-watermark detection device, characterized in that, include: The third construction module is used to construct a second character count set based on the number of each key character in the code data to be detected; wherein, the key character is a predefined single character, and the second character count set records at least the number of the key characters in the code data to be detected; The fourth construction module is used to construct the third feature matrix based on the size relationship of different elements in the second character quantity set; The acquisition module is used to obtain zero-watermark images from the registration management center; The second XOR module is used to obtain a second watermarked image based on the zero-watermarked image and the third feature matrix; The detection module is used to determine whether a zero-watermark image is detected based on the similarity between the preset watermark image and the second watermark image. The fourth building module is specifically used for: Compare the p-th element and the q-th element in the second character count set; When the p-th element in the second character count set is greater than or equal to the q-th element, the element in the m-th row and n-th column of the third feature matrix is determined as the first value; where p and m have a first preset relationship, and q and n have a second preset relationship; When the p-th element in the second character count set is less than the q-th element, the element in the m-th row and n-th column of the third feature matrix is determined to be the second value.
12. An electronic device, characterized in that, The method includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements the zero-watermark generation method as described in any one of claims 1 to 4, or the zero-watermark detection method as described in any one of claims 5 to 9.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program; wherein, when the computer program is executed, it controls the device on which the computer-readable storage medium is located to perform the zero-watermark generation method as described in any one of claims 1 to 4, or the zero-watermark detection method as described in any one of claims 5 to 9.
14. A computer program product, characterized in that, It includes a computer program / instruction that, when executed by a processor, implements the zero-watermark generation method as described in any one of claims 1 to 4, or the zero-watermark detection method as described in any one of claims 5 to 9.
Citation Information
Patent Citations
Zero watermark method and device and watermark extraction method and device
CN104217390A
Invariant moment and Hilbert code based zero watermarking method of vector residential place
CN106204411A