CN115114596A - Watermark processing method, watermark processing device, electronic equipment and computer readable storage medium - Google Patents

Watermark processing method, watermark processing device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN115114596A
CN115114596A CN202210621778.9A CN202210621778A CN115114596A CN 115114596 A CN115114596 A CN 115114596A CN 202210621778 A CN202210621778 A CN 202210621778A CN 115114596 A CN115114596 A CN 115114596A
Authority
CN
China
Prior art keywords
target
watermark information
vector
length
frequency domain
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.)
Pending
Application number
CN202210621778.9A
Other languages
Chinese (zh)
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202210621778.9A priority Critical patent/CN115114596A/en
Publication of CN115114596A publication Critical patent/CN115114596A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/16Program or content traceability, e.g. by watermarking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/14Fourier, Walsh or analogous domain transformations, e.g. Laplace, Hilbert, Karhunen-Loeve, transforms

Abstract

The embodiment of the application discloses a watermark processing method, a watermark processing device, electronic equipment and a computer readable storage medium; in the embodiment of the application, a work to be processed and a watermark information bit stream of the work to be processed are obtained, wherein the watermark information bit stream comprises a plurality of bits; carrying out frequency domain transformation on the work to be processed to obtain a frequency domain vector of the work to be processed; screening target bits from the watermark information bit stream, and determining target positions of the target bits in the watermark information bit stream; determining the target length of a target feature vector corresponding to the target bit according to the target position, and generating the target feature vector according to the target length and the target bit; and embedding the target characteristic vector into the frequency domain vector so as to add the watermark information corresponding to the watermark information bit stream into the work to be processed. The embodiment of the application can improve the anti-interference performance of the watermark information under the condition of reducing the influence of the watermark information on the to-be-processed works.

Description

Watermark processing method, watermark processing device, electronic equipment and computer readable storage medium
Technical Field
The present application relates to the field of digital watermarking technologies, and in particular, to a watermark processing method, an apparatus, an electronic device, and a computer-readable storage medium.
Background
With the development of society, users pay more and more attention to the copyright of works. In order to guarantee copyright, digital watermarking technology is applied to works. At present, the process of applying digital watermarking technology to works is as follows: firstly, converting watermark information into a feature vector with a fixed length, and then adding the feature vector into the work.
However, a fixed-length feature vector easily affects a work, and watermark information is easily destroyed when the work receives a disturbance (for example, the disturbance may be a clip).
Disclosure of Invention
The embodiment of the application provides a watermark processing method, a watermark processing device, electronic equipment and a computer readable storage medium, which can solve the technical problems that works are easily influenced and watermark information is easily damaged.
A watermarking method comprising:
acquiring a work to be processed and a watermark information bit stream of the work to be processed, wherein the watermark information bit stream comprises a plurality of bits;
carrying out frequency domain transformation on the work to be processed to obtain a frequency domain vector of the work to be processed;
screening target bits from the watermark information bit stream, and determining target positions of the target bits in the watermark information bit stream;
determining a target length of a target feature vector corresponding to the target bit according to the target position, and generating the target feature vector according to the target length and the target bit;
and embedding the target characteristic vector into the frequency domain vector so as to add the watermark information corresponding to the watermark information bit stream into the work to be processed.
Accordingly, an embodiment of the present application provides a watermark processing apparatus, including:
the device comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a work to be processed and a watermark information bit stream of the work to be processed, and the watermark information bit stream comprises a plurality of bits;
the transformation module is used for carrying out frequency domain transformation on the work to be processed to obtain a frequency domain vector of the work to be processed;
a screening module, configured to screen a target bit from the watermark information bit stream, and determine a target position of the target bit in the watermark information bit stream;
a generating module, configured to determine a target length of a target feature vector corresponding to the target bit according to the target position, and generate the target feature vector according to the target length and the target bit;
and the embedding module is used for embedding the target characteristic vector into the frequency domain vector so as to add the watermark information corresponding to the watermark information bit stream into the work to be processed.
Optionally, the watermarking module further includes:
a return execution module to execute:
if the target bit is not the last bit in the watermark information bit stream, returning to the step of screening the target bit from the watermark information bit stream until the target bit is the last bit in the watermark information bit stream;
and if the target bit is the last bit in the watermark information bit stream, finishing adding the watermark information corresponding to the watermark information bit stream into the work to be processed.
Optionally, the generating module is specifically configured to perform:
acquiring the minimum length and the growth factor of the watermark information bit stream;
and determining the target length of the target feature vector corresponding to the target bit according to the minimum length, the growth factor and the target position.
Optionally, the generating module is specifically configured to perform:
determining a first initial length of a target feature vector corresponding to the target bit according to the minimum length, the growth factor and a target position;
acquiring the maximum length of the watermark information bit stream;
and setting the smaller value of the maximum length and the first initial length as the target length of the target feature vector corresponding to the target bit.
Optionally, the generating module is specifically configured to perform:
determining a second initial length of the target feature vector corresponding to the target bit according to the target position;
and acquiring the intensity factor of the watermark information bit stream, and determining the target length of the target feature vector corresponding to the target bit according to the intensity factor and the second initial length.
Optionally, the generating module is specifically configured to perform:
determining the type of the target bit;
acquiring an initial feature vector corresponding to the target bit according to the type of the target bit;
and determining the target feature vector according to the target length and the initial feature vector.
Optionally, the embedded module is specifically configured to perform:
acquiring an initial starting position in the frequency domain vector and acquiring a target offset between the target bit and the frequency domain vector;
determining a target starting position of the target feature vector in the frequency domain vector according to the initial starting position and the target offset;
and embedding the target characteristic vector into the frequency domain vector according to the target starting position.
Optionally, the embedded module is specifically configured to perform:
if the target bit is the first bit in the watermark information bit stream, taking the initialization offset as the target offset between the target bit and the adjacent frequency domain;
if the target bit is not the first bit in the watermark information bit stream, determining the target offset according to the offset of the target bit in the previous bit in the watermark information bit stream and the previous length, wherein the previous length is the length corresponding to the feature vector of the previous bit.
Optionally, the watermarking module further includes:
and the vector determining module is used for determining a target difference vector according to the frequency domain vector and the frequency domain vector with the watermark, wherein the frequency domain vector with the watermark is obtained by embedding the target feature vector into the frequency domain vector.
And the vector acquisition module is used for acquiring the reference characteristic vector.
And the information screening module is used for screening the watermark information corresponding to the watermark information bit stream from the frequency domain vector with the watermark according to the target difference vector and the reference characteristic vector.
Optionally, the vector obtaining module is specifically configured to perform:
acquiring a current extraction length, an initial starting position in the frequency domain vector and a current offset;
screening out a detected feature vector from the target difference vector according to the current extraction length, the initial starting position and the current offset;
and determining a reference feature vector according to the length of the detected feature vector.
Correspondingly, the information screening module is specifically configured to perform:
determining bits corresponding to the detected feature vectors according to the detected feature vectors and the reference feature vectors;
and screening the watermark information corresponding to the watermark information bit stream from the watermarked frequency domain vector according to the bit corresponding to the detected feature vector.
Optionally, the watermarking module further includes:
an update module to perform:
if the number of bits corresponding to the detected feature vector is smaller than a preset number, updating the current offset according to the current extraction length to obtain an updated offset, and updating the current extraction length to obtain an updated extraction length;
and taking the updated current offset as the current offset, taking the updated extraction length as the current extraction length, and returning to the step of screening out the detected feature vector from the target difference vector according to the current extraction length, the initial starting position and the current offset.
Correspondingly, the information screening module is specifically configured to perform:
and if the number of the bits corresponding to the detected feature vector is equal to the preset number, screening out the watermark information corresponding to the watermark information bit stream from the watermarked frequency domain vector according to the bits corresponding to the detected feature vector.
In addition, an electronic device is further provided in an embodiment of the present application, and includes a processor and a memory, where the memory stores a computer program, and the processor is configured to run the computer program in the memory to implement the watermark processing method provided in the embodiment of the present application.
In addition, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored, where the computer program is suitable for being loaded by a processor to perform any one of the watermarking methods provided in the embodiment of the present application.
In addition, a computer program product is provided in an embodiment of the present application, and includes a computer program, where the computer program is executed by a processor to implement any one of the watermarking methods provided in the embodiment of the present application.
In the embodiment of the application, a work to be processed and a watermark information bit stream of the work to be processed are obtained first, and the watermark information bit stream comprises a plurality of bits. And then, carrying out frequency domain transformation on the work to be processed to obtain a frequency domain vector of the work to be processed, screening target bits from the watermark information bit stream, and determining the target positions of the target bits in the watermark information bit stream. And then, determining the target length of the target characteristic vector corresponding to the target bit according to the target position, and generating the target characteristic vector according to the target length and the target bit. And finally, embedding the target characteristic vector into the frequency domain vector so as to add the watermark information corresponding to the watermark information bit stream into the work to be processed.
That is, in the embodiment of the present application, after obtaining the watermark information bit stream, the target bits are screened from the watermark information bit stream, and the target positions of the target bits in the watermark information bit stream are determined, then, according to the target position, determining the target length of the target eigenvector corresponding to the target bit, when the target positions of the target bits are different, the target lengths of the target eigenvector of the target bit are different, namely, the feature vector of each bit in the watermark information bit stream is indefinite length, after the target feature vector of indefinite length is embedded into the frequency domain vector of the work to be processed, the work to be processed is not easily affected by the watermark information, moreover, the watermark information is not easy to be damaged, the anti-interference performance is strong, and the anti-interference performance of the watermark information is improved under the condition of reducing the influence of the watermark information on the to-be-processed work.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram of an application scenario of a watermarking method provided in an embodiment of the present application;
fig. 2 is a schematic flowchart of a watermarking method provided in an embodiment of the present application;
fig. 3 is a schematic flowchart of another watermarking method provided in an embodiment of the present application;
fig. 4 is a schematic structural diagram of a watermarking processing apparatus provided in an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
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, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application provides a watermark processing method, a watermark processing device, electronic equipment and a computer-readable storage medium. The electronic device may be a server or a terminal.
The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as cloud service, a cloud database, cloud computing, a cloud function, cloud storage, Network service, cloud communication, middleware service, domain name service, security service, Network acceleration service (CDN), big data and an artificial intelligence platform.
And, a plurality of servers can be grouped into a block chain, and the servers are nodes on the block chain.
The terminal may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, a smart television, a vehicle-mounted terminal, etc., but is not limited thereto. The terminal and the server may be directly or indirectly connected through wired or wireless communication, and the application is not limited herein.
For example, as shown in fig. 1, the terminal may obtain a to-be-processed work and a watermark information bitstream of the to-be-processed work, where the watermark information bitstream includes a plurality of bits, and then send the to-be-processed work and the watermark information bitstream of the to-be-processed work to the server.
Then, the server carries out frequency domain transformation on the work to be processed to obtain a frequency domain vector of the work to be processed; screening target bits from a watermark information bit stream, and determining target positions of the target bits in the watermark information bit stream; determining the target length of a target feature vector corresponding to the target bit according to the target position, and generating the target feature vector according to the target length and the target bit; and embedding the target characteristic vector into the frequency domain vector so as to add watermark information corresponding to the watermark information bit stream into the work to be processed, thereby obtaining the work with the watermark.
And the server returns the watermarked works to the terminal, so that the terminal acquires the watermarked works.
In addition, "a plurality" in the embodiment of the present application means two or more. "first" and "second" and the like in the embodiments of the present application are used for distinguishing the description, and are not to be construed as implying relative importance.
The following are detailed below. It should be noted that the following description of the embodiments is not intended to limit the preferred order of the embodiments.
The watermarking method according to the embodiment of the present application may be executed by a terminal or a server, or may be executed by the terminal and the server in a cooperative manner.
Referring to fig. 2, fig. 2 is a flowchart illustrating a watermark processing method according to an embodiment of the present application. The watermarking method may include:
s201, obtaining a work to be processed and a watermark information bit stream of the work to be processed, wherein the watermark information bit stream comprises a plurality of bits.
The work to be processed can be video, audio, text, pictures and the like. The works to be processed can be works stored locally in the terminal, and also can be works acquired by the terminal from other terminals. When the works to be processed are videos or pictures, the works to be processed can be obtained through the camera of the terminal, the works to be processed can also be obtained through the cameras of other terminals, then the other terminals send the works to be processed to the terminal, and therefore the terminal obtains the works to be processed.
And the watermark information bit stream of the work to be processed is the bit stream corresponding to the watermark information of the work to be processed. The terminal may directly obtain the watermark information bit stream, or the terminal may obtain the watermark information first and then encode the watermark information, so as to obtain the watermark information bit stream corresponding to the watermark information. The watermark information can be picture information or text information and the like.
The obtaining method of the work to be processed and the watermark information bit stream may be selected according to actual situations, and this embodiment is not limited herein.
The method for encoding the watermark information may be selected according to actual situations, for example, in the embodiment, the method of base64 is used to encode the watermark information into ASCII code, and then the ASCII code is converted into a bit stream, which is not limited herein.
The watermark information bit stream refers to a data stream including a plurality of bits, which may be 0 bits or 1 bit.
S202, performing frequency domain transformation on the work to be processed to obtain a frequency domain vector of the work to be processed.
The works to be processed are generally data in a space domain or a time domain, but the data in the space domain or the time domain are unstable and are easily lost when being interfered, and the data in the frequency domain has strong anti-interference capability, so that the works to be processed are subjected to frequency domain transformation to obtain frequency domain vectors of the works to be processed, and the information of the works to be processed is prevented from being lost in the subsequent process of adding watermark information to the works to be processed.
The method for performing frequency domain Transform on the work to be processed may be selected according to actual situations, for example, a Discrete Fourier Transform (DFT) method or a Discrete Cosine Transform (DCT) method is adopted as the method for performing frequency domain Transform on the work to be processed in the embodiment of the present application, and the embodiment of the present application is not limited herein.
It should be understood that, if the work to be processed is a video, before performing the frequency domain transform on the work to be processed, the frame extraction operation may be performed on the video, the video is extracted into image frames, and then the frequency domain transform is performed on the image frames of the video. If the work to be processed is audio, the audio can be segmented according to preset sampling points, and then frequency domain transformation is carried out on the audio of each segment.
S203, screening target bits from the watermark information bit stream, and determining the target positions of the target bits in the watermark information bit stream.
After the terminal acquires the watermark information bit stream, if the target bit is screened from the watermark information bit stream for the first time, the terminal can directly take the first bit in the watermark information bit stream as the target bit, that is, the target position of the target bit in the watermark information bit stream is 1.
If the target bit is not screened out from the watermark information bit stream information for the first time, the terminal can check the position of the last screened-out bit and then take the next bit of the position of the last screened-out bit as the target bit.
Optionally, a target variable may be set, then after the terminal acquires the watermark information bitstream, the value of the target variable is initialized to the first target value, the terminal checks the value of the target variable, and if the value of the target variable is the first target value, the first bit in the watermark information bitstream is directly used as the target bit. After the terminal obtains the target bit, the value of the target variable can be modified to the target position, so that the terminal can screen the target bit from the watermark information bit stream next time according to the value of the target variable.
For example, the first target value is 0, when the terminal screens out the target bit from the watermark information bitstream for the first time, because the value of the target variable is 0, the terminal takes the first bit in the watermark information bitstream as the target bit, then modifies the value of the target variable to 1, that is, modifies the value of the target variable to a target position, and then when the terminal screens out the target bit from the watermark information bitstream for the second time, because the value of the target variable is 1, the terminal takes the second bit in the watermark information bitstream as the target bit, at this time, the target position of the target bit is 2, then modifies the value of the target variable to 2, and the step is executed in a loop until the bits in the watermark information bitstream are screened out completely.
Alternatively, the screened out bits in the watermark information bit stream may be marked. After acquiring the watermark information bit stream, the terminal checks whether a marked bit exists in the watermark information bit stream, if the marked bit does not exist, the terminal takes a first bit in the watermark information bit stream as a target bit, and then marks the target bit, namely marks the first bit. If there is a marked bit, the next bit of the marked bit in the watermark information bit stream is taken as the target bit.
For example, when the terminal first screens out the target bit from the watermark information bit stream, because the watermark information bit stream does not have the marked bit, the terminal takes the first bit in the watermark information bit stream as the target bit and then marks the first bit. When the terminal screens out the target bit from the watermark information bit stream for the second time, because the first bit in the watermark information bit stream is marked, the terminal takes the next bit of the first bit in the watermark information bit stream, namely the second bit in the watermark information bit stream, as the target bit.
S204, determining the target length of the target feature vector corresponding to the target bit according to the target position, and generating the target feature vector according to the target length and the target bit.
The target position and the target length may be stored in the mapping table in an associated manner, after the terminal acquires the target position, the target length corresponding to the target position is searched from the mapping table, and the target length corresponding to the target position is used as the target length of the target feature vector corresponding to the target bit.
Or after the terminal acquires the target position, the terminal may substitute the target position into a preset relational expression to perform calculation, so as to obtain the target length of the target feature vector corresponding to the target bit.
When the target position is substituted into the preset relational expression for calculation to obtain the target length, the target length of the target characteristic vector corresponding to the target bit is determined according to the target position, and the method comprises the following steps:
acquiring the minimum length and growth factor of a watermark information bit stream;
and determining the target length of the target feature vector corresponding to the target bit according to the minimum length, the growth factor and the target position.
The minimum length and the growth factor are preset coefficients, and the minimum length, the growth factor and the target position are substituted into the following preset relational expression to obtain the target length, namely, the minimum length, the growth factor and the target position satisfy the following relational expression:
Flen=Lmin+pos×α
where, fire denotes the target length, Lmin denotes the minimum length, pos denotes the target position, and α denotes the growth factor.
To avoid the situation that the target length is too large, in some embodiments, determining the target length of the target feature vector corresponding to the target bit according to the minimum length, the growth factor, and the target position includes:
determining a first initial length of a target feature vector corresponding to a target bit according to the minimum length, the growth factor and the target position;
acquiring the maximum length of a watermark information bit stream;
and taking the smaller value of the maximum length and the first initial length as the target length of the target feature vector corresponding to the target bit.
The maximum length is also a preset coefficient, and at this time, the minimum length, the growth factor, the maximum length and the target position satisfy the following relation:
Flen=min(Lmax,Lmin+pos×α)
lmax denotes the maximum length.
It should be understood that different watermark information bit streams may correspond to the same maximum length, the same minimum length, and the same growth factor, or different watermark information bit streams may also correspond to different maximum lengths, different minimum lengths, and different growth factors, which is not limited herein.
In other embodiments, determining the target length of the target feature vector corresponding to the target bit according to the target position includes:
determining a second initial length of the target feature vector corresponding to the target bit according to the target position;
and acquiring the intensity factor of the watermark information bit stream, and determining the target length of the target feature vector corresponding to the target bit according to the intensity factor and the second initial length.
Or, taking the smaller of the maximum length and the first initial length as the target length of the target feature vector corresponding to the target bit, including:
taking the smaller value of the maximum length and the first initial length as a second initial length of the target feature vector corresponding to the target bit;
and determining the target length of the target feature vector corresponding to the target bit according to the intensity factor and the second initial length.
The intensity factor is a preset coefficient. At this time, the intensity factor and the second initial length satisfy the following relational expression:
Flen=Fa×β
fa denotes the second initial length and β denotes the intensity factor.
The low-frequency coefficient in the frequency domain vector contains more information of the work to be processed, and is stable, and the high-frequency coefficient in the frequency domain vector contains the detail information of the work to be processed, and is unstable. Modifying the low-frequency coefficient is likely to cause sensory influence on the to-be-processed work (for example, modifying the low-frequency coefficient is likely to cause influence on image quality when the to-be-processed work is a picture), that is, embedding the watermark information into the low-frequency coefficient is likely to cause sensory influence on the to-be-processed work.
Modifying the high-frequency coefficient does not cause sensory influence on the work to be processed, but when the work to be processed is interfered (for example, a picture is compressed), the detail information of the work to be processed is easily lost, that is, when the watermark information is embedded into the high-frequency coefficient, if the work to be processed added with the watermark information is interfered, the watermark information is easily lost.
Therefore, in the process of setting the intensity factor, the influence on the work to be processed and the anti-interference performance of the watermark information can be balanced.
After obtaining the target length, the terminal may generate a target feature vector according to the target length and the target bit. Because the bits included in the watermark information bit stream are 0 bits or 1 bit, a first initial feature vector corresponding to 0 bits and a second initial feature vector corresponding to 1 bits may be preset, then after the terminal obtains the target length, according to the type of the target bits, the terminal screens out the initial feature vector corresponding to the target bits from the first initial feature vector or the second initial feature vector, and finally intercepts the target feature vector of the target length from the initial feature vector, that is, at this time, according to the target length and the target bits, the generating of the target feature vector may include:
determining the type of a target bit;
acquiring an initial feature vector corresponding to a target bit according to the type of the target bit;
and determining a target characteristic vector according to the target length and the initial characteristic vector.
The type of the target bit is 0 type or 1 type. For example, 0 bits correspond to a first initial feature vector of 01010101010101, 1 bits correspond to a second initial feature vector of 10101010101010, and the target length is 5. When the target bit is 0 bit, and the type of the target bit is 0 type, the initial eigenvector corresponding to the target bit is the first initial eigenvector 01010101010101, and then the terminal intercepts the first 5 elements 01010 from the first initial eigenvector 01010101010101 as the target eigenvector.
It should be noted that the first initial feature vector corresponding to 0 bit and the second initial feature vector corresponding to 1 bit may be indefinite, that is, the first initial feature vector corresponding to 0 bit and the second initial feature vector corresponding to 1 bit which are indefinite are generated in advance, and then the target feature vector of the target length is intercepted from the first initial feature vector corresponding to 0 bit which is indefinite, or the target feature vector of the target length is intercepted from the second initial feature vector corresponding to 1 bit which is indefinite.
Or after the terminal obtains the target length, a generation rule of a feature vector corresponding to 0 bit and a generation rule of a feature vector corresponding to 1 bit may be preset, and then after obtaining the target length, a generation rule corresponding to the target bit is obtained according to the type of the target bit, and the target feature vector is generated according to the generation rules corresponding to the target bit and the target generation.
For example, if the generation rule of the feature vector corresponding to 0 bit is 01, the generation rule of the feature vector corresponding to 1 bit is 10, the target length is 5, the target bit is 0 bit, the type of the target bit is 0 type, and the generation rule of the target feature vector corresponding to the target bit is 01, then repeating the operation of 01 to obtain the target feature vector 01010.
In this embodiment, according to a target position of a target bit in a watermark information bit stream, a target length of a target feature vector corresponding to the target bit is determined, and target positions of different target bits in the watermark information bit stream are different, so that target lengths of target feature vectors corresponding to different target bits are also different, so that the target length is longer for bits located further back in the watermark information bit stream, and thus more target feature vectors corresponding to the target bits in the watermark information bit stream can be embedded into a high-frequency coefficient in a frequency domain vector, that is, more watermark information is embedded into high-frequency information of a work to be processed, thereby reducing an influence of the watermark information on the work to be processed.
In addition, although more target feature vectors corresponding to target bits are embedded into the high-frequency coefficients in the frequency domain vector, since the target feature vectors are not of a constant length, the anti-interference capability of the watermark information can be ensured even if the target feature vectors are embedded into the high-frequency coefficients of the frequency domain vector.
S205, embedding the target characteristic vector into the frequency domain vector to add the watermark information corresponding to the watermark information bit stream into the work to be processed.
After obtaining the target feature vector, the terminal may directly add the target feature vector to the frequency domain vector. Alternatively, in order to further realize that less watermark information is embedded in the low-frequency coefficients of the frequency domain vector and more watermark information is embedded in the high-frequency coefficients of the frequency domain vector, an initial start position of the frequency domain vector may be set in advance, and then the target feature vector and the frequency domain feature vector may be added from the initial start position.
When the target feature vector is added with the frequency domain feature vector from the initial starting position, embedding the target feature vector into the frequency domain vector, including:
acquiring an initial starting position in a frequency domain vector and acquiring a target offset between a target bit and the frequency domain vector;
determining a target starting position of the target characteristic vector in the frequency domain vector according to the initial starting position and the target offset;
and embedding the target feature vector into the frequency domain vector according to the target starting position.
The initial starting position is a preset position, and the initial starting positions of different watermark information bit streams in the frequency domain vector may be the same or different, which is not limited herein.
Optionally, when the watermark information bit stream and the frequency domain vector are determined, the target lengths of all target feature vectors corresponding to the watermark information bit stream and the lengths of the frequency domain vectors may also be determined. Therefore, the initial starting position of the watermark information bit stream in the frequency domain vector can be determined according to the target lengths of all the target feature vectors corresponding to the watermark information bit stream and the length of the frequency domain vector, and the sum of the target lengths of all the target feature vectors corresponding to the watermark information bit stream and the initial starting position is less than or equal to the length of the frequency domain vector.
It should be noted that, in order to further realize that less watermark information is embedded in the low-frequency coefficients of the frequency-domain vector, more watermark information is embedded in the high-frequency coefficients of the frequency-domain vector, the sum of the target length and the initial starting position of all target feature vectors corresponding to the watermark information bit stream can be made equal to the length of the frequency-domain vector.
After obtaining the initial starting position and the target offset, the terminal may add the initial starting position and the target offset to obtain a target starting position of the target feature vector in the frequency domain vector, and then add the target feature vector and the frequency domain vector from the target starting position.
For example, when the target start position is 10, the first element of the target feature vector is aligned with the tenth coefficient of the frequency domain vector and then added, that is, the first element of the target feature vector is added to the tenth coefficient of the frequency domain vector, and the second element of the target feature vector is added to the eleventh coefficient of the frequency domain vector until the addition of the elements of the target feature vector and the coefficients of the frequency domain vector is completed.
In some embodiments, when the target feature vector is added to the frequency domain vector starting from the target start position, a sub-offset between elements of the target feature vector may also be obtained, and then the target feature vector is added to the frequency domain vector according to the sub-offset starting from the target start position.
For example, the sub-offset is 2, the target start position is 10, the first element of the target feature vector is added to the tenth coefficient of the frequency domain vector, and the second element of the target feature vector is added to the thirteenth coefficient of the frequency domain vector until the addition of the elements of the target feature vector and the coefficients of the frequency domain vector is completed.
In other embodiments, obtaining the target offset between the target bit and the frequency domain vector comprises:
if the target bit is the first bit in the watermark information bit stream, the initialization offset is used as the target offset between the target bit and the frequency domain vector;
and if the target bit is not the first bit in the watermark information bit stream, determining the target offset according to the offset of the target bit in the previous bit in the watermark information bit stream and the previous length, wherein the previous length is the length corresponding to the feature vector of the previous bit.
The offset of the previous bit may be added to the previous length of the previous bit to obtain a target offset of the target bit, that is:
offset=offset+Flen
offset represents a target offset amount.
For example, the initialization offset is 0, when the target bit is the first bit in the watermark information bitstream, the target offset of the target bit is 0, the target start position is the initial start position, and the length of the first bit is 5. When the target bit is the second bit in the watermark information bit stream, the previous bit of the target bit in the watermark information bit stream is the first bit in the watermark information bit stream, and since the targeting offset of the first bit is 0 and the length of the first bit is 5, the target offset of the second bit is the previous length 5, and the target starting position of the second bit is the sum of the initial starting position and 5.
It should be noted that, when sub-offsets exist between elements of the target feature vector, the offset of the previous bit, the previous length of the previous bit, and the sub-offset between feature vectors corresponding to the previous bit may also be added to obtain the target offset of the target bit.
After the target feature vector of the target bit is embedded into the frequency domain vector, if the target bit is not the last bit in the watermark information bit stream, bits that are not embedded into the frequency domain vector in the watermark information bit stream yet need to be embedded into the frequency domain vector, and the corresponding feature vector is embedded into the frequency domain vector.
Therefore, after the target feature vector corresponding to the target bit is embedded into the frequency domain vector, if the target bit is not the last bit in the watermark information bit stream, the step of screening the target bit from the watermark information bit stream is returned to be executed until the target bit is the last bit in the watermark information bit stream, and if the target bit is the last bit in the watermark information bit stream, the step of adding the watermark information corresponding to the watermark information bit stream into the work to be processed is completed.
Optionally, if the target bit is not the last bit in the watermark information bitstream, the target offset of the next bit of the target bit in the watermark information bitstream may be determined according to the target length of the target bit and the target offset, so that when the next bit is used as the target bit, the target offset of the next bit may be directly obtained without performing calculation, and then the step of screening the target bit from the watermark information bitstream is performed.
After embedding the feature vectors corresponding to all bits in the watermark information bit stream into the frequency domain vector, obtaining the frequency domain vector with the watermark, and then performing inverse frequency domain transformation on the frequency domain vector with the watermark to obtain the watermark work corresponding to the work to be processed.
It should be understood that if the work to be processed is a video, after performing inverse frequency domain transformation on the watermarked frequency domain vector, a watermarked image frame is obtained, and at this time, the watermarked image frame needs to be reassembled again to obtain the watermarked video.
If the work to be processed is audio, the watermark audio segments are obtained after inverse frequency domain transformation is carried out on the watermark frequency domain vector, and at the moment, the watermark audio segments are required to be spliced to obtain the watermark audio.
After obtaining the frequency domain vector with watermark or the works with watermark, the terminal may extract the watermark information in the works with watermark, so in some embodiments, after embedding the target feature vector into the frequency domain vector, the terminal further includes:
determining a target difference vector according to the frequency domain vector and the frequency domain vector with the watermark, wherein the frequency domain vector with the watermark is obtained after the target feature vector is embedded into the frequency domain vector;
acquiring a reference feature vector;
and screening watermark information corresponding to the watermark information bit stream from the frequency domain vector with the watermark according to the target difference vector and the reference characteristic vector.
The terminal may subtract the frequency domain vector from the frequency domain vector with the watermark, so as to obtain a target difference vector. The reference feature vector may be a preset vector or a vector set according to the target difference vector.
When the reference feature vector is a vector set according to the target difference vector, obtaining the reference feature vector may include:
acquiring the current extraction length, the initial starting position in the frequency domain vector and the current offset;
screening out a detected feature vector from the target difference vector according to the current extraction length, the initial starting position and the current offset;
determining a reference feature vector according to the length of the detected feature vector;
according to the target difference vector and the reference characteristic vector, screening out watermark information corresponding to the watermark information bit stream from the frequency domain vector with the watermark, wherein the watermark information comprises the following steps:
determining bits corresponding to the detected feature vectors according to the detected feature vectors and the reference feature vectors;
and screening watermark information corresponding to the watermark information bit stream from the frequency domain vector with the watermark according to the detected bits corresponding to the characteristic vector.
After the terminal acquires the frequency domain vector with the watermark, the terminal may initialize the current position to 0, and then determine the current extraction length according to the current position. The method for determining the current extraction length according to the current position may refer to the method for determining the target length according to the target position, and this embodiment is not described herein again.
Optionally, the process of screening out the detected feature vector from the target difference vector according to the current extraction length, the initial starting position, and the current offset may be:
and adding the initial starting position and the current offset to obtain a left boundary value of the target interval, adding the initial starting position, the current offset and the current extraction length to obtain a right boundary value of the target interval, and then taking elements belonging to the target interval in the target difference vector as the detected feature vector.
For example, when the initial position is S, the current extraction length is fire ', and the current offset is offset', the target interval is [ S + offset ', S + offset' + fire '], and the (S + offset') th to (S + offset '+ fire') th elements in the target difference vector constitute the detected feature vector.
After the terminal obtains the detected feature vector, the length of the detected feature vector can be determined, that is, the truncation length (the truncation length is the length of the detected feature vector) can be determined according to the target interval.
Then, starting from the first element of the first initial feature vector corresponding to 0 bit, truncating a first reference feature vector with a truncated length, and starting from the first element of the second initial feature vector corresponding to 1 bit, truncating a second reference feature vector with a truncated length, namely, the reference feature vector comprises the first reference feature vector and the second reference feature vector.
Or after the terminal obtains the detected feature vector, generating a first reference feature vector with a truncated length according to a generation rule of the feature vector corresponding to 0 bit, and generating a second reference feature vector with the truncated length according to a generation rule of the feature vector corresponding to 1 bit.
For example, the generation rule of the feature vector corresponding to 0 bit is 01, the generation rule of the feature vector corresponding to 1 bit is 10, the truncation length is 5, the first reference feature vector 01010 can be obtained by repeating 01 according to the generation rule of the feature vector corresponding to 0 bit being 01, and the second reference feature vector 10101 can be obtained by repeating 10 according to the generation rule of the feature vector corresponding to 1 bit being 10.
Then, the terminal calculates a first similarity between the detected feature vector and the first reference feature vector, and calculates a second similarity between the detected feature vector and the second reference feature vector, wherein if the first similarity is higher than the second similarity, a bit corresponding to the detected feature vector is 0 bit, and if the first similarity is lower than the second similarity, the bit corresponding to the detected feature vector is 1 bit.
After the bits corresponding to the detected feature vectors are obtained, the bits corresponding to the detected feature vectors form a watermark information bit stream, so that watermark information corresponding to the watermark information bit stream can be obtained, that is, after the bits corresponding to the detected feature vectors are obtained, watermark information corresponding to the watermark information bit stream can be screened from the frequency domain vector with watermark.
It should be noted that, after obtaining the bits corresponding to the detected feature vector, if the number of the bits corresponding to the detected feature vector is smaller than the number of all bits included in the watermark information bit stream (one detected feature vector may correspond to one bit, and when a plurality of detected vectors are obtained, a plurality of bits may be obtained), the number of all bits included in the watermark information bit stream is a preset number, which indicates that all bits included in the watermark information bit stream have not been obtained yet, then the detected feature vector needs to be further screened out from the target difference vector. If the number of the bits corresponding to the detected feature vector is equal to the preset number, the watermark information corresponding to the watermark information bit stream can be screened from the frequency domain vector with the watermark according to the bits corresponding to the detected feature vector.
Therefore, before the step of screening the watermark information corresponding to the watermark information bit stream from the frequency domain vector with watermark according to the bits corresponding to the detected feature vector, the method further includes:
if the number of the bits corresponding to the detected feature vector is smaller than the preset number, updating the current offset according to the current extraction length to obtain an updated offset, and updating the current extraction length to obtain an updated extraction length;
taking the updated current offset as the current offset, taking the updated extraction length as the current extraction length, and returning to the step of screening out the detected feature vector from the target difference vector according to the current extraction length, the initial starting position and the current offset;
according to the detected bits corresponding to the feature vectors, watermark information corresponding to the watermark information bit stream is screened from the frequency domain vector with the watermark, and the method comprises the following steps:
and if the number of the bits corresponding to the detected feature vector is equal to the preset number, screening the watermark information corresponding to the watermark information bit stream from the frequency domain vector with the watermark according to the bits corresponding to the detected feature vector.
Wherein, according to the current extraction length, the current offset is updated, and the process of obtaining the updated offset can be as follows: the current extraction length and the current offset may be added to obtain an updated offset.
The current extraction length is updated, and the process of obtaining the updated extraction length may be: and (4) adding 1 to the current position to obtain the added current position, taking the added current position as a new current position, and calculating the updated extraction length according to the new current position.
It should be understood that after the terminal acquires the frequency domain vector with watermark, the current offset may be initialized to 0, and the current position may be initialized to 0. If the terminal extracts the detected feature vector from the frequency domain vector with the watermark for the first time, the current offset is 0, and the current extraction length is the minimum length.
In this embodiment, a target difference vector is determined by a frequency domain vector and a watermarked frequency domain vector, and then a watermark information bit stream is extracted from the watermarked frequency domain vector according to the target difference vector and a reference feature vector, so as to obtain watermark information corresponding to the watermark information bit stream, thereby realizing extraction of the watermark information from a watermarked work (obtained by performing inverse frequency domain transformation on the watermarked frequency domain vector).
As can be seen from the above, in the embodiment of the present application, a work to be processed and a watermark information bit stream of the work to be processed are obtained first, where the watermark information bit stream includes multiple bits. And then, carrying out frequency domain transformation on the work to be processed to obtain a frequency domain vector of the work to be processed, screening target bits from the watermark information bit stream, and determining the target positions of the target bits in the watermark information bit stream. And then, determining the target length of the target characteristic vector corresponding to the target bit according to the target position, and generating the target characteristic vector according to the target length and the target bit. And finally, embedding the target characteristic vector into the frequency domain vector so as to add the watermark information corresponding to the watermark information bit stream into the work to be processed.
That is, in the embodiment of the present application, after obtaining the watermark information bit stream, the target bits are screened from the watermark information bit stream, and the target positions of the target bits in the watermark information bit stream are determined, then, according to the target position, determining the target length of the target eigenvector corresponding to the target bit, when the target positions of the target bits are different, the target lengths of the target eigenvector of the target bit are different, namely, the feature vector of each bit in the watermark information bit stream is indefinite length, after the target feature vector of indefinite length is embedded into the frequency domain vector of the work to be processed, the work to be processed is not easily affected by the watermark information, moreover, the watermark information is not easy to be damaged, the anti-interference performance is strong, and the anti-interference performance of the watermark information is improved under the condition of reducing the influence of the watermark information on the to-be-processed work.
The method described in the above embodiments is further illustrated in detail by way of example.
Referring to fig. 3, fig. 3 is a flowchart illustrating a watermark processing method according to an embodiment of the present application, where the watermark processing method according to the embodiment of the present application may be executed by a terminal or a server, or may be executed by the terminal and the server in a cooperative manner, and in this embodiment, the terminal is taken as an execution subject for an example to be described in detail. The watermark processing method flow can comprise the following steps:
s301, the terminal obtains the works to be processed and the watermark information of the works to be processed.
S302, the terminal carries out frequency domain transformation on the work to be processed to obtain a frequency domain vector of the work to be processed.
If the work to be processed is a video, before the work to be processed is subjected to frequency domain transformation, frame extraction operation can be performed on the video, the video is extracted into image frames, and then the frequency domain transformation is performed on the image frames of the video. If the work to be processed is audio, the audio can be segmented according to preset sampling points, and then frequency domain transformation is carried out on the audio of each segment.
S303, the terminal encodes the watermark information to obtain a watermark information bit stream.
The terminal firstly adopts the method of base64 to encode the watermark information into ASCII code, and then converts the ASCII code into bit stream
S304, the terminal generates a first initial feature vector corresponding to 0 bits and generates a second initial feature vector corresponding to 1 bit, wherein the second initial feature vector and the second initial feature vector are vectors with indefinite lengths.
For example, the first initial feature vector is 01010101010101 …, and the second initial feature vector is 10101010101010 ….
S305, the terminal screens out target bits from the watermark information bit stream and determines target positions of the target bits in the watermark information bit stream.
S306, the terminal acquires the minimum length, the maximum length and the growth factor of the watermark information bit stream, and determines the first initial length of the target feature vector corresponding to the target bit according to the minimum length, the growth factor and the target position.
S307, the terminal takes the smaller value of the maximum length and the first initial length as a second initial length of the target feature vector corresponding to the target bit, and determines the target length of the target feature vector according to the strength factor and the second initial length.
S308, the terminal determines the type of the target bit and screens out the initial characteristic vector corresponding to the target bit from the first initial characteristic vector and the second initial characteristic vector according to the type of the target bit.
S309, the terminal intercepts a target feature vector with the target length from the initial feature vector.
S3010, the terminal obtains an initial starting position in the frequency domain vector and obtains a target offset, and determines a target starting position of the target feature vector in the frequency domain vector according to the initial starting position and the target offset.
S3011, the terminal embeds the target feature vector into a frequency domain vector according to the target starting position.
S3012, if the target bit is not the last bit in the watermark information bit stream, the terminal updates the target offset according to the target length to obtain an updated target offset, takes the updated target offset as the target offset, and returns to execute the step S305.
S3013, if the target bit is the last bit in the watermark information bit stream, the terminal completes adding the watermark information corresponding to the watermark information bit stream to the work to be processed.
S3014, the terminal determines a target difference value vector according to the frequency domain vector and the frequency domain vector with the watermark, wherein the frequency domain vector with the watermark is obtained after the target feature vector is embedded into the frequency domain vector.
S3015, the terminal obtains the current extraction length, the initial starting position in the frequency domain vector and the current offset.
S3016, the terminal screens out the detected feature vectors from the target difference vectors according to the current extraction length, the initial starting position and the current offset.
S3017, the terminal extracts a first reference feature vector having the same length as the detected feature vector from the first initial feature vector, and extracts a second reference feature vector having the same length as the detected feature vector from the second initial feature vector.
S3018, the terminal calculates a first similarity between the detected feature vector and the first reference feature vector and calculates a second similarity between the detected feature vector and the second reference feature vector.
S3019, if the first similarity is higher than the second similarity, the bit corresponding to the detected feature vector is 0 bit, and if the first similarity is lower than the second similarity, the bit corresponding to the detected feature vector is 1 bit.
And S3020, if the number of the bits corresponding to the detected feature vector is smaller than the preset number, the terminal updates the current offset according to the current extraction length to obtain an updated offset, and updates the current extraction length to obtain an updated extraction length.
S3021, the terminal sets the updated current offset as the current offset, sets the updated extraction length as the current extraction length, and returns to step S3016.
And S3022, if the number of the bits corresponding to the detected feature vector is equal to the preset number, the terminal screens the watermark information corresponding to the watermark information bit stream from the frequency domain vector with the watermark according to the bits of the detected feature vector.
It should be understood that the execution sequence of each step in the above embodiments is not limited.
The specific implementation manner and the corresponding beneficial effects in this embodiment may specifically refer to the above-mentioned embodiment of the watermarking method, and this embodiment is not described again here.
In order to better implement the watermarking method provided by the embodiment of the present application, the embodiment of the present application further provides a device based on the watermarking method. The terms are the same as those in the above-mentioned watermarking method, and details of implementation may refer to the description in the method embodiment.
For example, as shown in fig. 4, the watermark processing apparatus may include:
an obtaining module 401, configured to obtain a to-be-processed work and a watermark information bitstream of the to-be-processed work, where the watermark information bitstream includes a plurality of bits.
And the transforming module 402 is configured to perform frequency domain transformation on the work to be processed to obtain a frequency domain vector of the work to be processed.
And a screening module 403, configured to screen out target bits from the watermark information bit stream, and determine target positions of the target bits in the watermark information bit stream.
A generating module 404, configured to determine a target length of the target feature vector corresponding to the target bit according to the target position, and generate the target feature vector according to the target length and the target bit.
An embedding module 405, configured to embed the target feature vector into the frequency domain vector, so as to add watermark information corresponding to the watermark information bit stream to the work to be processed.
Optionally, the watermark processing apparatus further includes:
a return execution module to execute:
if the target bit is not the last bit in the watermark information bit stream, returning to the step of screening the target bit from the watermark information bit stream until the target bit is the last bit in the watermark information bit stream;
and if the target bit is the last bit in the watermark information bit stream, finishing adding the watermark information corresponding to the watermark information bit stream into the work to be processed.
Optionally, the generating module 404 is specifically configured to perform:
acquiring the minimum length and growth factor of a watermark information bit stream;
and determining the target length of the target feature vector corresponding to the target bit according to the minimum length, the growth factor and the target position.
Optionally, the generating module 404 is specifically configured to perform:
determining a first initial length of a target feature vector corresponding to a target bit according to the minimum length, the growth factor and the target position;
acquiring the maximum length of a watermark information bit stream;
and taking the smaller value of the maximum length and the first initial length as the target length of the target feature vector corresponding to the target bit.
Optionally, the generating module 404 is specifically configured to perform:
determining a second initial length of the target feature vector corresponding to the target bit according to the target position;
and acquiring the intensity factor of the watermark information bit stream, and determining the target length of the target feature vector corresponding to the target bit according to the intensity factor and the second initial length.
Optionally, the generating module 404 is specifically configured to perform:
determining the type of the target bit;
acquiring an initial feature vector corresponding to a target bit according to the type of the target bit;
and determining a target characteristic vector according to the target length and the initial characteristic vector.
Optionally, the embedded module 405 is specifically configured to perform:
acquiring an initial starting position in the frequency domain vector and acquiring a target offset between a target bit and the frequency domain vector;
determining a target starting position of the target characteristic vector in the frequency domain vector according to the initial starting position and the target offset;
and embedding the target feature vector into the frequency domain vector according to the target starting position.
Optionally, the embedded module 405 is specifically configured to perform:
if the target bit is the first bit in the watermark information bit stream, the initialization offset is used as the target offset between the target bit and the adjacent frequency domain;
and if the target bit is not the first bit in the watermark information bit stream, determining the target offset according to the offset of the target bit in the previous bit in the watermark information bit stream and the previous length, wherein the previous length is the length corresponding to the feature vector of the previous bit.
Optionally, the watermark processing apparatus further includes:
and the vector determining module is used for determining a target difference vector according to the frequency domain vector and the frequency domain vector with the watermark, wherein the frequency domain vector with the watermark is obtained after the target feature vector is embedded into the frequency domain vector.
And the vector acquisition module is used for acquiring the reference characteristic vector.
And the information screening module is used for screening the watermark information corresponding to the watermark information bit stream from the frequency domain vector with the watermark according to the target difference vector and the reference characteristic vector.
Optionally, the vector obtaining module is specifically configured to perform:
acquiring the current extraction length, the initial starting position in the frequency domain vector and the current offset;
screening out a detected feature vector from the target difference vector according to the current extraction length, the initial starting position and the current offset;
and determining the reference feature vector according to the length of the detected feature vector.
Correspondingly, the information filtering module is specifically configured to perform:
determining bits corresponding to the detected feature vectors according to the detected feature vectors and the reference feature vectors;
and screening watermark information corresponding to the watermark information bit stream from the frequency domain vector with the watermark according to the detected bits corresponding to the characteristic vector.
Optionally, the watermark processing module further includes:
an update module to perform:
if the number of the bits corresponding to the detected feature vector is smaller than the preset number, updating the current offset according to the current extraction length to obtain an updated offset, and updating the current extraction length to obtain an updated extraction length;
and taking the updated current offset as the current offset, taking the updated extraction length as the current extraction length, and returning to the step of screening the detected feature vector from the target difference vector according to the current extraction length, the initial starting position and the current offset.
Correspondingly, the information screening module is specifically configured to perform:
and if the number of the bits corresponding to the detected feature vector is equal to the preset number, screening the watermark information corresponding to the watermark information bit stream from the frequency domain vector with the watermark according to the bits corresponding to the detected feature vector.
In specific implementation, the above modules may be implemented as independent entities, or may be combined arbitrarily to be implemented as the same or several entities, and specific implementation manners and corresponding beneficial effects of the above modules may refer to the foregoing method embodiments, which are not described herein again.
An embodiment of the present application further provides an electronic device, where the electronic device may be a server or a terminal, and as shown in fig. 5, a schematic structural diagram of the electronic device according to the embodiment of the present application is shown, specifically:
the electronic device may include components such as a processor 501 of one or more processing cores, memory 502 of one or more computer-readable storage media, a power supply 503, and an input unit 504. Those skilled in the art will appreciate that the electronic device configuration shown in fig. 5 does not constitute a limitation of the electronic device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the processor 501 is a control center of the electronic device, connects various parts of the entire electronic device using various interfaces and lines, performs various functions of the electronic device and processes data by operating or executing computer programs and/or modules stored in the memory 502 and calling data stored in the memory 502. Optionally, processor 501 may include one or more processing cores; preferably, the processor 501 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 501.
The memory 502 may be used to store computer programs and modules, and the processor 501 executes various functional applications and data processing by operating the computer programs and modules stored in the memory 502. The memory 502 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, a computer program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the electronic device, and the like. Further, the memory 502 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 502 may also include a memory controller to provide the processor 501 access to the memory 502.
The electronic device further comprises a power supply 503 for supplying power to each component, and preferably, the power supply 503 may be logically connected to the processor 501 through a power management system, so that functions of managing charging, discharging, power consumption, and the like are realized through the power management system. The power supply 503 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
In some embodiments, the electronic device may further include an input unit 504, and the input unit 504 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
Although not shown, the electronic device may further include a display unit and the like, which are not described in detail herein. Specifically, in this embodiment, the processor 501 in the electronic device loads the executable file corresponding to the process of one or more computer programs into the memory 502 according to the following instructions, and the processor 501 runs the computer program stored in the memory 502, so as to implement various functions, such as:
acquiring a work to be processed and a watermark information bit stream of the work to be processed, wherein the watermark information bit stream comprises a plurality of bits;
carrying out frequency domain transformation on the work to be processed to obtain a frequency domain vector of the work to be processed;
screening target bits from the watermark information bit stream, and determining target positions of the target bits in the watermark information bit stream;
determining the target length of a target characteristic vector corresponding to the target bit according to the target position, and generating the target characteristic vector according to the target length and the target bit;
and embedding the target characteristic vector into the frequency domain vector so as to add the watermark information corresponding to the watermark information bit stream into the work to be processed.
The above detailed embodiments of the operations and the corresponding advantageous effects may refer to the above detailed description of the watermark processing method, which is not described herein again.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by a computer program, which may be stored in a computer-readable storage medium and loaded and executed by a processor, or by related hardware controlled by the computer program.
To this end, the present application provides a computer-readable storage medium, in which a computer program is stored, where the computer program can be loaded by a processor to execute the steps in any one of the watermarking methods provided by the present application. For example, the computer program may perform the steps of:
acquiring a work to be processed and a watermark information bit stream of the work to be processed, wherein the watermark information bit stream comprises a plurality of bits;
carrying out frequency domain transformation on the work to be processed to obtain a frequency domain vector of the work to be processed;
screening target bits from the watermark information bit stream, and determining target positions of the target bits in the watermark information bit stream;
determining the target length of a target feature vector corresponding to the target bit according to the target position, and generating the target feature vector according to the target length and the target bit;
and embedding the target characteristic vector into the frequency domain vector so as to add the watermark information corresponding to the watermark information bit stream into the work to be processed.
The specific implementation of the above operations and the corresponding beneficial effects can be referred to the foregoing embodiments, and are not described herein again.
Wherein the computer-readable storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the computer program stored in the computer-readable storage medium can execute the steps in any of the watermarking methods provided in the embodiments of the present application, beneficial effects that can be achieved by any of the watermarking methods provided in the embodiments of the present application can be achieved, for details, see the foregoing embodiments, and are not described herein again.
According to an aspect of the present application, there is provided a computer program product having a computer program stored thereon. The computer program may be loaded by a processor of a computer device, causing the computer device to perform the above-mentioned watermarking method.
The foregoing describes in detail a watermarking method, apparatus, electronic device and computer-readable storage medium provided in an embodiment of the present application, and a specific example is applied in the present application to explain the principles and embodiments of the present application, and the description of the foregoing embodiment is only used to help understand the method and core ideas of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (15)

1. A watermarking method, comprising:
obtaining a work to be processed and a watermark information bit stream of the work to be processed, wherein the watermark information bit stream comprises a plurality of bits;
carrying out frequency domain transformation on the work to be processed to obtain a frequency domain vector of the work to be processed;
screening target bits from the watermark information bit stream, and determining target positions of the target bits in the watermark information bit stream;
determining the target length of a target characteristic vector corresponding to the target bit according to the target position, and generating the target characteristic vector according to the target length and the target bit;
and embedding the target characteristic vector into the frequency domain vector so as to add the watermark information corresponding to the watermark information bit stream into the work to be processed.
2. The watermarking method according to claim 1, further comprising, after the embedding the target feature vector into the frequency domain vector:
if the target bit is not the last bit in the watermark information bit stream, returning to the step of screening the target bit from the watermark information bit stream until the target bit is the last bit in the watermark information bit stream;
and if the target bit is the last bit in the watermark information bit stream, finishing adding the watermark information corresponding to the watermark information bit stream into the work to be processed.
3. The method of claim 1, wherein the determining the target length of the target feature vector corresponding to the target bit according to the target position comprises:
acquiring the minimum length and the growth factor of the watermark information bit stream;
and determining the target length of the target feature vector corresponding to the target bit according to the minimum length, the growth factor and the target position.
4. The method of claim 3, wherein the determining the target length of the target feature vector corresponding to the target bit according to the minimum length, the growth factor, and the target location comprises:
determining a first initial length of a target feature vector corresponding to the target bit according to the minimum length, the growth factor and the target position;
acquiring the maximum length of the watermark information bit stream;
and taking the smaller value of the maximum length and the first initial length as the target length of the target feature vector corresponding to the target bit.
5. The method of claim 1, wherein the determining the target length of the target feature vector corresponding to the target bit according to the target position comprises:
determining a second initial length of a target feature vector corresponding to the target bit according to the target position;
and acquiring the intensity factor of the watermark information bit stream, and determining the target length of the target feature vector corresponding to the target bit according to the intensity factor and the second initial length.
6. The method of claim 1, wherein the generating the target feature vector according to the target length and the target bit comprises:
determining a type of the target bit;
acquiring an initial feature vector corresponding to the target bit according to the type of the target bit;
and determining the target feature vector according to the target length and the initial feature vector.
7. The watermarking method according to claim 1, wherein the embedding the target feature vector into the frequency domain vector comprises:
acquiring an initial starting position in the frequency domain vector and acquiring a target offset between the target bit and the frequency domain vector;
determining a target starting position of the target feature vector in the frequency domain vector according to the initial starting position and the target offset;
and embedding the target feature vector into the frequency domain vector according to the target starting position.
8. The method of claim 7, wherein the obtaining the target offset between the target bit and the frequency domain vector comprises:
if the target bit is the first bit in the watermark information bit stream, taking an initialization offset as a target offset between the target bit and the adjacent frequency domain;
and if the target bit is not the first bit in the watermark information bit stream, determining the target offset according to the offset of the previous bit of the target bit in the watermark information bit stream and the previous length, wherein the previous length is the length corresponding to the feature vector of the previous bit.
9. The watermarking method according to claim 1, further comprising, after the embedding the target feature vector into the frequency domain vector:
determining a target difference value vector according to the frequency domain vector and the frequency domain vector with the watermark, wherein the frequency domain vector with the watermark is obtained after the target characteristic vector is embedded into the frequency domain vector;
acquiring a reference feature vector;
and screening out the watermark information corresponding to the watermark information bit stream from the frequency domain vector with the watermark according to the target difference vector and the reference characteristic vector.
10. The watermarking method according to claim 9, wherein the obtaining the reference feature vector comprises:
acquiring the current extraction length, the initial starting position in the frequency domain vector and the current offset;
screening out a detected feature vector from the target difference vector according to the current extraction length, the initial starting position and the current offset;
determining a reference characteristic vector according to the length of the detected characteristic vector;
the screening out the watermark information corresponding to the watermark information bit stream from the frequency domain vector with the watermark according to the target difference vector and the reference feature vector comprises:
determining bits corresponding to the detected feature vectors according to the detected feature vectors and the reference feature vectors;
and screening out watermark information corresponding to the watermark information bit stream from the frequency domain vector with the watermark according to the bit corresponding to the detected feature vector.
11. The method of claim 10, wherein before the step of filtering out the watermark information corresponding to the watermark information bit stream from the frequency domain vector with watermark according to the bits corresponding to the detected eigenvector, the method further comprises:
if the number of bits corresponding to the detected feature vector is smaller than the preset number, updating the current offset according to the current extraction length to obtain an updated offset, and updating the current extraction length to obtain an updated extraction length;
taking the updated current offset as the current offset, taking the updated extraction length as the current extraction length, and returning to the step of screening out the detected feature vector from the target difference vector according to the current extraction length, the initial starting position and the current offset;
the watermark information corresponding to the watermark information bit stream is screened from the frequency domain vector with the watermark according to the bits corresponding to the detected feature vectors, and the method comprises the following steps
And if the number of the bits corresponding to the detected feature vector is equal to the preset number, screening out watermark information corresponding to the watermark information bit stream from the frequency domain vector with the watermark according to the bits corresponding to the detected feature vector.
12. A watermark processing apparatus, comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a work to be processed and a watermark information bit stream of the work to be processed, and the watermark information bit stream comprises a plurality of bits;
the transformation module is used for carrying out frequency domain transformation on the work to be processed to obtain a frequency domain vector of the work to be processed;
the screening module is used for screening target bits from the watermark information bit stream and determining the target positions of the target bits in the watermark information bit stream;
a generating module, configured to determine a target length of a target feature vector corresponding to the target bit according to the target position, and generate the target feature vector according to the target length and the target bit;
and the embedding module is used for embedding the target characteristic vector into the frequency domain vector so as to add the watermark information corresponding to the watermark information bit stream into the work to be processed.
13. An electronic device comprising a processor and a memory, the memory storing a computer program, the processor being configured to execute the computer program in the memory to perform the watermarking method according to any of claims 1 to 11.
14. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which is adapted to be loaded by a processor to perform the watermarking method according to any one of claims 1 to 11.
15. A computer program product, characterized in that it stores a computer program adapted to be loaded by a processor for performing the watermarking method of any of claims 1 to 11.
CN202210621778.9A 2022-06-01 2022-06-01 Watermark processing method, watermark processing device, electronic equipment and computer readable storage medium Pending CN115114596A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210621778.9A CN115114596A (en) 2022-06-01 2022-06-01 Watermark processing method, watermark processing device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210621778.9A CN115114596A (en) 2022-06-01 2022-06-01 Watermark processing method, watermark processing device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN115114596A true CN115114596A (en) 2022-09-27

Family

ID=83325692

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210621778.9A Pending CN115114596A (en) 2022-06-01 2022-06-01 Watermark processing method, watermark processing device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN115114596A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115602179A (en) * 2022-11-28 2023-01-13 腾讯科技(深圳)有限公司(Cn) Audio watermark processing method and device, computer equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115602179A (en) * 2022-11-28 2023-01-13 腾讯科技(深圳)有限公司(Cn) Audio watermark processing method and device, computer equipment and storage medium
CN115602179B (en) * 2022-11-28 2023-03-24 腾讯科技(深圳)有限公司 Audio watermark processing method and device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN108062780B (en) Method for compressing image and device
CN107534796B (en) Video processing system and digital video distribution system
CN111491170B (en) Method for embedding watermark and watermark embedding device
WO2022048330A1 (en) Video watermark adding method and apparatus, video watermark extraction method and apparatus, device, and storage medium
US10136098B2 (en) Integrity verification of an audio-visual data stream
US11303845B2 (en) Video content authentication
CN106453572B (en) Method and system based on Cloud Server synchronous images
CN111681291A (en) Image processing method, device, equipment and computer readable storage medium
JP2022036319A (en) Image rendering method, device, electronic device, computer readable storage medium, and computer program
US10902049B2 (en) System and method for assigning multimedia content elements to users
CN110659604A (en) Video detection method, device, server and storage medium
CN115114596A (en) Watermark processing method, watermark processing device, electronic equipment and computer readable storage medium
CN103237209A (en) H264 video watermarking method based on regional DCT (discrete cosine transform) coefficients
CN116205820A (en) Image enhancement method, target identification method, device and medium
CN115018688A (en) Network model watermark generation method based on DCT (discrete cosine transformation) coefficient and application
US20220335560A1 (en) Watermark-Based Image Reconstruction
WO2020093769A1 (en) Method and device for embedding information in image
CN105593853B (en) Server device, client device, information processing method, and recording medium
CN113282770A (en) Multimedia recommendation system and method
CN106412567A (en) Method and system for determining video definition
CN117014693A (en) Video processing method, device, equipment and storage medium
CN115811481A (en) Interactive service testing method and device, computer equipment and storage medium
CN114238223A (en) Picture removing method and device, computer equipment and computer readable storage medium
US20210329027A1 (en) Proof of work based on compressed video
CN111866514B (en) Method and device for compressing video and decompressing video

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