[go: up one dir, main page]

CN115118835A - Watermark embedding method, encrypted watermark extracting method and decryption method - Google Patents

Watermark embedding method, encrypted watermark extracting method and decryption method Download PDF

Info

Publication number
CN115118835A
CN115118835A CN202210733189.XA CN202210733189A CN115118835A CN 115118835 A CN115118835 A CN 115118835A CN 202210733189 A CN202210733189 A CN 202210733189A CN 115118835 A CN115118835 A CN 115118835A
Authority
CN
China
Prior art keywords
watermark
encrypted
sequence
sub
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210733189.XA
Other languages
Chinese (zh)
Other versions
CN115118835B (en
Inventor
范晓军
石九宴
丘义祺
黎亮佳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Fangka Information Technology Co ltd
Original Assignee
Shanghai Fangka Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Fangka Information Technology Co ltd filed Critical Shanghai Fangka Information Technology Co ltd
Priority to CN202210733189.XA priority Critical patent/CN115118835B/en
Publication of CN115118835A publication Critical patent/CN115118835A/en
Application granted granted Critical
Publication of CN115118835B publication Critical patent/CN115118835B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/32Circuits or arrangements for control or supervision between transmitter and receiver or between image input and image output device, e.g. between a still-image camera and its memory or between a still-image camera and a printer device
    • H04N1/32101Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title
    • H04N1/32144Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title embedded in the image data, i.e. enclosed or integrated in the image, e.g. watermark, super-imposed logo or stamp
    • H04N1/32149Methods relating to embedding, encoding, decoding, detection or retrieval operations
    • H04N1/32267Methods relating to embedding, encoding, decoding, detection or retrieval operations combined with processing of the image
    • H04N1/32272Encryption or ciphering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/001Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using chaotic signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0643Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/32Circuits or arrangements for control or supervision between transmitter and receiver or between image input and image output device, e.g. between a still-image camera and its memory or between a still-image camera and a printer device
    • H04N1/32101Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title
    • H04N1/32144Display, printing, storage or transmission of additional information, e.g. ID code, date and time or title embedded in the image data, i.e. enclosed or integrated in the image, e.g. watermark, super-imposed logo or stamp
    • H04N1/32149Methods relating to embedding, encoding, decoding, detection or retrieval operations
    • H04N1/32203Spatial or amplitude domain methods
    • H04N1/32261Spatial or amplitude domain methods in binary data
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/60Digital content management, e.g. content distribution
    • H04L2209/608Watermarking

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Multimedia (AREA)
  • Power Engineering (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Image Processing (AREA)

Abstract

The invention relates to the technical field of digital watermarks, in particular to a watermark embedding method. The method comprises the following steps: acquiring a video to be processed and extracting all key frames of the video; acquiring a watermark to be added, and converting the watermark to be added into a binary watermark sequence; generating an initial value and a control parameter of a double sine and cosine mapping algorithm according to a preset hash function; encrypting the binary watermark sequence based on the initial value and the control parameter to obtain an encrypted watermark; the encrypted watermark is embedded in all key frames. The initial value and the control parameter of the double sine cosine mapping algorithm generated by the preset hash function are safer, so that the watermark to be added is safer when being encrypted based on the initial value and the control parameter, and the robustness of the encrypted watermark is higher. The encrypted watermark extraction method, the decryption method, the storage medium and the electronic device of the invention have the same beneficial effects as the watermark embedding method, and are not described herein again.

Description

Watermark embedding method, encrypted watermark extracting method and decryption method
[ technical field ] A method for producing a semiconductor device
The invention relates to the technical field of digital watermarks, in particular to a watermark embedding method, an encrypted watermark extracting method and a decryption method.
[ background of the invention ]
With the rapid development of multimedia technology and the popularization of mobile internet, picture and video technology is applied to various fields of people's life. However, the internet itself has openness and sharing property, so that the video information is easily stolen and tampered by lawless persons in the storage or transmission process, and the creation enthusiasm and benefits of the creator are seriously damaged. In which case video watermarking techniques should be developed. The basic principle of video watermarking is to embed information capable of proving copyright identity in a video so as to achieve the purpose of protecting copyright. Watermark embedding in the prior art generally embeds watermark information in an original video frame, and then encodes the original video with the embedded watermark information, but the information extraction process is complex, the invisibility of the information extraction process has large influence, and the robustness is unstable.
[ summary of the invention ]
In order to solve the problems in the prior art, the invention provides a watermark embedding method, an encrypted watermark extracting method, a decryption method, a storage medium and an electronic device.
In order to solve the above technical problem, a technical solution of the present invention is to provide a watermark embedding method, where the watermark embedding method includes the following steps:
acquiring a video to be processed and extracting all key frames of the video;
acquiring a watermark to be added, and converting the watermark to be added into a binary watermark sequence;
generating an initial value and a control parameter of a double sine and cosine mapping algorithm according to a preset hash function;
encrypting the binary watermark sequence based on the initial value and the control parameter to obtain an encrypted watermark;
embedding the encrypted watermark in all of the key frames.
Preferably, the generating of the initial value and the control parameter of the double sine and cosine mapping algorithm according to the preset hash function includes the following steps:
the preset hash function comprises a first hash function and a second hash function;
obtaining a first hash value H based on the first hash function 1 And a second hash value H 2
Based on the first hash value H 1 And the second hash value H 2 Obtaining a first result value R at the first c position; therein, 6>c>2;
Obtaining a third hash value H based on the first result value R and the second hash function 3
Based on the third hash value H 3 The first t bits and the last t bits of (9) obtain the initial value and the control parameter>t>6。
Preferably, encrypting the binary watermark sequence based on the initial value and the control parameter to obtain an encrypted watermark comprises the steps of:
iterating the two-dimensional sine and cosine transform algorithm for preset times based on the initial value and the control parameter to obtain a one-dimensional chaotic sequence;
quantizing the one-dimensional chaotic sequence to obtain a quantized sequence;
converting the quantized sequence into a binary sequence with a preset length;
converting the binary sequence into a two-dimensional matrix with a first preset size;
and carrying out XOR operation on the binary watermark sequence based on the two-dimensional matrix to obtain the encrypted watermark.
Preferably, embedding the encrypted watermark in all the key frames specifically includes the following steps:
partitioning the key frame to obtain sub-blocks with a second preset size and non-overlapping;
performing entropy operation on each subblock to obtain an entropy value of each subblock;
sorting all the subblocks in an ascending order according to the size of the entropy value;
selecting a previous a x b sub-block to embed the encrypted watermark, and recording the position information of the sub-block, wherein a > 1; b > 1.
Preferably, the step of selecting the previous a × b sub-block to embed the encrypted watermark specifically includes the following steps:
calculating a direct current coefficient DCC of the sub-block;
acquiring two different modified direct current coefficients DCC according to different values of the encrypted watermark 1 And DCC 2
DCC with small change based on DC coefficient DCC acquisition 1 And DCC 2 To obtain a DC coefficient DCC with a small change opt
Calculating DCC opt And difference between DCC ch
DCC according to the difference ch Updating all pixel values of the sub-block to obtain a sub-block containing watermark information, and repeating the steps until the encrypted watermark is embedded into all the sub-blocks;
an image containing the encrypted watermark is obtained.
Preferably, the steps of acquiring a video to be processed and extracting all key frames of the video specifically include the following steps;
setting the ith frame of a video sequence as a current key frame;
calculating a gray level histogram difference value d between the current key frame and the (i + k) th key frame based on a histogram difference method; wherein i and k are both positive integers, i + k > i > 1;
if the gray histogram difference value d is greater than a preset histogram difference threshold value, recording the (i + k) th frame as a next key frame of the video sequence, and updating the current key frame;
and repeating the steps until all key frames of the video sequence are obtained.
Another technical solution to solve the above technical problem is to provide a watermark extraction method for extracting an encrypted watermark obtained by the above watermark embedding method, where the watermark extraction method includes the following steps:
acquiring an image with an encrypted watermark, and carrying out blocking processing on the image to obtain sub-blocks with a second preset size and non-overlapping with each other;
obtaining a sub-block containing encrypted watermark information from the sub-block;
and carrying out encryption watermark extraction from the sub-blocks containing the encryption watermark information.
Another technical solution to solve the above technical problem is to provide a watermark decryption method for decrypting an encrypted watermark extracted by the above encrypted watermark extraction method, where the encrypted watermark decryption method includes the following steps:
generating an initial value and a control parameter of a double sine and cosine mapping algorithm according to a preset hash function;
generating a two-dimensional matrix of a double sine and cosine mapping algorithm based on the initial value and the control parameter;
performing exclusive-or operation on the encrypted watermark and the two-dimensional matrix to obtain a decrypted binary watermark sequence;
and converting the binary watermark sequence to obtain the decrypted watermark.
A further technical solution of the present invention to solve the above technical problem is to provide a storage medium, on which a computer program is stored, the program implementing the watermark embedding method as described above when executed by a processor.
Another technical solution to solve the above technical problem is to provide an electronic device, including: a processor, and a memory for storing a computer program, which is executed by the apparatus via the processor to perform the watermark embedding method as described above.
Compared with the prior art, the watermark embedding method provided by the invention has the following advantages:
1. according to the watermark embedding method provided by the embodiment of the invention, the preset hash function is used for generating the initial value and the control parameter of the double sine and cosine mapping algorithm, and the watermark to be added is encrypted through the obtained initial value and the obtained control parameter.
2. According to the watermark embedding method provided by the embodiment of the invention, the design of the initial value and the control parameter of the double sine and cosine mapping algorithm is generated by utilizing the first hash function and the second hash function, so that the randomness and the safety of the obtained initial value and the obtained control parameter are higher, and the binary sequence watermark is encrypted based on the initial value and the control parameter, so that the robustness of the watermark can be improved.
3. According to the watermark embedding method provided by the embodiment of the invention, the generated initial value and the control parameter are used for iterating a double sine and cosine mapping algorithm to obtain the one-dimensional chaotic sequence, the one-dimensional chaotic sequence is sequentially subjected to quantization, binary conversion and matrix conversion to obtain the two-dimensional matrix, and the two-dimensional matrix is used for carrying out XOR operation on the binary watermark sequence to obtain the encrypted watermark, so that the encrypted watermark has higher robustness.
4. The invention further provides a watermark embedding method, which includes the steps of partitioning a key frame into a plurality of non-overlapping sub-blocks, calculating the entropy value of each sub-block, and sequencing the obtained entropy values in an ascending order.
5. According to the watermark embedding method provided by the embodiment of the invention, when the encrypted watermark is embedded into the key frame, the direct current coefficient DCC is directly calculated in a space domain without executing real discrete Fourier transform, so that the execution time of the scheme is shortened, and the scheme has lower calculation complexity.
6. According to the watermark embedding method provided by the embodiment of the invention, the design of the key frames of the video sequence is obtained by a histogram difference method and setting a preset histogram difference threshold value, so that all the key frames of the video sequence can be extracted quickly and effectively.
7. The encrypted watermark extraction method provided by the embodiment of the invention has the same beneficial effects as the watermark embedding method, and is not described herein again.
8. The encrypted watermark decryption method provided by the embodiment of the invention has the same beneficial effects as the watermark embedding method, and is not described herein again.
[ description of the drawings ]
Fig. 1 is a method flow diagram of a watermark embedding method of a first embodiment of the invention;
fig. 2 is a flowchart of a method for acquiring key frames of a watermark embedding method according to a first embodiment of the present invention;
fig. 3 is a flowchart of a method for obtaining an initial value and a control parameter of the watermark embedding method according to the first embodiment of the present invention;
fig. 4 is a flowchart of a method of encrypting a watermark of the watermark embedding method of the first embodiment of the present invention;
FIG. 5 is a flowchart of a method for encrypting a watermark embedding key frame of the watermark embedding method according to the first embodiment of the present invention
Fig. 6 is a method flowchart of a watermark extraction method according to a second embodiment of the invention;
fig. 7 is a method flowchart of a watermark decryption method according to a third embodiment of the present invention.
[ detailed description ] embodiments
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, a first embodiment of the present invention provides a watermark embedding method based on double sine and cosine mapping, where the watermark embedding method includes the following steps:
s1: acquiring a video to be processed and extracting all key frames of the video;
s2: acquiring a watermark to be added, and converting the watermark to be added into a binary watermark sequence;
s3: generating an initial value and a control parameter of a double sine and cosine mapping algorithm according to a preset hash function;
s4: encrypting the binary watermark sequence based on the initial value and the control parameter to obtain an encrypted watermark;
s5: the encrypted watermark is embedded in all key frames.
It should be noted that the watermark may be a digital watermark, a text watermark, a pattern watermark, etc., and may be information reflecting the data multimedia itself, information of the data multimedia processing device, information of the data multimedia processing user, etc. The watermark to be added can be copyright information of the identity of an owner, and the copyright information of the identity of the owner can be an image, a number and the like; the conversion of the watermark to be added into the binary watermark sequence may be based on the type of watermark. For example, the watermark to be added is an image, the watermark image may be a color image, the color image is first subjected to channel decomposition, the color image is converted into a gray binary image, the pixel value in the gray binary image is only 0 and 255, which are respectively used for representing black and white, and 255 of the gray binary image can be converted into 1, so that a binary image is obtained, and the pixel value in the binary image is only 0 and 1. Specifically, the target value of the binary watermark sequence is 1 or 0 in the present embodiment.
The method generates the initial value and the control parameter of the double sine and cosine mapping algorithm through the preset hash function, and encrypts the watermark to be added through the obtained initial value and the obtained control parameter.
Further, please refer to fig. 2, the steps of acquiring the video to be processed and extracting all key frames of the video specifically include the following steps;
s11: setting the ith frame of a video sequence as a current key frame;
s12: calculating a gray level histogram difference value d between the current key frame and the (i + k) th key frame based on a histogram difference method; wherein i and k are both positive integers, i + k > i > 1;
s13: if the gray histogram difference value d is greater than a preset histogram difference threshold value, recording the (i + k) th frame as a next key frame of the video sequence, and updating the current key frame;
s14: the above steps S12 and S13 are repeated until all key frames of the video sequence are acquired.
The method and the device can acquire the key frames of the video sequence by a histogram difference method and setting a preset histogram difference threshold value, and can quickly and effectively extract all the key frames of the video sequence.
In addition, the specific setting of the preset histogram difference threshold may be set by those skilled in the art according to actual requirements, for example: and is set to a value of 3, 4, or 5, etc., which is not particularly limited in this embodiment.
Specifically, as an alternative manner of the embodiment of the present invention, the above-mentioned gray histogram difference value d is expressed as d ═ i, i + k, and is calculated by the following formula:
Figure BDA0003713485090000081
Figure BDA0003713485090000082
wherein h is i+1 (j) A gray histogram size representing a gray level of j for an i +1 th frame of the video sequence; h is a total of i (j) A gray histogram size representing a gray level of j for an ith frame of the video sequence; d (i + k, i) represents the histogram difference of the i +1 th frame and the i th frame of the video sequence; norm _ d represents the normalized histogram difference.
Further, referring to fig. 3, generating an initial value and a control parameter of a double sine and cosine mapping algorithm according to a preset hash function includes the following steps:
s31: the preset hash functions comprise a first hash function and a second hash function;
s32: obtaining a first hash value H based on a first hash function 1 And a second hash value H 2
S33: the first hash value H 1 And a second hash value H 2 Obtaining a first result value R at the first c position; therein, 6>c>2;
S34: obtaining a third hash value H based on the first result value R and the second hash function 3
S35: based on the third hash value H 3 Obtaining an initial value and a control parameter from the first t bit and the last t bit of the control signal; therein, 9>t>6。
The binary sequence watermark encryption method and the device have the advantages that the initial value and the control parameter of the double sine and cosine mapping algorithm are generated by the aid of the first hash function and the second hash function, randomness and safety of the obtained initial value and control parameter are higher, and robustness of the watermark can be improved by encrypting the binary sequence watermark based on the initial value and the control parameter.
Specifically, in the present invention, the first hash function is an MD5 hash function, and the second hash function is an SHA-512 hash function. It is understood that the MD5 hash function is a widely used cryptographic hash function, that is, the MD5 hash function is a public key encryption algorithm, which has high security; the SHA-512 hash function is one of secure hash algorithms, which is one of algorithms after the SHA hash function is updated, and its security performance is higher. Therefore, the method and the device can generate the initial value and the control parameter of the double sine and cosine mapping algorithm through the two hash functions, and have higher safety.
Specifically, the first hash value H of the present embodiment 1 And a second hash value H 2 Each including 40 hexadecimal numbers, and the first hash value H in step S32 1 And a second hash value H 2 Calculated by the following formula:
H 112 ,…,δ 40 )=hash(PICI,MD5);
Figure BDA0003713485090000101
wherein, delta i And
Figure BDA0003713485090000102
respectively representing a first hash value H 1 And a second hash value H 2 Hash represents a hash function, "PICI" represents partial information of a key frame, "SK" represents a complex string, and MD5 represents an MD5 hash function.
Note that, the partial information of the key frame refers to: a5 x 5 matrix is randomly extracted from the key frame. The complex string refers to: several letters are randomly selected from 26 letters.
Specifically, the first result value R obtained in step S32 is specifically: first, the first hash values H are respectively 1 And a second hash value H 2 The first c bits of (A) are converted into two decimal values D 1 And D 2 And two decimal values D 1 And D 2 Exclusive OR operation is performed to obtain a first result value R, where 6>c>2。
Specifically, as an optional solution of the embodiment of the present invention, the present invention selects the first hash value H 1 First 5 bits of and a second hash value H 2 Is converted to obtain two decimal numbers D 1 And D 2
Understandably, by selecting the first hash value H 1 And a second hash value H 2 The first 5 bits of the digital signal are converted, and the hexadecimal number of the first 5 bits is more stable, so that the obtained D can be further enabled 1 And D 2 And is more stable.
Specifically, in step S33, D 1 And D 2 Calculated by the following formula:
D 1 =hex2dec(H 115 ));
Figure BDA0003713485090000103
where hex2dec is a conversion function for converting a hexadecimal number to a decimal number, δ 1 And delta 5 Respectively representing a first hash value H 1 The 1 st hexadecimal number and the 5 th hexadecimal number,
Figure BDA0003713485090000104
and
Figure BDA0003713485090000105
respectively represent second hash values H 2 The 1 st hexadecimal number and the 5 th hexadecimal number.
Specifically, in step S33, the first result value R is calculated by the following formula:
Figure BDA0003713485090000106
wherein,
Figure BDA0003713485090000107
is the sign of an exclusive or operation.
Specifically, in step S34, the third hash value H 3 Calculated by the following formula:
H 312 ,…,ρ 128 )=hash(R,SHA-512);
where ρ is i Is the third hash value H 3 The ith hexadecimal number of (c); hash represents a hash function and SHA-512 represents a SHA-512 hash function.
Specifically, in step S35, based on the third hash value H 3 The initial value and the control parameter obtained by the first t bit and the last t bit are specifically as follows: firstly, the third hash value H 3 Respectively converting the first t bit and the last t bit of the decimal point into two decimal values D 3 And D 4 (ii) a Then D is put 3 And D 4 Make a remainderCalculated to obtain initial values and control parameters, wherein 9>t>6。
As an optional solution of the embodiment of the present invention, the third hash value H is selected in the present invention 1 Is converted to obtain two decimal numbers D 3 And D 4
It will be appreciated that the randomness with which the values are taken can be ensured by this design.
Specifically, the initial values and the control parameters are obtained by the following formulas in step S35:
Figure BDA0003713485090000111
wherein x is 0 Is an initial value, r is a control parameter, mod is a remainder function.
Further, referring to fig. 4, encrypting the binary watermark sequence based on the initial value and the control parameter to obtain the encrypted watermark specifically includes the following steps:
s41: iterating a two-dimensional sine and cosine transform algorithm for preset times based on the initial value and the control parameter to obtain a one-dimensional chaotic sequence;
s42: quantizing the one-dimensional chaotic sequence to obtain a quantized sequence;
s43: converting the quantized sequence into a binary sequence with a preset length;
s44: converting the binary sequence into a two-dimensional matrix with a first preset size;
s45: and carrying out exclusive OR operation on the binary watermark sequence based on the two-dimensional matrix to obtain the encrypted watermark.
It should be noted that, the size of the watermark is not limited in any way in the embodiments of the present invention, and may be set according to actual requirements, as long as the size of the watermark is smaller than the size of the key frame. In addition, the preset iteration number, the preset length and the first preset size of the embodiment of the invention are all related to the size of the binary watermark sequence.
The generated initial values and control parameters are subjected to iteration preset times by a double sine and cosine mapping algorithm to obtain a one-dimensional chaotic sequence, the one-dimensional chaotic sequence is subjected to quantization, binary conversion and matrix conversion in sequence to obtain a two-dimensional matrix with a preset size, and the two-dimensional matrix is utilized to perform exclusive-or operation on the binary watermark sequence to obtain the design of the encrypted watermark, so that the robustness of the encrypted watermark can be higher.
Exemplarily, in the embodiment of the present invention, the size of the binary watermark sequence W is set to be m × n; wherein m >0, n > 0. It will also be appreciated that in the present embodiment, the predetermined number of iterations is m × n ÷ 8, the predetermined length is 1 × m × n, and the first predetermined size is m × n.
Specifically, in step S41, the one-dimensional chaotic sequence is calculated by the following formula:
x n+1 =cos(π(rsin(πx n )+(1-r)sin(πx n )-0.5));
x=(x 1 ,x 2 ,…,x m×n÷8 );
wherein r is a control parameter, x n Is an initial value x 0 ,x n+1 Marking the one-dimensional chaotic sequence obtained after iteration as x;
specifically, in step S42, the quantization sequence is calculated by the following formula:
x′=floor(mod(x×10 14 ),255);
x′=(x′ 1 ,x′ 2 ,…,x′ m×n÷8 );
where x' is the quantized sequence and floor (·) represents a round-down function;
specifically, in step S43, the binary sequence is calculated by the following formula:
x″=dec2bin(x′);
x″=(x″ 1 ,x″ 2 ,…,x″ m×n );
where x "is a binary sequence and dec2bin (·) is a function that converts decimal numbers to binary numbers;
specifically, in step S45, the encrypted watermark is calculated by the following formula:
Figure BDA0003713485090000131
wherein,
Figure BDA0003713485090000132
is the sign of an XOR operation, W E Representing an encrypted watermark; w represents a binary watermark sequence.
Further, referring to fig. 5, embedding the encrypted watermark in all the key frames specifically includes the following steps:
s51: partitioning the key frame to obtain sub-blocks with a second preset size and non-overlapping;
s52: performing entropy operation on each subblock to obtain an entropy value of each subblock;
s53: sorting all the sub-blocks in an ascending order according to the size of the entropy value;
s54: selecting a previous a multiplied by b subblock to embed an encrypted watermark, and recording position information of the subblock, wherein a is more than 1; b > 1.
The key frame is divided into a plurality of subblocks with preset sizes and non-overlapping, the entropy value of each subblock is calculated, and the obtained entropy values are sorted in an ascending order.
Specifically, the size of the key frame is set to be M × N; m >0, N > 0.
It should be noted that the size M × N of the watermark W is smaller than the size M × N of the key frame, and the watermark can be completely embedded in the key frame by this design. In addition, the invention sets the size of the watermark and the key frame to facilitate the explanation of the following description, and can be set according to the actual requirement. In addition, the position information of the sub-blocks can be recorded to facilitate the subsequent extraction of the encrypted watermark.
In step S51, the sub-blocks with preset sizes and non-overlapping are marked as B (i,j) And the second preset size is 4 × 4, where i ═ 1,2, …, M/4, j ═ 1,2, …, N/4, (i, j) denotes the coordinates of each sub-block.
Specifically, in step S52, the entropy value of each sub-block is calculated by the following formula:
Figure BDA0003713485090000141
Figure BDA0003713485090000142
where L is the number of gray levels, p i And 0 is less than or equal to p i ≤1、
Figure BDA0003713485090000143
E 1 As a global measure of the video frame, E 2 Is edge entropy, 1-p i Representing the uncertainty of the pixel value.
Further, the step of selecting the previous a × b sub-block to embed the encrypted watermark specifically includes the following steps:
calculating the direct current coefficient DCC of the sub-block;
obtaining two different modified DC coefficients DCC according to different values of encrypted watermark 1 And DCC 2
DCC with small change based on DC coefficient DCC acquisition 1 And DCC 2 To obtain a DC coefficient DCC with a small change opt
Obtaining DCC opt And difference between DCC ch
According to the difference DCC ch Updating all pixel values of the sub-block to obtain a sub-block containing watermark information, and repeating the steps until the encrypted watermark is embedded into all the sub-blocks;
an image containing the encrypted watermark is obtained.
It can be understood that, when the encrypted watermark is embedded into the key frame, the invention directly calculates the direct current coefficient DCC in the space domain without performing the real discrete Fourier transform, which shortens the execution time of the scheme, thereby enabling the scheme to have lower calculation complexity.
In particular, the encrypted watermark is represented as W E (s, t), where s is 1,2, …, m, t is 1,2, …, n, (s, t) denotes the coordinates of the encrypted watermark.
Specifically, the dc coefficient DCC of the sub-block is obtained by the following formula:
Figure BDA0003713485090000144
wherein (p, q) represents the coordinates of the pixels of the sub-block, B (i,j) Representing the sub-blocks.
Understandably, the encrypted watermark W E The values of (s, t) are only 0 and 1.
Therefore, when W E When (s, t) is 1, two different correction direct current coefficients DCC 1 And DCC 2 Obtained by the following formula;
Figure BDA0003713485090000151
or when W E When (s, t) is 0, two different correction direct current coefficients DCC 1 And DCC 2 Obtained by the following formula;
Figure BDA0003713485090000152
where α is a scale factor and γ ∈ (0,0.5) is a fine tuning coefficient.
DC coefficient DCC with small change amount opt Obtained from the following equation:
Figure BDA0003713485090000153
differential DCC ch Obtained from the following equation:
DCC ch =DCC opt -DCC。
the sub-blocks containing the watermark information are calculated by the following formula:
Figure BDA0003713485090000154
wherein,
Figure BDA0003713485090000155
represented as sub-blocks containing watermark information.
Exemplarily, assume the first sub-block B (1,1) 165, 155, 172, 148, first according to W E (s, t) actual value to calculate DCC ch Then based on DCC ch Calculating DCC ch The value of/4 x 4, and finally the original pixel value is added based on the value, so that the sub-block B can be obtained (1,1) I.e. the sub-block with the watermark information is available
Figure BDA0003713485090000156
Referring to fig. 6, a second embodiment of the present invention provides a watermark extraction method for extracting an encrypted watermark obtained by the watermark embedding method according to the first embodiment of the present invention, including the following steps:
a1: acquiring an image with an encrypted watermark, and carrying out blocking processing on the image to obtain subblocks with preset sizes and non-overlapping with each other;
a2: obtaining a sub-block containing encrypted watermark information from the sub-block;
a3: and extracting the encrypted watermark from the sub-block containing the encrypted watermark information.
Specifically, step a3 specifically includes the following steps:
a31: obtaining DC coefficient DCC of sub-block containing encrypted watermark information w
In particular, the DC coefficient DCC w Calculated by the following formula:
Figure BDA0003713485090000161
wherein (p, q) represents a subblock
Figure BDA0003713485090000162
The coordinates of the middle pixel.
A32: if mod (round (DCC) w ),α)<Alpha/2; then
Figure BDA0003713485090000163
On the contrary, the method can be used for carrying out the following steps,
Figure BDA0003713485090000164
wherein,
Figure BDA0003713485090000165
is the extracted watermark, round (-) is the rounding of the element to the nearest integer, and α is the scale factor.
Step a5 is also included after step a4, and steps a 2-A3 are repeated until all encrypted watermarks are extracted from the image.
It can be understood that the watermark extraction method of the present invention has the same beneficial effects as the watermark embedding method of the first embodiment of the present invention, and will not be described herein again.
Referring to fig. 7, a third embodiment of the present invention provides a watermark decryption method for decrypting an encrypted watermark extracted by the encrypted watermark extraction method according to the second embodiment of the present invention, including the following steps:
b1: generating an initial value and a control parameter of a double sine and cosine mapping algorithm according to a preset hash function;
b2: generating a two-dimensional matrix with a preset size of a double sine and cosine mapping algorithm based on the initial value and the control parameter;
b3: carrying out XOR operation on the encrypted watermark and the two-dimensional matrix to obtain a decrypted binary watermark sequence;
b4: the binary watermark sequence is transformed to obtain a decrypted watermark.
Specifically, step B2 is the same as steps S42-S45 of the first embodiment of the present invention, and is not repeated herein.
Specifically, the decrypted watermark in step B3 is calculated by the following formula:
Figure BDA0003713485090000171
wherein,
Figure BDA0003713485090000172
is the sign of an XOR operation, W D Representing the decrypted binary watermark sequence; w E Representing an encrypted watermark.
It can be understood that the watermark extraction method of the present invention has the same beneficial effects as the watermark embedding method of the first embodiment of the present invention, and will not be described herein again.
A fourth embodiment of the present invention provides a storage medium having a computer program stored thereon, characterized in that: which when executed by a processor implements the watermark embedding method of the first embodiment of the invention.
It is understood that the storage medium of the present invention has the same advantageous effects as the watermark embedding method of the first embodiment of the present invention, and will not be described herein again.
A fifth embodiment of the present invention provides an electronic apparatus, including: a processor, and a memory for storing a computer program, which is executed by the apparatus according to the first embodiment of the present invention.
It can be understood that the electronic device of the present invention has the same beneficial effects as the watermark embedding method of the first embodiment of the present invention, and the details are not described herein again.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit of the present invention are intended to be included within the scope of the present invention.

Claims (10)

1. A watermark embedding method, characterized by: the watermark embedding method comprises the following steps:
acquiring a video to be processed and extracting all key frames of the video;
acquiring a watermark to be added, and converting the watermark to be added into a binary watermark sequence;
generating an initial value and a control parameter of a double sine and cosine mapping algorithm according to a preset hash function;
encrypting the binary watermark sequence based on the initial value and the control parameter to obtain an encrypted watermark;
embedding the encrypted watermark in all of the key frames.
2. The watermark embedding method of claim 1, wherein: the generation of the initial value and the control parameter of the double sine and cosine mapping algorithm according to the preset hash function comprises the following steps:
the preset hash function comprises a first hash function and a second hash function;
obtaining a first hash value H based on the first hash function 1 And a second hash value H 2
Based on the first hash value H 1 And the second hash value H 2 Obtaining a first result value R at the first c position; therein, 6>c>2;
Obtaining a third hash value H based on the first result value R and the second hash function 3
Based on the third hash value H 3 The first t bits and the last t bits of (9) obtain the initial value and the control parameter>t>6。
3. The watermark embedding method of claim 1, wherein: encrypting the binary watermark sequence based on the initial value and the control parameter to obtain an encrypted watermark comprises the steps of:
iterating the two-dimensional sine and cosine transform algorithm for preset times based on the initial value and the control parameter to obtain a one-dimensional chaotic sequence;
quantizing the one-dimensional chaotic sequence to obtain a quantized sequence;
converting the quantized sequence into a binary sequence with a preset length;
converting the binary sequence into a two-dimensional matrix with a first preset size;
and carrying out XOR operation on the binary watermark sequence based on the two-dimensional matrix to obtain the encrypted watermark.
4. The watermark embedding method of claim 1, wherein: embedding the encrypted watermark into all the key frames specifically comprises the following steps:
partitioning the key frame to obtain sub-blocks with a second preset size and non-overlapping;
performing entropy operation on each subblock to obtain an entropy value of each subblock;
sorting all the sub-blocks in an ascending order according to the size of the entropy value;
selecting a previous a x b sub-block to embed the encrypted watermark, and recording the position information of the sub-block, wherein a > 1; b > 1.
5. The watermark embedding method of claim 4, wherein: the step of selecting the previous a × b sub-block to embed the encrypted watermark specifically comprises the following steps:
calculating a direct current coefficient DCC of the sub-block;
acquiring two different modified direct current coefficients DCC according to different values of the encrypted watermark 1 And DCC 2
DCC with small change based on DC coefficient DCC acquisition 1 And DCC 2 To obtain a DC coefficient DCC with a small change opt
Calculating DCC opt And difference between DCC ch
DCC according to the difference ch Updating all pixel values of the sub-block to obtain a sub-block containing watermark information, and repeating the steps until the encrypted watermark is embedded into all the sub-blocksSub-blocks;
an image containing the encrypted watermark is obtained.
6. The watermark embedding method of claim 1, wherein: the method comprises the following steps of acquiring a video to be processed and extracting all key frames of the video;
setting the ith frame of a video sequence as a current key frame;
calculating a gray level histogram difference value d between the current key frame and the (i + k) th key frame based on a histogram difference method; wherein i and k are both positive integers, i + k > i > 1;
if the gray histogram difference value d is greater than a preset histogram difference threshold value, recording the (i + k) th frame as a next key frame of the video sequence, and updating the current key frame;
and repeating the steps until all key frames of the video sequence are obtained.
7. An encrypted watermark extraction method, characterized by: for extracting an encrypted watermark obtained by the watermark embedding method of any one of claims 1 to 6, the encrypted watermark extraction method comprising the steps of:
acquiring an image with an encrypted watermark, and carrying out blocking processing on the image to obtain sub-blocks with a second preset size and non-overlapping with each other;
obtaining a sub-block containing encrypted watermark information from the sub-block;
and carrying out encryption watermark extraction from the sub-blocks containing the encryption watermark information.
8. A method for decrypting an encrypted watermark, comprising: for decrypting the encrypted watermark extracted by the encrypted watermark extraction method of claim 7, the encrypted watermark decryption method comprising the steps of:
generating an initial value and a control parameter of a double sine and cosine mapping algorithm according to a preset hash function;
generating a two-dimensional matrix of a double sine and cosine mapping algorithm based on the initial value and the control parameter;
performing exclusive-or operation on the encrypted watermark and the two-dimensional matrix to obtain a decrypted binary watermark sequence;
and converting the binary watermark sequence to obtain the decrypted watermark.
9. A storage medium having a computer program stored thereon, characterized in that: the program, when executed by a processor, implements a watermark embedding method as claimed in any one of claims 1 to 6.
10. An electronic device, characterized in that: the method comprises the following steps: a processor, and a memory for storing a computer program, which when executed by the processor, performs the watermark embedding method according to any one of claims 1 to 6.
CN202210733189.XA 2022-06-24 2022-06-24 Watermark embedding method, encrypted watermark extracting method and decryption method Active CN115118835B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210733189.XA CN115118835B (en) 2022-06-24 2022-06-24 Watermark embedding method, encrypted watermark extracting method and decryption method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210733189.XA CN115118835B (en) 2022-06-24 2022-06-24 Watermark embedding method, encrypted watermark extracting method and decryption method

Publications (2)

Publication Number Publication Date
CN115118835A true CN115118835A (en) 2022-09-27
CN115118835B CN115118835B (en) 2024-07-23

Family

ID=83329936

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210733189.XA Active CN115118835B (en) 2022-06-24 2022-06-24 Watermark embedding method, encrypted watermark extracting method and decryption method

Country Status (1)

Country Link
CN (1) CN115118835B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119254901A (en) * 2024-09-29 2025-01-03 南方电网科学研究院有限责任公司 User sensitive information concealed transmission method, device, equipment and storage medium
CN120197199A (en) * 2025-05-23 2025-06-24 大连傲盈科技有限公司 Digital protection method for engineering cost information

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999063443A1 (en) * 1998-06-01 1999-12-09 Datamark Technologies Pte Ltd. Methods for embedding image, audio and video watermarks in digital data
CN104168484A (en) * 2014-08-19 2014-11-26 河海大学 Video watermarking method based on visual attention mechanism
CN105761199A (en) * 2016-03-25 2016-07-13 鲁东大学 Robustness color image watermarking method based on combination domain
CN111199508A (en) * 2020-01-03 2020-05-26 鲁东大学 A Blind Watermarking Method for Spatial Color Digital Image Fusion DCT and DHT
CN112132731A (en) * 2020-09-10 2020-12-25 郑州轻工业大学 DWT-SVD Domain Adaptive Robust Watermarking Algorithm Using Preset PSNR
CN113538203A (en) * 2021-09-01 2021-10-22 华侨大学 Image encryption method and device based on novel two-dimensional composite chaotic mapping and SHA-256

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999063443A1 (en) * 1998-06-01 1999-12-09 Datamark Technologies Pte Ltd. Methods for embedding image, audio and video watermarks in digital data
CN104168484A (en) * 2014-08-19 2014-11-26 河海大学 Video watermarking method based on visual attention mechanism
CN105761199A (en) * 2016-03-25 2016-07-13 鲁东大学 Robustness color image watermarking method based on combination domain
CN111199508A (en) * 2020-01-03 2020-05-26 鲁东大学 A Blind Watermarking Method for Spatial Color Digital Image Fusion DCT and DHT
CN112132731A (en) * 2020-09-10 2020-12-25 郑州轻工业大学 DWT-SVD Domain Adaptive Robust Watermarking Algorithm Using Preset PSNR
CN113538203A (en) * 2021-09-01 2021-10-22 华侨大学 Image encryption method and device based on novel two-dimensional composite chaotic mapping and SHA-256

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
全俊杰;蔡清波;: "一种基于Lorenz混沌系统的有效图像加密算法", 泉州师范学院学报, no. 02, 15 April 2020 (2020-04-15) *
陈军;张向利;张红梅;: "基于Lorenz映射和Logistic映射的图像分块加密算法", 桂林电子科技大学学报, no. 01, 14 June 2019 (2019-06-14) *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119254901A (en) * 2024-09-29 2025-01-03 南方电网科学研究院有限责任公司 User sensitive information concealed transmission method, device, equipment and storage medium
CN119254901B (en) * 2024-09-29 2025-09-23 南方电网科学研究院有限责任公司 Method, device, equipment and storage medium for concealed transmission of user sensitive information
CN120197199A (en) * 2025-05-23 2025-06-24 大连傲盈科技有限公司 Digital protection method for engineering cost information
CN120197199B (en) * 2025-05-23 2025-09-02 大连傲盈科技有限公司 Digital protection method for engineering cost information

Also Published As

Publication number Publication date
CN115118835B (en) 2024-07-23

Similar Documents

Publication Publication Date Title
Zhang et al. Reference sharing mechanism for watermark self-embedding
Tai et al. Image self-recovery with watermark self-embedding
US7146502B2 (en) Information processing apparatus and its control method, computer program, and storage medium
US6834344B1 (en) Semi-fragile watermarks
Agrawal et al. Mean value based reversible data hiding in encrypted images
CN108876697B (en) Pixel-level image authentication, tampering detection and recovery method
Bitar et al. Blind digital watermarking in PDF documents using Spread Transform Dither Modulation
CN115118835B (en) Watermark embedding method, encrypted watermark extracting method and decryption method
Shen et al. A self-embedding fragile image authentication based on singular value decomposition
JP4625841B2 (en) System and method for digital content security
CN110211020B (en) Image watermark embedding and extraction method based on SWT-DFT
Rahardi et al. A blind robust image watermarking on selected DCT coefficients for copyright protection
CN111881425B (en) Picture copyright authentication method, device and storage medium
CN113114869A (en) Ciphertext domain high-capacity image reversible data hiding method based on MSB prediction
Bhandari et al. A new model of M-secure image via quantization
JP2000350007A (en) Digital watermarking method, digital watermarking device, and recording medium
Lu et al. Multipurpose image watermarking method based on mean-removed vector quantization
CN106228503B (en) The digital watermark embedding and extracting method of satellite remote-sensing image SHP dot files
Ridzoň et al. Content protection in grayscale and color images based on robust digital watermarking
CN117077165B (en) Intellectual property information encryption management system
CN108962267B (en) An Encrypted Voice Content Authentication Method Based on Hash Feature
Deval et al. Exploring advanced steganography techniques for secure digital image communication: a comparative analysis and performance evaluation
Rafat et al. Reversing the Irreversible LSB Steganography: Transformative Advances in Reversible Data Hiding
Roy et al. A robust reversible image watermarking scheme in DCT domain using Arnold scrambling and histogram modification
Dadkhah et al. Efficient image authentication and tamper localization algorithm using active watermarking

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant