CN110889796B - Watermark embedding and watermark extraction method, device and device - Google Patents
Watermark embedding and watermark extraction method, device and device Download PDFInfo
- Publication number
- CN110889796B CN110889796B CN201811043750.1A CN201811043750A CN110889796B CN 110889796 B CN110889796 B CN 110889796B CN 201811043750 A CN201811043750 A CN 201811043750A CN 110889796 B CN110889796 B CN 110889796B
- Authority
- CN
- China
- Prior art keywords
- image
- watermark information
- resolution
- watermark
- 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.)
- Active
Links
- 238000000605 extraction Methods 0.000 title claims description 61
- 238000000034 method Methods 0.000 claims abstract description 55
- 230000001131 transforming effect Effects 0.000 claims description 9
- 230000009466 transformation Effects 0.000 claims description 7
- 230000000903 blocking effect Effects 0.000 claims 2
- 238000010586 diagram Methods 0.000 description 7
- 239000000284 extract Substances 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 238000006243 chemical reaction Methods 0.000 description 4
- 230000005540 biological transmission Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000004590 computer program Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000002085 persistent effect Effects 0.000 description 2
- 230000003321 amplification Effects 0.000 description 1
- 230000006835 compression Effects 0.000 description 1
- 238000007906 compression Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003199 nucleic acid amplification method Methods 0.000 description 1
- 238000013139 quantization Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/0021—Image watermarking
- G06T1/005—Robust watermarking, e.g. average attack or collusion attack resistant
- G06T1/0057—Compression invariant watermarking
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2201/00—General purpose image data processing
- G06T2201/005—Image watermarking
- G06T2201/0052—Embedding of the watermark in the frequency domain
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Editing Of Facsimile Originals (AREA)
- Image Processing (AREA)
Abstract
本申请公开了一种水印嵌入方法,包括:根据预先设定的至少一个参考图像分辨率,确定第一图像对应的参考图像分辨率;所述第一图像为待嵌入水印信息的图像;根据所述第一图像对应的参考图像分辨率,对第一图像进行缩放处理,得到第二图像;所述第二图像的分辨率与所述第一图像对应的参考图像分辨率相同;将水印信息嵌入到所述第二图像的频率域系数;对所述第二图像的频率域系数进行逆变换处理,得到嵌入水印信息的第二图像;将嵌入水印信息的第二图像进行缩放处理,得到与第一图像分辨率相同的图像。采用上述方法,提高水印的抗缩放攻击能力。
The present application discloses a watermark embedding method, comprising: determining a reference image resolution corresponding to a first image according to at least one preset reference image resolution; the first image is an image to be embedded with watermark information; the resolution of the reference image corresponding to the first image, and scaling the first image to obtain a second image; the resolution of the second image is the same as the resolution of the reference image corresponding to the first image; embedding the watermark information to the frequency domain coefficients of the second image; perform inverse transform processing on the frequency domain coefficients of the second image to obtain a second image embedded with watermark information; perform scaling processing on the second image embedded with watermark information to obtain the same An image with the same image resolution. By adopting the above method, the anti-scaling attack capability of the watermark is improved.
Description
技术领域technical field
本申请涉及数字水印技术,具体涉及一种水印嵌入方法、装置、电子设备及存储设备。本申请同时涉及一种水印提取方法、装置、电子设备及存储设备。The present application relates to digital watermarking technology, in particular to a watermark embedding method, device, electronic device and storage device. The present application also relates to a watermark extraction method, device, electronic device and storage device.
背景技术Background technique
当今,人们借助于计算机、扫描仪等电子设备可以方便将数字信息传达到世界各地。但随之而来的副作用是通过网络传输数据文件使有恶意的人可能在没有得到作品所有者的许可下拷贝和传播有版权的内容,因此如何在网络环境中实施有效的版权保护、溯源和信息安全手段成为一个迫在眉睫的现实问题。水印技术是解决上述问题的一个有效的技术手段。水印技术的抗攻击特性是水印技术优劣或者是否能够实际应用的重要衡量指标。Nowadays, people can easily transmit digital information to all parts of the world with the help of electronic devices such as computers and scanners. But the accompanying side effect is that the transmission of data files through the network makes it possible for malicious people to copy and disseminate copyrighted content without the permission of the owner of the work. Therefore, how to implement effective copyright protection, traceability and The means of information security has become an imminent practical problem. Watermarking technology is an effective technical means to solve the above problems. The anti-attack characteristic of watermarking technology is an important measure of whether watermarking technology is good or bad or whether it can be practically applied.
针对数字图像,现有的图像水印技术可以基本很好地抵抗信号噪声攻击。但对图像一旦进行了缩放攻击,现有的图像水印技术并不能有效地应用到真正的业务场景中。其最主要的原因是,现有的针对缩放攻击的图像水印技术嵌入容量极其不足,或者抗缩放的程度小。For digital images, the existing image watermarking technology can basically well resist the signal noise attack. However, once a scaling attack is performed on an image, the existing image watermarking technology cannot be effectively applied to real business scenarios. The main reason for this is that the existing image watermarking technology for scaling attacks has extremely insufficient embedding capacity, or the degree of resistance to scaling is small.
因此,为保证水印的安全性,需要提高水印的抗缩放攻击能力。Therefore, in order to ensure the security of the watermark, it is necessary to improve the anti-scaling attack capability of the watermark.
发明内容SUMMARY OF THE INVENTION
本申请提供一种水印嵌入方法、装置、电子设备及存储设备,以提高水印的抗缩放攻击能力。The present application provides a watermark embedding method, apparatus, electronic device and storage device, so as to improve the anti-scaling attack capability of the watermark.
本申请提供一种水印嵌入方法,包括:The present application provides a watermark embedding method, including:
根据预先设定的至少一个参考图像分辨率,确定第一图像对应的参考图像分辨率;所述第一图像为待嵌入水印信息的图像;Determine the reference image resolution corresponding to the first image according to the preset at least one reference image resolution; the first image is an image to be embedded with watermark information;
根据所述第一图像对应的参考图像分辨率,对所述第一图像进行缩放处理,得到第二图像;所述第二图像的分辨率与所述第一图像对应的参考图像分辨率相同;scaling the first image according to the resolution of the reference image corresponding to the first image to obtain a second image; the resolution of the second image is the same as the resolution of the reference image corresponding to the first image;
将水印信息嵌入到所述第二图像的频率域系数;embedding watermark information into frequency domain coefficients of the second image;
对所述第二图像的频率域系数进行逆变换处理,得到嵌入水印信息的第二图像;Perform inverse transform processing on the frequency domain coefficients of the second image to obtain a second image with embedded watermark information;
将嵌入水印信息的第二图像进行缩放处理,得到与所述第一图像分辨率相同的图像。Scaling the second image embedded with the watermark information to obtain an image with the same resolution as the first image.
可选的,所述将水印信息嵌入到所述第二图像的频率域系数,包括:Optionally, the embedding of the watermark information into the frequency domain coefficients of the second image includes:
对所述第二图像进行分块处理,得到第二图像的图像块;performing block processing on the second image to obtain image blocks of the second image;
对所述第二图像的图像块进行空间域到频率域的变换,得到所述第二图像的图像块的频率域系数;transforming the image block of the second image from the space domain to the frequency domain to obtain the frequency domain coefficients of the image block of the second image;
对所述第二图像的图像块的频率域系数进行量化处理,得到量化的频率域系数;quantizing the frequency domain coefficients of the image blocks of the second image to obtain quantized frequency domain coefficients;
将所述水印信息嵌入到所述量化的频率域系数中。The watermark information is embedded in the quantized frequency domain coefficients.
可选的,所述将水印信息嵌入到所述量化的频率域系数,包括:Optionally, the embedding of the watermark information into the quantized frequency domain coefficients includes:
将所述水印信息转换成第一水印信息图像;converting the watermark information into a first watermark information image;
将所述第一水印信息图像转化为水印比特序列;Converting the first watermark information image into a watermark bit sequence;
将所述水印比特序列嵌入到所述量化的频率域系数中。The sequence of watermark bits is embedded into the quantized frequency domain coefficients.
可选的,所述将所述第一水印信息图像转化为水印比特序列,包括:Optionally, converting the first watermark information image into a watermark bit sequence includes:
对所述第一水印信息图像进行置乱处理,得到第二水印信息图像;所述第二水印信息图像为置乱处理后的第一水印信息图像;Perform scrambling processing on the first watermark information image to obtain a second watermark information image; the second watermark information image is the first watermark information image after scrambling processing;
将所述第二水印信息图像转化为水印比特序列。Converting the second watermark information image into a sequence of watermark bits.
可选的,所述对所述第一水印信息图像进行置乱处理,得到第二水印信息图像,包括:Optionally, performing scrambling processing on the first watermark information image to obtain a second watermark information image, including:
使用置乱密码对所述第一水印信息图像进行置乱处理,得到第二水印信息图像。The first watermark information image is scrambled by using a scrambled password to obtain a second watermark information image.
可选的,还包括:Optionally, also include:
将所述第一图像对应的参考图像分辨率和置乱密码作为密钥提供给水印信息提取端。The reference image resolution and scrambled password corresponding to the first image are provided to the watermark information extraction end as a key.
可选的,所述根据预先设定的至少一个参考图像分辨率,确定第一图像对应的参考图像分辨率,包括:Optionally, determining the reference image resolution corresponding to the first image according to at least one preset reference image resolution includes:
从预先设定的至少一个参考图像分辨率选择出与所述第一图像的分辨率差别最小的参考图像分辨率,作为所述第一图像对应的参考图像分辨率。From at least one preset reference image resolution, a reference image resolution with the smallest difference from the resolution of the first image is selected as the reference image resolution corresponding to the first image.
可选的,还包括:Optionally, also include:
将所述第一图像对应的参考图像分辨率提供给水印信息提取端。The reference image resolution corresponding to the first image is provided to the watermark information extraction end.
本申请还提供一种水印提取方法,包括:The application also provides a watermark extraction method, comprising:
获得待提取水印信息的第一图像;obtaining the first image of the watermark information to be extracted;
确定嵌入水印信息时使用的参考图像分辨率;Determine the reference image resolution used when embedding watermark information;
将所述第一图像进行缩放处理,得到分辨率与所述参考图像分辨率相同的第二图像;scaling the first image to obtain a second image with the same resolution as the reference image;
从所述第二图像的频率域系数中提取出水印信息。The watermark information is extracted from the frequency domain coefficients of the second image.
可选的,所述确定嵌入水印信息时使用的参考图像分辨率,包括:Optionally, the determination of the reference image resolution used when embedding the watermark information includes:
根据水印信息嵌入端提供的包含所述参考图像分辨率的密钥,确定嵌入水印信息时使用的参考图像分辨率;或者,Determine the reference image resolution used when embedding the watermark information according to the key containing the reference image resolution provided by the watermark information embedding terminal; or,
根据水印信息嵌入端提供的参考图像分辨率,确定嵌入水印信息时使用的参考图像分辨率。According to the reference image resolution provided by the watermark information embedding terminal, the reference image resolution used when embedding the watermark information is determined.
可选的,还包括:Optionally, also include:
对所述第二图像进行分块处理,得到第二图像的图像块;performing block processing on the second image to obtain image blocks of the second image;
对所述第二图像的图像块进行空间域到频率域的变换,得到所述第二图像的图像块的频率域系数;transforming the image block of the second image from the space domain to the frequency domain to obtain the frequency domain coefficients of the image block of the second image;
对所述第二图像的图像块的频率域系数进行量化处理,得到量化的频率域系数;quantizing the frequency domain coefficients of the image blocks of the second image to obtain quantized frequency domain coefficients;
所述从所述第二图像的频率域系数中提取出嵌入的水印信息,包括:The extracting the embedded watermark information from the frequency domain coefficients of the second image includes:
从所述量化的频率域系数中提取出嵌入的水印信息。The embedded watermark information is extracted from the quantized frequency domain coefficients.
可选的,所述从所述第二图像的频率域系数中提取出嵌入的水印信息,包括:Optionally, the extracting the embedded watermark information from the frequency domain coefficients of the second image includes:
从所述第二图像的频率域系数中提取出嵌入的水印比特序列;extracting the embedded watermark bit sequence from the frequency domain coefficients of the second image;
根据所述水印比特序列,得到第一水印信息图像;obtaining a first watermark information image according to the watermark bit sequence;
根据所述第一水印信息图像,得到所述水印信息。The watermark information is obtained according to the first watermark information image.
可选的,所述根据所述水印比特序列,得到第一水印信息图像,包括:Optionally, obtaining the first watermark information image according to the watermark bit sequence, including:
根据所述水印比特序列,得到第二水印信息图像;According to the watermark bit sequence, a second watermark information image is obtained;
对所述第二水印信息图像进行反置乱处理,得到所述第一水印信息图像。Perform inverse scrambling processing on the second watermark information image to obtain the first watermark information image.
可选的,所述对所述第二水印信息图像进行反置乱处理,得到第一水印信息图像,包括:Optionally, performing inverse scrambling processing on the second watermark information image to obtain the first watermark information image, including:
使用置乱密码对所述第二水印信息图像进行反置乱处理,得到第一水印信息图像。The second watermark information image is reversely scrambled by using a scrambled password to obtain a first watermark information image.
可选的,还包括:Optionally, also include:
从水印信息嵌入端提供的包含置乱密码的密钥中获得所述置乱密码;或者,The scrambled password is obtained from the key provided by the watermark information embedding terminal that contains the scrambled password; or,
从预先约定的包含置乱密码的密钥中获得所述置乱密码。The scrambled cipher is obtained from a pre-agreed key containing the scrambled cipher.
本申请另外提供一种水印嵌入装置,包括:The present application further provides a watermark embedding device, comprising:
参考图像分辨率确定单元,用于根据预先设定的至少一个参考图像分辨率,确定第一图像对应的参考图像分辨率;所述第一图像为待嵌入水印的图像;a reference image resolution determination unit, configured to determine a reference image resolution corresponding to a first image according to at least one preset reference image resolution; the first image is an image to be watermarked;
第二图像得到单元,用于根据所述第一图像对应的参考图像分辨率,对第一图像进行缩放处理,得到第二图像;所述第二图像的分辨率与所述第一图像对应的参考图像分辨率相同;A second image obtaining unit, configured to perform scaling processing on the first image according to the resolution of the reference image corresponding to the first image to obtain a second image; the resolution of the second image is the same as that of the first image. The reference image resolution is the same;
水印信息嵌入单元,用于将水印信息嵌入到所述第二图像的频率域系数;a watermark information embedding unit, configured to embed watermark information into the frequency domain coefficients of the second image;
第二图像逆变换处理单元,用于对所述第二图像的频率域系数进行逆变换处理,得到嵌入水印信息的第二图像;a second image inverse transform processing unit, configured to perform inverse transform processing on the frequency domain coefficients of the second image to obtain a second image with embedded watermark information;
第二图像缩放处理单元,用于将嵌入水印信息的第二图像进行缩放处理,得到与第一图像分辨率相同的图像。The second image scaling processing unit is configured to perform scaling processing on the second image embedded with the watermark information to obtain an image with the same resolution as the first image.
本申请另外提供一种电子设备,包括:The application further provides an electronic device, comprising:
处理器;以及processor; and
存储器,用于存储水印嵌入方法的程序,该设备通电并通过所述处理器运行该水印嵌入方法的程序后,执行下述步骤:The memory is used to store the program of the watermark embedding method. After the device is powered on and the program of the watermark embedding method is run through the processor, the following steps are performed:
根据预先设定的至少一个参考图像分辨率,确定第一图像对应的参考图像分辨率;所述第一图像为待嵌入水印信息的图像;Determine the reference image resolution corresponding to the first image according to the preset at least one reference image resolution; the first image is an image to be embedded with watermark information;
根据所述第一图像对应的参考图像分辨率,对所述第一图像进行缩放处理,得到第二图像;所述第二图像的分辨率与所述第一图像对应的参考图像分辨率相同;scaling the first image according to the resolution of the reference image corresponding to the first image to obtain a second image; the resolution of the second image is the same as the resolution of the reference image corresponding to the first image;
将水印信息嵌入到所述第二图像的频率域系数;embedding watermark information into frequency domain coefficients of the second image;
对所述第二图像的频率域系数进行逆变换处理,得到嵌入水印信息的第二图像;Perform inverse transform processing on the frequency domain coefficients of the second image to obtain a second image with embedded watermark information;
将嵌入水印信息的第二图像进行缩放处理,得到与所述第一图像分辨率相同的图像。Scaling the second image embedded with the watermark information to obtain an image with the same resolution as the first image.
本申请另外提供一种存储设备,The present application further provides a storage device,
存储有水印提取方法的程序,该程序被处理器运行,执行下述步骤:A program containing a watermark extraction method is stored, and the program is executed by a processor to perform the following steps:
根据预先设定的至少一个参考图像分辨率,确定第一图像对应的参考图像分辨率;所述第一图像为待嵌入水印信息的图像;Determine the reference image resolution corresponding to the first image according to the preset at least one reference image resolution; the first image is an image to be embedded with watermark information;
根据所述第一图像对应的参考图像分辨率,对所述第一图像进行缩放处理,得到第二图像;所述第二图像的分辨率与所述第一图像对应的参考图像分辨率相同;scaling the first image according to the resolution of the reference image corresponding to the first image to obtain a second image; the resolution of the second image is the same as the resolution of the reference image corresponding to the first image;
将水印信息嵌入到所述第二图像的频率域系数;embedding watermark information into frequency domain coefficients of the second image;
对所述第二图像的频率域系数进行逆变换处理,得到嵌入水印信息的第二图像;Perform inverse transform processing on the frequency domain coefficients of the second image to obtain a second image with embedded watermark information;
将嵌入水印信息的第二图像进行缩放处理,得到与所述第一图像分辨率相同的图像。Scaling the second image embedded with the watermark information to obtain an image with the same resolution as the first image.
本申请另外提供一种水印提取装置,包括:The application additionally provides a watermark extraction device, comprising:
第一图像获取单元,用于获得待提取水印信息的第一图像;a first image acquisition unit, used to obtain the first image of the watermark information to be extracted;
参考图像分辨率确定单元,用于确定嵌入水印信息时使用的参考图像分辨率;a reference image resolution determination unit, used for determining the reference image resolution used when embedding the watermark information;
第二图像得到单元,用于将所述第一图像进行缩放处理,得到分辨率与所述参考图像分辨率相同的第二图像;A second image obtaining unit, configured to perform scaling processing on the first image to obtain a second image with the same resolution as the reference image;
水印信息提取单元,用于从所述第二图像的频率域系数中提取出水印信息。A watermark information extraction unit, configured to extract watermark information from the frequency domain coefficients of the second image.
本申请另外提供一种电子设备,包括:The application further provides an electronic device, comprising:
处理器;以及processor; and
存储器,用于存储水印提取方法的程序,该设备通电并通过所述处理器运行该水印提取方法的程序后,执行下述步骤:The memory is used to store the program of the watermark extraction method, and after the device is powered on and runs the program of the watermark extraction method through the processor, the following steps are performed:
获得待提取水印信息的第一图像;obtaining the first image of the watermark information to be extracted;
确定嵌入水印信息时使用的参考图像分辨率;Determine the reference image resolution used when embedding watermark information;
将所述第一图像进行缩放处理,得到分辨率与所述参考图像分辨率相同的第二图像;scaling the first image to obtain a second image with the same resolution as the reference image;
从所述第二图像的频率域系数中提取出水印信息。The watermark information is extracted from the frequency domain coefficients of the second image.
本申请还提供一种存储设备,The present application also provides a storage device,
存储有水印提取方法的程序,该程序被处理器运行,执行下述步骤:A program containing a watermark extraction method is stored, and the program is executed by a processor to perform the following steps:
获得待提取水印信息的第一图像;obtaining the first image of the watermark information to be extracted;
确定嵌入水印信息时使用的参考图像分辨率;Determine the reference image resolution used when embedding watermark information;
将所述第一图像进行缩放处理,得到分辨率与所述参考图像分辨率相同的第二图像;scaling the first image to obtain a second image with the same resolution as the reference image;
从所述第二图像的频率域系数中提取出水印信息。The watermark information is extracted from the frequency domain coefficients of the second image.
本申请还提供一种水印嵌入方法,包括:The present application also provides a watermark embedding method, including:
获取目标分辨率以及待嵌入水印信息的第一图像;Obtain the target resolution and the first image to be embedded with watermark information;
根据所述目标分辨率,对所述第一图像进行第一缩放处理,得到第二图像,其中,所述第二图像的分辨率与目标分辨率满足第一预设误差范围;performing a first scaling process on the first image according to the target resolution to obtain a second image, wherein the resolution of the second image and the target resolution satisfy a first preset error range;
将所述水印信息嵌入到所述第二图像;embedding the watermark information into the second image;
将嵌入水印信息的第二图像进行第二缩放处理,得到第三图像,其中,所述第三图像的分辨率与所述第一图像的分辨率满足第二预设误差范围。A second scaling process is performed on the second image embedded with the watermark information to obtain a third image, wherein the resolution of the third image and the resolution of the first image satisfy a second preset error range.
可选的,将所述水印嵌入到所述第二图像,包括:Optionally, embedding the watermark into the second image includes:
将所述水印嵌入到所述第二图像的频率域系数;embedding the watermark into frequency domain coefficients of the second image;
对所述第二图像的频率域系数进行逆变换处理,得到嵌入水印信息的第二图像。Inverse transform processing is performed on the frequency domain coefficients of the second image to obtain a second image with embedded watermark information.
可选的,获取目标分辨率,包括:Optionally, get the target resolution, including:
获取分辨率样本库;Get the resolution sample library;
从所述分辨率样本库中,检索与所述第一图像的分辨率满足预设条件的分辨率样本,作为目标分辨率。From the resolution sample library, a resolution sample that satisfies a preset condition with the resolution of the first image is retrieved as a target resolution.
可选的,获取目标分辨率,包括:Optionally, get the target resolution, including:
接收客户端输入的目标分辨率。Receives the target resolution entered by the client.
可选的,获取目标分辨率,包括:Optionally, get the target resolution, including:
获取目标应用;Get the target application;
根据目标应用对应的分辨率,设置目标分辨率。Set the target resolution according to the resolution corresponding to the target application.
可选的,所述第一预设误差范围与第二预设误差范围相同。Optionally, the first preset error range is the same as the second preset error range.
与现有技术相比,本申请具有以下优点:Compared with the prior art, the present application has the following advantages:
本申请提供一种水印嵌入方法、装置、电子设备及存储设备,首先将第一图像转换为分辨率与其对应的参考图像分辨率相同的第二图像,再将水印信息嵌入到第二图像的频率域中,由于本申请将水印信息嵌入到第二图像的频率域中,频率域系数并不会发生太大变化,因此即使图像受到缩放攻击,仍能正确提取出水印信息,提高了水印的抗缩放攻击能力。The present application provides a watermark embedding method, device, electronic device and storage device. First, convert a first image into a second image with the same resolution as its corresponding reference image, and then embed watermark information into the frequency of the second image. In the domain, since the application embeds the watermark information in the frequency domain of the second image, the frequency domain coefficients will not change much, so even if the image is subjected to scaling attacks, the watermark information can still be correctly extracted, which improves the watermark resistance. Scaled attack power.
附图说明Description of drawings
图1是本申请第一实施例提供的一种水印嵌入方法的流程图。FIG. 1 is a flowchart of a watermark embedding method provided by the first embodiment of the present application.
图2是本申请第一实施例提供的第一水印信息图像的示意图。FIG. 2 is a schematic diagram of a first watermark information image provided by the first embodiment of the present application.
图3是本申请第二实施例提供的一种水印提取方法的流程图。FIG. 3 is a flowchart of a watermark extraction method provided by the second embodiment of the present application.
图4是本申请第三实施例提供的一种水印嵌入装置的示意图。FIG. 4 is a schematic diagram of a watermark embedding apparatus provided by a third embodiment of the present application.
图5是本申请第四实施例提供的一种电子设备的示意图。FIG. 5 is a schematic diagram of an electronic device provided by a fourth embodiment of the present application.
图6是本申请第六实施例提供的一种水印提取装置的示意图。FIG. 6 is a schematic diagram of a watermark extraction apparatus provided by a sixth embodiment of the present application.
图7是本申请第七实施例提供的一种电子设备的示意图。FIG. 7 is a schematic diagram of an electronic device according to a seventh embodiment of the present application.
图8是本申请第九实施例提供的一种水印嵌入方法的流程图。FIG. 8 is a flowchart of a watermark embedding method provided by the ninth embodiment of the present application.
图9是本申请第九实施例提供的一种水印嵌入的场景示意图。FIG. 9 is a schematic diagram of a watermark embedding scenario provided by the ninth embodiment of the present application.
图10是本申请第九实施例提供的一种水印提取的场景示意图。FIG. 10 is a schematic diagram of a watermark extraction scenario provided by the ninth embodiment of the present application.
具体实施方式Detailed ways
在下面的描述中阐述了很多具体细节以便于充分理解本申请。但是本申请能够以很多不同于在此描述的其它方式来实施,本领域技术人员可以在不违背本申请内涵的情况下做类似推广,因此本申请不受下面公开的具体实施的限制。In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. However, the present application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar promotions without violating the connotation of the present application. Therefore, the present application is not limited by the specific implementation disclosed below.
本申请第一实施例提供一种水印嵌入方法,以下结合图1、图2进行说明。The first embodiment of the present application provides a watermark embedding method, which is described below with reference to FIG. 1 and FIG. 2 .
如图1所示,在步骤S101中,根据预先设定的至少一个参考图像分辨率,确定第一图像对应的参考图像分辨率;所述第一图像为待嵌入水印信息的图像。As shown in FIG. 1 , in step S101 , a reference image resolution corresponding to a first image is determined according to at least one preset reference image resolution; the first image is an image to be embedded with watermark information.
所述水印信息,指待嵌入到第一图像中的标识信息。水印信息可以隐藏嵌入到第一图像中,不会影响原第一图像的使用价值,也不易被探知和再次修改。但水印信息可以被生产方识别和辨认。通过这些嵌入在第一图像中的水印信息,可以达到确认内容创建者、购买者、传送隐秘信息或者判断第一图像是否被篡改等目的。水印信息可以为某个公司的公司名,也可以为某个员工的员工编号或其他标识信息。The watermark information refers to identification information to be embedded in the first image. The watermark information can be hidden and embedded in the first image, it will not affect the use value of the original first image, and it is not easy to be detected and modified again. But the watermark information can be identified and recognized by the producer. Through the watermark information embedded in the first image, the purpose of confirming the content creator and purchaser, transmitting secret information or judging whether the first image has been tampered can be achieved. The watermark information can be the company name of a company, the employee number or other identification information of an employee.
所述参考图像分辨率,指第一图像转换为第二图像时需要参考的图像分辨率;预先可以设定多个参考图像分辨率,例如,可以设定4个参考图像分辨率,分别为:128*128,256*256,512*512,1024*1024。参考图像分辨率大小在定义时无特殊要求,例如125*124、125*100都可以。The reference image resolution refers to the image resolution that needs to be referenced when the first image is converted into the second image; multiple reference image resolutions can be set in advance, for example, four reference image resolutions can be set, which are: 128*128, 256*256, 512*512, 1024*1024. There is no special requirement for the reference image resolution size when it is defined, such as 125*124 and 125*100.
需要说明的是,设置的参考图像分辨率种类越多,缩放引起的失真可能越小。例如:如果参考图像分辨率只有128*128、256*256两种,如果第一图像的分辨率为800*800,则只能选分辨率为256*256的参考图像分辨率,如果参考图像分辨率包含128*128、256*256、600*600,则可以选分辨率为600*600的参考图像分辨率,此时缩放引起的失真比选择256*256的参考图像分辨率引起的失真小。It should be noted that the more types of reference image resolutions are set, the smaller the distortion caused by scaling may be. For example: if the resolution of the reference image is only 128*128 and 256*256, if the resolution of the first image is 800*800, you can only select the reference image resolution with a resolution of 256*256. If the resolution of the reference image is 800*800 If the resolution includes 128*128, 256*256, and 600*600, you can select the reference image resolution with a resolution of 600*600. At this time, the distortion caused by scaling is smaller than that caused by selecting the reference image resolution of 256*256.
第一图像对应的参考图像分辨率,指从多个参考图像分辨率选出的一个参考图像分辨率,用于对第一图像进行缩放处理,得到第二图像。例如,可以选择256*256作为第一图像对应的参考图像分辨率。The reference image resolution corresponding to the first image refers to a reference image resolution selected from multiple reference image resolutions, which is used for scaling the first image to obtain the second image. For example, 256*256 can be selected as the reference image resolution corresponding to the first image.
具体的,在确定第一图像对应的参考图像分辨率时,为了使第二图像与第一图像的分辨率差距较小,可以从预先设定的至少一个参考图像分辨率选择出与第一图像的分辨率差别最小的参考图像分辨率,作为第一图像对应的参考图像分辨率。例如,如果第一图像分辨率为200*300,则可以从上述4个参考图像分辨率中选择256*256作为第一图像对应的参考图像分辨率。Specifically, when determining the resolution of the reference image corresponding to the first image, in order to make the resolution gap between the second image and the first image smaller, the resolution of the first image can be selected from at least one preset reference image resolution. The reference image resolution with the smallest difference in resolution is used as the reference image resolution corresponding to the first image. For example, if the resolution of the first image is 200*300, 256*256 may be selected from the above four reference image resolutions as the reference image resolution corresponding to the first image.
为了水印信息提取端能够获得第一图像对应的参考图像分辨率,可以将第一图像对应的参考图像分辨率提供给水印信息提取端。将第一图像对应的参考图像分辨率提供给水印信息提取端,可以采用两种方式:一种方式是:将所述将第一图像对应的参考图像分辨率以单独消息的形式发送至水印提取端;另一种方式是:以水印信息提取端和水印信息嵌入端预先约定的方式将第一图像对应的参考图像分辨率提供给水印信息提取端。In order for the watermark information extraction end to obtain the reference image resolution corresponding to the first image, the reference image resolution corresponding to the first image may be provided to the watermark information extraction end. There are two ways to provide the reference image resolution corresponding to the first image to the watermark information extraction end: one way is: sending the reference image resolution corresponding to the first image to the watermark extraction end in the form of a separate message Another way is: providing the reference image resolution corresponding to the first image to the watermark information extracting end in a way pre-agreed by the watermark information extracting end and the watermark information embedding end.
如图1所示,在步骤S102中,根据所述第一图像对应的参考图像分辨率,对第一图像进行缩放处理,得到第二图像;所述第二图像的分辨率与所述第一图像对应的参考图像分辨率相同。As shown in FIG. 1, in step S102, scaling processing is performed on the first image according to the resolution of the reference image corresponding to the first image to obtain a second image; the resolution of the second image is the same as that of the first image. The image corresponding to the reference image has the same resolution.
根据第一图像对应的参考图像分辨率,对第一图像进行缩放处理,得到与第一图像对应的参考图像分辨率相同的第二图像。仍沿用上述例子,根据第一图像对应的参考图像分辨率256*256,对第一图像进行缩放处理,得到第二图像,第二图像的分辨率为256*256。According to the resolution of the reference image corresponding to the first image, scaling processing is performed on the first image to obtain a second image with the same resolution as the reference image corresponding to the first image. Still using the above example, according to the reference image resolution 256*256 corresponding to the first image, the first image is scaled to obtain the second image, and the resolution of the second image is 256*256.
如图1所示,在步骤S103中,将水印信息嵌入到所述第二图像的频率域系数。As shown in FIG. 1, in step S103, watermark information is embedded into the frequency domain coefficients of the second image.
所述频率域,包括:DCT域、DWT域、DFT域等。The frequency domain includes: DCT domain, DWT domain, DFT domain, etc.
将水印信息嵌入到所述第二图像的频率域系数,包括以下步骤:Embedding the watermark information into the frequency domain coefficients of the second image includes the following steps:
对所述第二图像进行分块处理,得到第二图像的图像块;performing block processing on the second image to obtain image blocks of the second image;
对所述第二图像的图像块进行空间域到频率域的变换,得到所述第二图像的图像块的频率域系数;transforming the image block of the second image from the space domain to the frequency domain to obtain the frequency domain coefficients of the image block of the second image;
对所述第二图像的图像块的频率域系数进行量化处理,得到量化的频率域系数;quantizing the frequency domain coefficients of the image blocks of the second image to obtain quantized frequency domain coefficients;
将所述水印信息嵌入到所述量化的频率域系数中。The watermark information is embedded in the quantized frequency domain coefficients.
对第二图像进行分块处理,得到第二图像的图像块,第二图像的图像块的分辨率可以为16*16、8*8等。由于图像块的分辨率大于8*8时,对图像块进行空间域到频率域的变换效率增加不多,但是复杂性大为增加,因此最好对第二图像进行分块处理,得到第二图像的分辨率为8*8的图像块,对每一分辨率为8*8的图像块分别计算其频率域系数。将水印信息嵌入到第二图像的分辨率为8*8的图像块的频率域系数的过程为:首先将每个分辨率为8*8的图像块的二维数据从空间域变换到频率域,得到8*8个频率域系数,然后对第二图像的每个图像块的频率域系数进行量化处理,得到量化的频率域系数,最后将水印信息嵌入到量化的频率域系数中。Perform block processing on the second image to obtain image blocks of the second image, and the resolution of the image blocks of the second image may be 16*16, 8*8, and the like. When the resolution of the image block is greater than 8*8, the conversion efficiency of the image block from the spatial domain to the frequency domain does not increase much, but the complexity increases greatly. Therefore, it is better to perform block processing on the second image to obtain the second image. For image blocks with a resolution of 8*8, the frequency domain coefficients are calculated for each image block with a resolution of 8*8. The process of embedding the watermark information into the frequency domain coefficients of the image blocks with a resolution of 8*8 in the second image is as follows: first, transform the two-dimensional data of each image block with a resolution of 8*8 from the spatial domain to the frequency domain , obtain 8*8 frequency domain coefficients, then quantize the frequency domain coefficients of each image block of the second image to obtain quantized frequency domain coefficients, and finally embed the watermark information into the quantized frequency domain coefficients.
所述将水印信息嵌入到所述量化的频率域系数,包括:The embedding of watermark information into the quantized frequency domain coefficients includes:
将所述将水印信息转换成第一水印信息图像;转换成第一水印信息图像;Converting the watermark information into a first watermark information image; converting into a first watermark information image;
将所述第一水印信息图像转化为水印比特序列;Converting the first watermark information image into a watermark bit sequence;
将所述水印比特序列嵌入到所述量化的频率域系数中。The sequence of watermark bits is embedded into the quantized frequency domain coefficients.
在将水印信息嵌入到所述量化的频率域系数时,可以先将水印信息转换成第一水印信息图像;再将第一水印信息图像转化为水印比特序列;最后将水印比特序列嵌入到量化的频率域系数中。其中,比特序列可以指采用二进制表示的0,1序列。如图2所示,其为字符串水印信息“123”转换为的第一水印信息图像。将水印信息转换成第一水印信息图像,能够提高鲁棒性,例如,嵌入工号是12345678的字符,如果先转成0/1比特序列信息,对于ASCAII则是嵌入8*8共64bit,一个bit的信息提取出错,就会导致一个字符提取错误;如果将12345678转换成图像,比如这张图像的分辨率为80*20,共1600bit,以图片形式嵌入水印信息时嵌入的信息量明显增大,因此会提高鲁棒性。When embedding the watermark information into the quantized frequency domain coefficients, the watermark information can be converted into a first watermark information image first; then the first watermark information image can be converted into a watermark bit sequence; finally, the watermark bit sequence is embedded in the quantized in the frequency domain coefficients. The bit sequence may refer to a sequence of 0 and 1 in binary representation. As shown in Fig. 2, it is the first watermark information image converted into the character string watermark information "123". Converting the watermark information into the first watermark information image can improve the robustness. For example, if the character whose job number is 12345678 is embedded, if it is first converted into 0/1 bit sequence information, for ASCAII, it is embedded 8*8, a total of 64 bits, one An error in bit information extraction will result in a character extraction error; if 12345678 is converted into an image, for example, the resolution of this image is 80*20, a total of 1600 bits, and the amount of embedded information is significantly increased when the watermark information is embedded in the form of a picture , thus improving the robustness.
进一步,为了提高水印嵌入的安全性,在将水印信息转换成第一水印信息图像后;可以先对第一水印信息图像进行置乱处理,得到第二水印信息图像;所述第二水印信息图像为置乱处理后的第一水印信息图像;再将第二水印信息图像转化为水印比特序列,并将其嵌入到量化的频率域系数中。Further, in order to improve the security of watermark embedding, after the watermark information is converted into a first watermark information image, the first watermark information image can be scrambled to obtain a second watermark information image; the second watermark information image is the scrambled first watermark information image; and then converts the second watermark information image into a watermark bit sequence, and embeds it into the quantized frequency domain coefficients.
在对第一水印信息图像进行置乱处理,得到第二水印信息图像时,可以辅助使用置乱密码对第一水印信息图像进行置乱处理,得到第二水印信息图像。When the first watermark information image is scrambled to obtain the second watermark information image, a scramble password may be used to scramble the first watermark information image to obtain the second watermark information image.
进一步,如果使用了置乱密码,可以将所述第一图像对应的参考图像分辨率和置乱密码作为密钥提供给水印信息提取端,以便水印提取端在提取水印信息时能够准确获得在将第一图像转换为第二图像时使用的参考图像分辨率,以及采用的置乱密码。将所述第一图像对应的参考图像分辨率和置乱密码作为密钥提供给水印信息提取端,可以采用两种方式:一种方式是:将所述将密钥以单独消息的形式发送至水印信息提取端;另一种方式是:以水印信息提取端和水印信息嵌入端预先约定的方式确定密钥。Further, if a scrambled password is used, the resolution of the reference image corresponding to the first image and the scrambled password can be provided to the watermark information extraction end as a key, so that the watermark extraction end can accurately obtain when extracting the watermark information. The reference image resolution used when the first image is converted into the second image, and the scrambled password used. The reference image resolution and scrambled password corresponding to the first image are provided to the watermark information extraction end as a key, and two ways can be used: one way is: send the key to the watermark in the form of a separate message. The watermark information extraction end; the other way is to determine the key in a way pre-agreed by the watermark information extraction end and the watermark information embedding end.
通过本步骤实现了将水印信息嵌入到第二图像的频率域系数。Through this step, the watermark information is embedded in the frequency domain coefficients of the second image.
如图1所示,在步骤S104中,对所述第二图像的频率域系数进行逆变换处理,得到嵌入水印信息的第二图像。As shown in FIG. 1 , in step S104 , inverse transform processing is performed on the frequency domain coefficients of the second image to obtain a second image with embedded watermark information.
在将水印信息嵌入到所述第二图像的频率域系数之后,还需要对第二图像的频率域系数进行逆变换处理,将第二图像从频率域转换为空间域,此时的第二图像为嵌入水印信息的第二图像。After embedding the watermark information into the frequency domain coefficients of the second image, it is also necessary to perform inverse transform processing on the frequency domain coefficients of the second image to convert the second image from the frequency domain to the spatial domain. At this time, the second image is the second image with embedded watermark information.
如图1所示,在步骤S105中,将嵌入水印信息的第二图像进行缩放处理,得到与第一图像分辨率相同的图像。As shown in FIG. 1 , in step S105 , scaling processing is performed on the second image embedded with the watermark information to obtain an image with the same resolution as the first image.
本步骤为步骤S102的逆步骤,步骤S102对第一图像进行了缩放处理,生成了第二图像,在将水印信息嵌入第二图像后,需要将第二图像进行逆向的缩放处理,即若步骤S102中对第一图像进行了放大处理,则本步骤对第二图像进行缩小处理,若步骤S102中对第一图像进行了缩小处理,则本步骤对第二图像进行放大处理。仍沿用步骤S102的例子,将嵌入水印信息的第二图像进行缩放处理,得到与第一图像分辨率相同的图像,即将嵌入水印信息的分辨率为256*256的第二图像,进行缩放处理,得到分辨率为200*300的图像。This step is the inverse step of step S102. In step S102, scaling processing is performed on the first image to generate a second image. After embedding the watermark information in the second image, the second image needs to be reversely scaled. If the first image is enlarged in S102, this step will reduce the second image, and if the first image has been reduced in step S102, this step will enlarge the second image. Still following the example of step S102, the second image embedded with the watermark information is subjected to scaling processing to obtain an image with the same resolution as the first image, that is, the second image with a resolution of 256*256 embedded in the watermark information is subjected to scaling processing, Get an image with a resolution of 200*300.
至此,对本申请第一实施例提供的水印嵌入方法的实施方式进行了详细说明。本申请第一实施例首先将第一图像转换为分辨率与其对应的参考图像分辨率相同的第二图像,再将水印信息嵌入到第二图像的频率域中,然后将嵌入水印信息的第二图像从频率域转换为空间域,最后将嵌入水印信息的第二图像的分辨率再转换为第一图像的分辨率,得到与第一图像分辨率相同的图像;得到的与第一图像分辨率相同的图像与第一图像相比,虽然其中一大部分的像素值已经改变,但是频率域系数并不会发生太大变化,因此即使图像受到缩放攻击,仍能正确提取出水印信息,提高了水印的抗缩放攻击能力。此外,本申请第一实施例还具有嵌入水印信息的容量大,鲁棒性极强的优点。例如,第一图像对应的参考图像分辨率为512*512,将第二图像分成8*8的图像块,采用DCT变换将每个分辨率为8*8的图像块的二维数据从空间域变换到频率域,以每个图像块选8位中频系数嵌入8bit为例,可以嵌入512*512*64*8bit信息,即32768bit信息。可见,本申请第一实施例保证了嵌入水印信息的容量大,鲁棒性极强;同时抗缩放攻击能力强,可以抵抗70%JPEG压缩,而且可以抵抗3到4倍的放大攻击,2到3倍的缩小攻击。So far, the implementation of the watermark embedding method provided by the first embodiment of the present application has been described in detail. The first embodiment of the present application first converts the first image into a second image with the same resolution as its corresponding reference image, embeds the watermark information in the frequency domain of the second image, and then converts the second image with the embedded watermark information into the frequency domain of the second image. The image is converted from the frequency domain to the spatial domain, and finally the resolution of the second image embedded with the watermark information is converted to the resolution of the first image to obtain an image with the same resolution as the first image; the obtained image has the same resolution as the first image. Comparing the same image with the first image, although a large part of the pixel values have changed, the frequency domain coefficients do not change much, so even if the image is attacked by scaling, the watermark information can still be correctly extracted, which improves the The watermark's resistance to scaling attacks. In addition, the first embodiment of the present application also has the advantages of large capacity for embedding watermark information and strong robustness. For example, the resolution of the reference image corresponding to the first image is 512*512, the second image is divided into 8*8 image blocks, and the two-dimensional data of each image block with a resolution of 8*8 is converted from the spatial domain by DCT transformation. Transforming to the frequency domain, taking 8 bits of intermediate frequency coefficients for each image block and embedding 8 bits as an example, 512*512*64*8bit information can be embedded, that is, 32768bit information. It can be seen that the first embodiment of the present application ensures that the embedded watermark information has a large capacity and strong robustness; at the same time, it has strong anti-scaling attack capability, can resist 70% JPEG compression, and can resist 3 to 4 times amplification attack, 2 to 2 3x shrink attack.
本申请第二实施例提供一种水印提取方法,以下结合图3进行说明。The second embodiment of the present application provides a watermark extraction method, which is described below with reference to FIG. 3 .
如图3所示,在步骤S301中,获得待提取水印信息的第一图像。As shown in FIG. 3, in step S301, a first image whose watermark information is to be extracted is obtained.
所述待提取水印信息的第一图像,指经过本申请第一实施例提供的水印嵌入方法嵌入水印信息的图像。待提取水印信息的第一图像可以是嵌入水印的原始图像,也可以是嵌入水印的原始图像截图,例如,在一张很小的(例如分辨率为100*480)嵌入水印信息的白色背景图中进行版面设计、加图加字形成界面,用户在手机端对此界面截图,则此截图可以为待提取水印信息的第一图像。由于用户手机分辨率不同,因此在截图时对此界面进行了缩放攻击,可以根据此截图成功提取其中的水印。The first image from which watermark information is to be extracted refers to an image in which watermark information is embedded through the watermark embedding method provided in the first embodiment of the present application. The first image from which the watermark information is to be extracted can be the original image with the watermark embedded in it, or a screenshot of the original image with the watermark embedded in it. For example, in a small (for example, resolution of 100*480) white background image with the watermark information embedded in it. Layout design, adding pictures and characters to form an interface, and the user takes a screenshot of the interface on the mobile phone, and the screenshot can be the first image from which the watermark information is to be extracted. Since the resolution of the user's mobile phone is different, a scaling attack is performed on this interface when taking a screenshot, and the watermark can be successfully extracted based on this screenshot.
如图3所示,在步骤S302中,确定嵌入水印信息时使用的参考图像分辨率。As shown in FIG. 3, in step S302, the reference image resolution used when embedding the watermark information is determined.
所述确定嵌入水印信息时使用的参考图像分辨率,包括:The determination of the reference image resolution used when embedding the watermark information includes:
根据水印信息嵌入端提供的包含所述参考图像分辨率的密钥,确定嵌入水印信息时使用的参考图像分辨率;或者,Determine the reference image resolution used when embedding the watermark information according to the key containing the reference image resolution provided by the watermark information embedding terminal; or,
根据水印信息嵌入端提供的参考图像分辨率,确定嵌入水印信息时使用的参考图像分辨率。According to the reference image resolution provided by the watermark information embedding terminal, the reference image resolution used when embedding the watermark information is determined.
如果水印信息嵌入端向水印信息提取端提供了包含所述参考图像分辨率的密钥,则可以从密钥中获得嵌入水印信息时使用的参考图像分辨率;如果水印信息嵌入端向水印信息提取端提供了参考图像分辨率,则提供的参考图像分辨率为嵌入水印信息时使用的参考图像分辨率。If the watermark information embedding end provides the watermark information extraction end with a key containing the reference image resolution, the reference image resolution used when embedding the watermark information can be obtained from the key; if the watermark information embedding end extracts the watermark information from the key If the reference image resolution is provided by the terminal, the provided reference image resolution is the reference image resolution used when embedding the watermark information.
如图3所示,在步骤S303中,将所述第一图像进行缩放处理,得到分辨率与所述参考图像分辨率相同的第二图像。As shown in FIG. 3 , in step S303 , scaling the first image is performed to obtain a second image with the same resolution as the reference image.
通过本步骤保证了水印信息嵌入和水印信息提取在相同的参考图像分辨率进行,从而恢复了同步信息。This step ensures that watermark information embedding and watermark information extraction are performed at the same reference image resolution, thereby restoring synchronization information.
所述同步信息,是指对于给定的水印算法,水印提取端必需获得水印嵌入的确切位置,这也称为同步信息。从而可以据此在特定位置提出正确的嵌入信息。如果失去了嵌入的水印信息所在的位置信息,即使嵌入的水印信息仍在图像中,也不会正确提取出来,这称为失去同步信息。The synchronization information means that for a given watermarking algorithm, the watermark extraction end must obtain the exact position of the watermark embedding, which is also called synchronization information. Thereby, the correct embedded information can be proposed at a specific location. If the location information of the embedded watermark information is lost, even if the embedded watermark information is still in the image, it will not be extracted correctly, which is called out-of-sync information.
如图3所示,在步骤S304中,从所述第二图像的频率域系数中提取出水印信息。As shown in FIG. 3, in step S304, watermark information is extracted from the frequency domain coefficients of the second image.
如果在嵌入水印信息时,对图像进行了分块处理,则在提取水印信息时,也需要对所述第二图像进行分块处理,得到第二图像的图像块;然后对所述第二图像的图像块进行空间域到频率域的变换,得到所述第二图像的图像块的频率域系数;再对所述第二图像的图像块的频率域系数进行量化处理,得到量化的频率域系数。所述从所述第二图像的频率域系数中提取出嵌入的水印信息,包括:从所述量化的频率域系数中提取出嵌入的水印信息。If the image is divided into blocks when the watermark information is embedded, the second image also needs to be divided into blocks when the watermark information is extracted to obtain the image blocks of the second image; and then the second image needs to be divided into blocks. The image block of the second image is transformed from the space domain to the frequency domain to obtain the frequency domain coefficient of the image block of the second image; and then the frequency domain coefficient of the image block of the second image is quantized to obtain the quantized frequency domain coefficient. . The extracting the embedded watermark information from the frequency domain coefficients of the second image includes: extracting the embedded watermark information from the quantized frequency domain coefficients.
所述从所述第二图像的频率域系数中提取出嵌入的水印信息,包括:The extracting the embedded watermark information from the frequency domain coefficients of the second image includes:
从所述第二图像的频率域系数中提取出嵌入的水印比特序列;extracting the embedded watermark bit sequence from the frequency domain coefficients of the second image;
根据所述水印比特序列,得到第一水印信息图像;obtaining a first watermark information image according to the watermark bit sequence;
根据所述第一水印信息图像,得到所述水印信息。The watermark information is obtained according to the first watermark information image.
如果在水印信息嵌入时,对水印信息图像进行了置乱处理,所述根据所述水印比特序列,得到第一水印信息图像,包括:If the watermark information image is scrambled when the watermark information is embedded, the first watermark information image is obtained according to the watermark bit sequence, including:
根据所述水印比特序列,得到第二水印信息图像;According to the watermark bit sequence, a second watermark information image is obtained;
对所述第二水印信息图像进行反置乱处理,得到所述第一水印信息图像。Perform inverse scrambling processing on the second watermark information image to obtain the first watermark information image.
对所述第二水印信息图像进行反置乱处理,得到第一水印信息图像,包括:Perform inverse scrambling processing on the second watermark information image to obtain the first watermark information image, including:
如果在水印信息嵌入时使用了置乱密码,则在水印信息提取使需要使用置乱密码对所述第二水印信息图像进行反置乱处理,得到置乱前的第一水印信息图像。If a scrambled password is used when the watermark information is embedded, the scrambled password needs to be used to perform inverse scramble processing on the second watermark information image during watermark information extraction to obtain the first watermark information image before scramble.
置乱密码可以从水印信息嵌入端提供的包含置乱密码的密钥中获得;或者,从预先约定的包含置乱密码的密钥中获得。The scrambled password can be obtained from the key containing the scrambled password provided by the watermark information embedding terminal; or from the pre-agreed key including the scrambled password.
至此,对本申请第二实施例提供的水印提取方法的实施方式进行了详细说明。本申请第二实施例提供的水印提取方法,保证了水印信息嵌入和水印信息提取在相同的参考图像分辨率进行,因此无论对嵌入水印信息的图像进行何种缩放攻击,都不会影响水印信息的提取,实现了嵌入水印信息的图像在受到缩放攻击时仍能正确提取出嵌入的水印信息。So far, the implementation of the watermark extraction method provided by the second embodiment of the present application has been described in detail. The watermark extraction method provided by the second embodiment of the present application ensures that the watermark information embedding and watermark information extraction are performed at the same reference image resolution, so no matter what scaling attack is performed on the image embedded with the watermark information, the watermark information will not be affected. It realizes that the image with embedded watermark information can still correctly extract the embedded watermark information when it is attacked by scaling.
与上述提供的一种水印嵌入方法相对应的,本申请第三实施例还提供了一种水印嵌入装置。Corresponding to the watermark embedding method provided above, the third embodiment of the present application further provides a watermark embedding apparatus.
如图4所示,所述水印嵌入装置包括:As shown in Figure 4, the watermark embedding device includes:
参考图像分辨率确定单元401,用于根据预先设定的至少一个参考图像分辨率,确定第一图像对应的参考图像分辨率;所述第一图像为待嵌入水印的图像;A reference image
第二图像得到单元402,用于根据所述第一图像对应的参考图像分辨率,对第一图像进行缩放处理,得到第二图像;所述第二图像的分辨率与所述第一图像对应的参考图像分辨率相同;The second
水印信息嵌入单元403,用于将水印信息嵌入到所述第二图像的频率域系数;a watermark
第二图像逆变换处理单元404,用于对所述第二图像的频率域系数进行逆变换处理,得到嵌入水印信息的第二图像;The second image inverse
第二图像缩放处理单元405,用于将嵌入水印信息的第二图像进行缩放处理,得到与第一图像分辨率相同的图像。The second image scaling
可选的,所述水印信息嵌入单元,具体用于:Optionally, the watermark information embedding unit is specifically used for:
对所述第二图像进行分块处理,得到第二图像的图像块;performing block processing on the second image to obtain image blocks of the second image;
对所述第二图像的图像块进行空间域到频率域的变换,得到所述第二图像的图像块的频率域系数;transforming the image block of the second image from the space domain to the frequency domain to obtain the frequency domain coefficients of the image block of the second image;
对所述第二图像的图像块的频率域系数进行量化处理,得到量化的频率域系数;quantizing the frequency domain coefficients of the image blocks of the second image to obtain quantized frequency domain coefficients;
将所述水印信息嵌入到所述量化的频率域系数中。The watermark information is embedded in the quantized frequency domain coefficients.
可选的,所述将水印信息嵌入到所述量化的频率域系数,包括:Optionally, the embedding of the watermark information into the quantized frequency domain coefficients includes:
第一水印信息图像转换子单元,用于将所述水印信息转换成第一水印信息图像;a first watermark information image conversion subunit, configured to convert the watermark information into a first watermark information image;
水印比特序列转化子单元,用于将所述第一水印信息图像转化为水印比特序列;a watermark bit sequence conversion subunit, for converting the first watermark information image into a watermark bit sequence;
比特序列嵌入子单元,用于将所述水印比特序列嵌入到所述量化的频率域系数中。A bit sequence embedding sub-unit for embedding the watermark bit sequence into the quantized frequency domain coefficients.
可选的,所述水印比特序列转化子单元具体用于:Optionally, the watermark bit sequence conversion subunit is specifically used for:
对所述第一水印信息图像进行置乱处理,得到第二水印信息图像;所述第二水印信息图像为置乱处理后的第一水印信息图像;Perform scrambling processing on the first watermark information image to obtain a second watermark information image; the second watermark information image is the first watermark information image after scrambling processing;
将所述第二水印信息图像转化为水印比特序列。Converting the second watermark information image into a sequence of watermark bits.
可选的,所述对所述第一水印信息图像进行置乱处理,得到第二水印信息图像,包括:Optionally, performing scrambling processing on the first watermark information image to obtain a second watermark information image, including:
使用置乱密码对所述第一水印信息图像进行置乱处理,得到第二水印信息图像。The first watermark information image is scrambled by using a scrambled password to obtain a second watermark information image.
可选的,所述装置还包括:Optionally, the device further includes:
密钥提供单元,用于将所述第一图像对应的参考图像分辨率和置乱密码作为密钥提供给水印信息提取端。The key providing unit is configured to provide the reference image resolution and scrambled password corresponding to the first image to the watermark information extraction end as a key.
可选的,所述根据预先设定的至少一个参考图像分辨率,确定第一图像对应的参考图像分辨率,包括:Optionally, determining the reference image resolution corresponding to the first image according to at least one preset reference image resolution includes:
从预先设定的至少一个参考图像分辨率选择出与所述第一图像的分辨率差别最小的参考图像分辨率,作为所述第一图像对应的参考图像分辨率。From at least one preset reference image resolution, a reference image resolution with the smallest difference from the resolution of the first image is selected as the reference image resolution corresponding to the first image.
可选的,所述装置还包括:Optionally, the device further includes:
参考图像分辨率提供单元,用于将所述第一图像对应的参考图像分辨率提供给水印信息提取端。The reference image resolution providing unit is configured to provide the reference image resolution corresponding to the first image to the watermark information extraction end.
需要说明的是,对于本申请第三实施例提供的水印嵌入装置的详细描述可以参考对本申请第一实施例的相关描述,这里不再赘述。It should be noted that, for the detailed description of the watermark embedding apparatus provided by the third embodiment of the present application, reference may be made to the relevant description of the first embodiment of the present application, and details are not repeated here.
与上述提供的一种水印嵌入方法相对应的,本申请第四实施例还提供了一种电子设备。Corresponding to the watermark embedding method provided above, the fourth embodiment of the present application further provides an electronic device.
如图5所示,电子设备包括:As shown in Figure 5, the electronic equipment includes:
处理器501;以及
存储器502,用于存储水印嵌入方法的程序,该设备通电并通过所述处理器运行该水印嵌入方法的程序后,执行下述步骤:The
根据预先设定的至少一个参考图像分辨率,确定第一图像对应的参考图像分辨率;所述第一图像为待嵌入水印信息的图像;Determine the reference image resolution corresponding to the first image according to the preset at least one reference image resolution; the first image is an image to be embedded with watermark information;
根据所述第一图像对应的参考图像分辨率,对所述第一图像进行缩放处理,得到第二图像;所述第二图像的分辨率与所述第一图像对应的参考图像分辨率相同;scaling the first image according to the resolution of the reference image corresponding to the first image to obtain a second image; the resolution of the second image is the same as the resolution of the reference image corresponding to the first image;
将水印信息嵌入到所述第二图像的频率域系数;embedding watermark information into frequency domain coefficients of the second image;
对所述第二图像的频率域系数进行逆变换处理,得到嵌入水印信息的第二图像;Perform inverse transform processing on the frequency domain coefficients of the second image to obtain a second image with embedded watermark information;
将嵌入水印信息的第二图像进行缩放处理,得到与所述第一图像分辨率相同的图像。Scaling the second image embedded with the watermark information to obtain an image with the same resolution as the first image.
可选的,所述将水印信息嵌入到所述第二图像的频率域系数,包括:Optionally, the embedding of the watermark information into the frequency domain coefficients of the second image includes:
对所述第二图像进行分块处理,得到第二图像的图像块;performing block processing on the second image to obtain image blocks of the second image;
对所述第二图像的图像块进行空间域到频率域的变换,得到所述第二图像的图像块的频率域系数;transforming the image block of the second image from the space domain to the frequency domain to obtain the frequency domain coefficients of the image block of the second image;
对所述第二图像的图像块的频率域系数进行量化处理,得到量化的频率域系数;quantizing the frequency domain coefficients of the image blocks of the second image to obtain quantized frequency domain coefficients;
将所述水印信息嵌入到所述量化的频率域系数中。The watermark information is embedded in the quantized frequency domain coefficients.
可选的,所述将水印信息嵌入到所述量化的频率域系数,包括:Optionally, the embedding of the watermark information into the quantized frequency domain coefficients includes:
将所述水印信息转换成第一水印信息图像;converting the watermark information into a first watermark information image;
将所述第一水印信息图像转化为水印比特序列;Converting the first watermark information image into a watermark bit sequence;
将所述水印比特序列嵌入到所述量化的频率域系数中。The sequence of watermark bits is embedded into the quantized frequency domain coefficients.
可选的,所述将所述第一水印信息图像转化为水印比特序列,包括:Optionally, converting the first watermark information image into a watermark bit sequence includes:
对所述第一水印信息图像进行置乱处理,得到第二水印信息图像;所述第二水印信息图像为置乱处理后的第一水印信息图像;Perform scrambling processing on the first watermark information image to obtain a second watermark information image; the second watermark information image is the first watermark information image after scrambling processing;
将所述第二水印信息图像转化为水印比特序列。Converting the second watermark information image into a sequence of watermark bits.
可选的,所述对所述第一水印信息图像进行置乱处理,得到第二水印信息图像,包括:Optionally, performing scrambling processing on the first watermark information image to obtain a second watermark information image, including:
使用置乱密码对所述第一水印信息图像进行置乱处理,得到第二水印信息图像。The first watermark information image is scrambled by using a scrambled password to obtain a second watermark information image.
可选的,所述电子设备还执行下述步骤:Optionally, the electronic device also performs the following steps:
将所述第一图像对应的参考图像分辨率和置乱密码作为密钥提供给水印信息提取端。The reference image resolution and scrambled password corresponding to the first image are provided to the watermark information extraction end as a key.
可选的,所述根据预先设定的至少一个参考图像分辨率,确定第一图像对应的参考图像分辨率,包括:Optionally, determining the reference image resolution corresponding to the first image according to at least one preset reference image resolution includes:
从预先设定的至少一个参考图像分辨率选择出与所述第一图像的分辨率差别最小的参考图像分辨率,作为所述第一图像对应的参考图像分辨率。From at least one preset reference image resolution, a reference image resolution with the smallest difference from the resolution of the first image is selected as the reference image resolution corresponding to the first image.
可选的,所述电子设备还执行下述步骤:Optionally, the electronic device also performs the following steps:
将所述第一图像对应的参考图像分辨率提供给水印信息提取端。The reference image resolution corresponding to the first image is provided to the watermark information extraction end.
需要说明的是,对于本申请第四实施例提供的电子设备的详细描述可以参考对本申请第一实施例的相关描述,这里不再赘述。It should be noted that, for the detailed description of the electronic device provided by the fourth embodiment of the present application, reference may be made to the relevant description of the first embodiment of the present application, and details are not repeated here.
与上述提供的一种水印嵌入方法相对应的,本申请第五实施例还提供了一种存储设备,存储有水印嵌入方法的程序,该程序被处理器运行,执行下述步骤:Corresponding to the watermark embedding method provided above, the fifth embodiment of the present application also provides a storage device that stores a program of the watermark embedding method, and the program is run by a processor and performs the following steps:
根据预先设定的至少一个参考图像分辨率,确定第一图像对应的参考图像分辨率;所述第一图像为待嵌入水印信息的图像;Determine the reference image resolution corresponding to the first image according to the preset at least one reference image resolution; the first image is an image to be embedded with watermark information;
根据所述第一图像对应的参考图像分辨率,对所述第一图像进行缩放处理,得到第二图像;所述第二图像的分辨率与所述第一图像对应的参考图像分辨率相同;scaling the first image according to the resolution of the reference image corresponding to the first image to obtain a second image; the resolution of the second image is the same as the resolution of the reference image corresponding to the first image;
将水印信息嵌入到所述第二图像的频率域系数;embedding watermark information into frequency domain coefficients of the second image;
对所述第二图像的频率域系数进行逆变换处理,得到嵌入水印信息的第二图像;Perform inverse transform processing on the frequency domain coefficients of the second image to obtain a second image with embedded watermark information;
将嵌入水印信息的第二图像进行缩放处理,得到与所述第一图像分辨率相同的图像。Scaling the second image embedded with the watermark information to obtain an image with the same resolution as the first image.
需要说明的是,对于本申请第五实施例提供的存储设备的详细描述可以参考对本申请第一实施例的相关描述,这里不再赘述。It should be noted that, for a detailed description of the storage device provided by the fifth embodiment of the present application, reference may be made to the relevant description of the first embodiment of the present application, and details are not repeated here.
与上述提供的一种水印提取方法相对应的,本申请第六实施例还提供了一种水印提取装置。Corresponding to the watermark extraction method provided above, the sixth embodiment of the present application further provides a watermark extraction apparatus.
如图6所示,所述水印提取装置包括:As shown in Figure 6, the watermark extraction device includes:
第一图像获取单元601,用于获得待提取水印信息的第一图像;The first
参考图像分辨率确定单元602,用于确定嵌入水印信息时使用的参考图像分辨率;a reference image
第二图像得到单元603,用于将所述第一图像进行缩放处理,得到分辨率与所述参考图像分辨率相同的第二图像;A second
水印信息提取单元604,用于从所述第二图像的频率域系数中提取出水印信息。The watermark
可选的,所述参考图像分辨率确定单元,具体用于:Optionally, the reference image resolution determination unit is specifically used for:
根据水印信息嵌入端提供的包含所述参考图像分辨率的密钥,确定嵌入水印信息时使用的参考图像分辨率;或者,Determine the reference image resolution used when embedding the watermark information according to the key containing the reference image resolution provided by the watermark information embedding terminal; or,
根据水印信息嵌入端提供的参考图像分辨率,确定嵌入水印信息时使用的参考图像分辨率。According to the reference image resolution provided by the watermark information embedding terminal, the reference image resolution used when embedding the watermark information is determined.
可选的,所述装置还包括:Optionally, the device further includes:
图像块得到单元,用于对所述第二图像进行分块处理,得到第二图像的图像块;an image block obtaining unit, configured to perform block processing on the second image to obtain image blocks of the second image;
频率域系数得到单元,用于对所述第二图像的图像块进行空间域到频率域的变换,得到所述第二图像的图像块的频率域系数;a frequency domain coefficient obtaining unit, configured to transform the image block of the second image from the space domain to the frequency domain to obtain the frequency domain coefficient of the image block of the second image;
量化的频率域系数得到单元,用于对所述第二图像的图像块的频率域系数进行量化处理,得到量化的频率域系数;a quantized frequency-domain coefficient obtaining unit, configured to perform quantization processing on the frequency-domain coefficients of the image blocks of the second image to obtain quantized frequency-domain coefficients;
所述水印信息提取单元,具体用于:The watermark information extraction unit is specifically used for:
从所述量化的频率域系数中提取出嵌入的水印信息。The embedded watermark information is extracted from the quantized frequency domain coefficients.
可选的,所述水印信息提取单元,包括:Optionally, the watermark information extraction unit includes:
水印比特序列提取子单元,用于从所述第二图像的频率域系数中提取出嵌入的水印比特序列;a watermark bit sequence extraction subunit for extracting the embedded watermark bit sequence from the frequency domain coefficients of the second image;
第一水印信息图像得到子单元,用于根据所述水印比特序列,得到第一水印信息图像;a first watermark information image obtaining subunit, used for obtaining the first watermark information image according to the watermark bit sequence;
水印信息得到子单元,用于根据所述第一水印信息图像,得到所述水印信息。The watermark information obtaining subunit is used for obtaining the watermark information according to the first watermark information image.
可选的,所述水印信息得到子单元,具体用于:Optionally, the watermark information obtains a subunit, which is specifically used for:
根据所述水印比特序列,得到第二水印信息图像;According to the watermark bit sequence, a second watermark information image is obtained;
对所述第二水印信息图像进行反置乱处理,得到所述第一水印信息图像。Perform inverse scrambling processing on the second watermark information image to obtain the first watermark information image.
可选的,所述对所述第二水印信息图像进行反置乱处理,得到第一水印信息图像,包括:Optionally, performing inverse scrambling processing on the second watermark information image to obtain the first watermark information image, including:
使用置乱密码对所述第二水印信息图像进行反置乱处理,得到第一水印信息图像。The second watermark information image is reversely scrambled by using a scrambled password to obtain a first watermark information image.
可选的,所述装置还包括:Optionally, the device further includes:
置乱密码获得单元,用于从水印信息嵌入端提供的包含置乱密码的密钥中获得所述置乱密码;或者,从预先约定的包含置乱密码的密钥中获得所述置乱密码。a scrambled password obtaining unit, configured to obtain the scrambled password from a key provided by the watermark information embedding terminal that contains the scrambled password; or, obtain the scrambled password from a pre-agreed key that includes the scrambled password .
需要说明的是,对于本申请第六实施例提供的水印提取装置的详细描述可以参考对本申请第二实施例的相关描述,这里不再赘述。It should be noted that, for the detailed description of the watermark extraction apparatus provided by the sixth embodiment of the present application, reference may be made to the relevant description of the second embodiment of the present application, and details are not repeated here.
与上述提供的一种水印提取方法相对应的,本申请第七实施例还提供了一种电子设备。Corresponding to the watermark extraction method provided above, the seventh embodiment of the present application further provides an electronic device.
如图7所示,所述电子设备包括:As shown in Figure 7, the electronic device includes:
处理器701;以及
存储器702,用于存储水印提取方法的程序,该设备通电并通过所述处理器运行该水印提取方法的程序后,执行下述步骤:The
获得待提取水印信息的第一图像;obtaining the first image of the watermark information to be extracted;
确定嵌入水印信息时使用的参考图像分辨率;Determine the reference image resolution used when embedding watermark information;
将所述第一图像进行缩放处理,得到分辨率与所述参考图像分辨率相同的第二图像;scaling the first image to obtain a second image with the same resolution as the reference image;
从所述第二图像的频率域系数中提取出水印信息。The watermark information is extracted from the frequency domain coefficients of the second image.
可选的,所述确定嵌入水印信息时使用的参考图像分辨率,包括:Optionally, the determination of the reference image resolution used when embedding the watermark information includes:
根据水印信息嵌入端提供的包含所述参考图像分辨率的密钥,确定嵌入水印信息时使用的参考图像分辨率;或者,Determine the reference image resolution used when embedding the watermark information according to the key containing the reference image resolution provided by the watermark information embedding terminal; or,
根据水印信息嵌入端提供的参考图像分辨率,确定嵌入水印信息时使用的参考图像分辨率。According to the reference image resolution provided by the watermark information embedding terminal, the reference image resolution used when embedding the watermark information is determined.
可选的,所述电子设备还执行下述步骤:Optionally, the electronic device also performs the following steps:
对所述第二图像进行分块处理,得到第二图像的图像块;performing block processing on the second image to obtain image blocks of the second image;
对所述第二图像的图像块进行空间域到频率域的变换,得到所述第二图像的图像块的频率域系数;transforming the image block of the second image from the space domain to the frequency domain to obtain the frequency domain coefficients of the image block of the second image;
对所述第二图像的图像块的频率域系数进行量化处理,得到量化的频率域系数;quantizing the frequency domain coefficients of the image blocks of the second image to obtain quantized frequency domain coefficients;
所述从所述第二图像的频率域系数中提取出嵌入的水印信息,包括:The extracting the embedded watermark information from the frequency domain coefficients of the second image includes:
从所述量化的频率域系数中提取出嵌入的水印信息。The embedded watermark information is extracted from the quantized frequency domain coefficients.
可选的,所述从所述第二图像的频率域系数中提取出嵌入的水印信息,包括:Optionally, the extracting the embedded watermark information from the frequency domain coefficients of the second image includes:
从所述第二图像的频率域系数中提取出嵌入的水印比特序列;extracting the embedded watermark bit sequence from the frequency domain coefficients of the second image;
根据所述水印比特序列,得到第一水印信息图像;obtaining a first watermark information image according to the watermark bit sequence;
根据所述第一水印信息图像,得到所述水印信息。The watermark information is obtained according to the first watermark information image.
可选的,所述根据所述水印比特序列,得到第一水印信息图像,包括:Optionally, obtaining the first watermark information image according to the watermark bit sequence, including:
根据所述水印比特序列,得到第二水印信息图像;According to the watermark bit sequence, a second watermark information image is obtained;
对所述第二水印信息图像进行反置乱处理,得到所述第一水印信息图像。Perform inverse scrambling processing on the second watermark information image to obtain the first watermark information image.
可选的,所述对所述第二水印信息图像进行反置乱处理,得到第一水印信息图像,包括:Optionally, performing inverse scrambling processing on the second watermark information image to obtain the first watermark information image, including:
使用置乱密码对所述第二水印信息图像进行反置乱处理,得到第一水印信息图像。The second watermark information image is reversely scrambled by using a scrambled password to obtain a first watermark information image.
可选的,所述电子设备还执行下述步骤:Optionally, the electronic device also performs the following steps:
从水印信息嵌入端提供的包含置乱密码的密钥中获得所述置乱密码;或者,The scrambled password is obtained from the key provided by the watermark information embedding terminal that contains the scrambled password; or,
从预先约定的包含置乱密码的密钥中获得所述置乱密码。The scrambled cipher is obtained from a pre-agreed key containing the scrambled cipher.
需要说明的是,对于本申请第七实施例提供的电子设备的详细描述可以参考对本申请第二实施例的相关描述,这里不再赘述。It should be noted that, for the detailed description of the electronic device provided by the seventh embodiment of the present application, reference may be made to the related description of the second embodiment of the present application, and details are not repeated here.
与上述提供的一种水印提取方法相对应的,本申请第八实施例还提供了一种存储设备,存储有水印提取方法的程序,该程序被处理器运行,执行下述步骤:Corresponding to the watermark extraction method provided above, the eighth embodiment of the present application also provides a storage device that stores a program of the watermark extraction method, and the program is run by a processor and performs the following steps:
获得待提取水印信息的第一图像;obtaining the first image of the watermark information to be extracted;
确定嵌入水印信息时使用的参考图像分辨率;Determine the reference image resolution used when embedding watermark information;
将所述第一图像进行缩放处理,得到分辨率与所述参考图像分辨率相同的第二图像;scaling the first image to obtain a second image with the same resolution as the reference image;
从所述第二图像的频率域系数中提取出水印信息。The watermark information is extracted from the frequency domain coefficients of the second image.
需要说明的是,对于本申请第八实施例提供的存储设备的详细描述可以参考对本申请第二实施例的相关描述,这里不再赘述。It should be noted that, for the detailed description of the storage device provided by the eighth embodiment of the present application, reference may be made to the related description of the second embodiment of the present application, and details are not repeated here.
本申请第九实施例提供了一种水印嵌入方法,以下结合图8进行说明。The ninth embodiment of the present application provides a watermark embedding method, which is described below with reference to FIG. 8 .
如图8所示,在步骤801中,获取目标分辨率以及待嵌入水印信息的第一图像。As shown in FIG. 8, in step 801, a target resolution and a first image to be embedded with watermark information are acquired.
获取目标分辨率,可以采用多种方式,一种方式是:获取分辨率样本库;从所述分辨率样本库中,检索与所述第一图像的分辨率满足预设条件的分辨率样本,作为目标分辨率。其中,预设条件可以为检索与第一图像的分辨率差别最小的分辨率样本。另一种方式是:接收客户端输入的目标分辨率,客户端的用户可以根据预期第一图像要经历的各种缩放攻击可能设置目标分辨率;另一种方式是:获取目标应用,根据目标应用对应的分辨率,设置目标分辨率。The target resolution can be obtained in a variety of ways. One way is: obtaining a resolution sample library; retrieving a resolution sample that satisfies a preset condition with the resolution of the first image from the resolution sample library, as the target resolution. The preset condition may be to retrieve a resolution sample with the smallest difference in resolution from the first image. Another way is: receiving the target resolution input by the client, the user of the client can set the target resolution according to various scaling attacks expected to be experienced by the first image; another way is: obtaining the target application, according to the target application The corresponding resolution, set the target resolution.
如图8所示,在步骤802中,根据所述目标分辨率,对所述第一图像进行第一缩放处理,得到第二图像,其中,所述第二图像的分辨率与目标分辨率满足第一预设误差范围。As shown in FIG. 8, in step 802, a first scaling process is performed on the first image according to the target resolution to obtain a second image, wherein the resolution of the second image and the target resolution satisfy The first preset error range.
如图8所示,在步骤803中,将所述水印信息嵌入到所述第二图像。As shown in FIG. 8, in step 803, the watermark information is embedded in the second image.
将所述水印嵌入到所述第二图像,包括:将所述水印嵌入到所述第二图像的频率域系数;对所述第二图像的频率域系数进行逆变换处理,得到嵌入水印信息的第二图像。Embedding the watermark into the second image includes: embedding the watermark into the frequency domain coefficients of the second image; performing inverse transform processing on the frequency domain coefficients of the second image to obtain the embedded watermark information. second image.
将水印嵌入到第二图像的频率域系数以及对第二图像的频率域系数进行逆变换处理,得到嵌入水印信息的第二图像的具体内容可参照本申请第一实施例的相关内容,此处不再赘述。Embed the watermark into the frequency domain coefficients of the second image and perform inverse transform processing on the frequency domain coefficients of the second image to obtain the specific content of the second image with embedded watermark information, please refer to the relevant content of the first embodiment of this application, here No longer.
如图8所示,在步骤804中,将嵌入水印信息的第二图像进行第二缩放处理,得到第三图像,其中,所述第三图像的分辨率与所述第一图像的分辨率满足第二预设误差范围。As shown in FIG. 8, in step 804, a second scaling process is performed on the second image embedded with the watermark information to obtain a third image, wherein the resolution of the third image and the resolution of the first image satisfy The second preset error range.
第一预设误差范围与第二预设误差范围可以相同。The first preset error range and the second preset error range may be the same.
下面结合图9和图10介绍水印嵌入和提取的场景。The scenarios of watermark embedding and extraction are described below with reference to Figure 9 and Figure 10 .
如图9所示,水印嵌入端的界面为一个网页,网页上展示了第一图像选择按钮9-1,通过第一图像选择按钮,可以通过输入待嵌入水印的第一图像的路径,选择出待嵌入水印的第一图像,网页上还展示了水印选择按钮9-2,通过水印选择按钮,可以选择待嵌入的水印,还可以根据目标应用列表9-3选择目标应用,根据已选择的目标应用确定目标分辨率,在选择第一图像、嵌入的水印和目标应用后,按水印嵌入按钮9-4,生成嵌入水印的第三图像9-5。As shown in Figure 9, the interface of the watermark embedding terminal is a web page. The web page displays the first image selection button 9-1. Through the first image selection button, the path of the first image to be embedded in the watermark can be input, and the selection of the first image to be embedded can be selected. The first image of the embedded watermark, the watermark selection button 9-2 is also displayed on the webpage. Through the watermark selection button, the watermark to be embedded can be selected, and the target application can also be selected according to the target application list 9-3. According to the selected target application Determine the target resolution, after selecting the first image, the embedded watermark and the target application, press the watermark embedding button 9-4 to generate a third image 9-5 with embedded watermark.
如图10所示,水印提取端(可以是即时通讯应用中提供的应用)首先通过第三图像选择按钮10-1获得待提取水印的第三图像;根据水印密码获取按钮10-2获得置乱密码;从目标应用选择列表10-3中选择出目标应用,根据已选择的目标应用确定目标分辨率,然后通过按水印提取按钮10-4进行水印提取,提取出嵌入的水印,最后根据提取出的水印进行版权认证10-5。As shown in Figure 10, the watermark extraction terminal (which may be an application provided in an instant messaging application) first obtains the third image of the watermark to be extracted through the third image selection button 10-1; Password; select the target application from the target application selection list 10-3, determine the target resolution according to the selected target application, then extract the watermark by pressing the watermark extraction button 10-4, extract the embedded watermark, and finally extract the watermarks for copyright authentication 10-5.
本申请虽然以较佳实施例公开如上,但其并不是用来限定本本申请,任何本领域技术人员在不脱离本发明的精神和范围内,都可以做出可能的变动和修改,因此本本申请的保护范围应当以本本申请权利要求所界定的范围为准。Although the present application is disclosed above with preferred embodiments, it is not intended to limit the present application. Any person skilled in the art can make possible changes and modifications without departing from the spirit and scope of the present invention. Therefore, the present application The scope of protection shall be subject to the scope defined by the claims of this application.
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-persistent memory in computer readable media, random access memory (RAM) and/or non-volatile memory in the form of, for example, read only memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括非暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer-readable media includes both persistent and non-permanent, removable and non-removable media, and storage of information may be implemented by any method or technology. Information may be computer readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), Flash Memory or other memory technology, Compact Disc Read Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, excludes non-transitory computer-readable media, such as modulated data signals and carrier waves.
本领域技术人员应明白,本申请的实施例可提供为方法、系统或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。It will be appreciated by those skilled in the art that the embodiments of the present application may be provided as a method, a system or a computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
Claims (26)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811043750.1A CN110889796B (en) | 2018-09-07 | 2018-09-07 | Watermark embedding and watermark extraction method, device and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811043750.1A CN110889796B (en) | 2018-09-07 | 2018-09-07 | Watermark embedding and watermark extraction method, device and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110889796A CN110889796A (en) | 2020-03-17 |
CN110889796B true CN110889796B (en) | 2021-11-02 |
Family
ID=69744576
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811043750.1A Active CN110889796B (en) | 2018-09-07 | 2018-09-07 | Watermark embedding and watermark extraction method, device and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110889796B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111510775B (en) * | 2020-05-11 | 2021-04-02 | 知安视娱(南京)科技有限公司 | Digital copyright management and watermark tracking method and system for set top box video in IPTV |
CN111815501B (en) * | 2020-07-31 | 2022-05-13 | 湖南财政经济学院 | Digital watermarking method and device for resisting geometric scaling attack |
CN112884651B (en) * | 2021-02-09 | 2024-06-04 | 维沃移动通信有限公司 | Watermark display method and device |
CN113747061A (en) * | 2021-08-25 | 2021-12-03 | 国网河北省电力有限公司衡水供电分公司 | Image acquisition method, device, terminal and storage medium |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101079147A (en) * | 2007-06-25 | 2007-11-28 | 中山大学 | Multiple bit digital watermark method capable of resisting printing, scanning and geometric transformation |
CN101308566A (en) * | 2008-06-02 | 2008-11-19 | 西安电子科技大学 | Digital image watermarking method against geometric attack based on contourlet transform |
CN101489133A (en) * | 2009-01-16 | 2009-07-22 | 华中科技大学 | Geometric attack resisting real-time video watermarking method |
CN101662686A (en) * | 2009-09-07 | 2010-03-03 | 江南大学 | DCT domain video watermark treatment method based on texture features |
CN103971322A (en) * | 2014-05-13 | 2014-08-06 | 安徽师范大学 | Watermark embedding method for host image and watermark extracting method for image including watermark |
CN104616244A (en) * | 2015-01-24 | 2015-05-13 | 河南师范大学 | Image watermark embedding and extracting method based on back propagation (BP) neural network compressed domain |
CN107240061A (en) * | 2017-06-09 | 2017-10-10 | 河南师范大学 | A kind of watermark insertion, extracting method and device based on Dynamic BP neural |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101378434A (en) * | 2007-08-31 | 2009-03-04 | 鹏智科技(深圳)有限公司 | Apparatus and method for displaying picture |
-
2018
- 2018-09-07 CN CN201811043750.1A patent/CN110889796B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101079147A (en) * | 2007-06-25 | 2007-11-28 | 中山大学 | Multiple bit digital watermark method capable of resisting printing, scanning and geometric transformation |
CN101308566A (en) * | 2008-06-02 | 2008-11-19 | 西安电子科技大学 | Digital image watermarking method against geometric attack based on contourlet transform |
CN101489133A (en) * | 2009-01-16 | 2009-07-22 | 华中科技大学 | Geometric attack resisting real-time video watermarking method |
CN101662686A (en) * | 2009-09-07 | 2010-03-03 | 江南大学 | DCT domain video watermark treatment method based on texture features |
CN103971322A (en) * | 2014-05-13 | 2014-08-06 | 安徽师范大学 | Watermark embedding method for host image and watermark extracting method for image including watermark |
CN104616244A (en) * | 2015-01-24 | 2015-05-13 | 河南师范大学 | Image watermark embedding and extracting method based on back propagation (BP) neural network compressed domain |
CN107240061A (en) * | 2017-06-09 | 2017-10-10 | 河南师范大学 | A kind of watermark insertion, extracting method and device based on Dynamic BP neural |
Non-Patent Citations (2)
Title |
---|
Medical image watermarking using RSA encryption in wavelet domain;P.V.V.Kishore等;《IEEE Xplore》;20140925;258-262 * |
一种基于多分辨率分解的图像水印嵌入方法;林春蔷等;《技术与市场》;20090630;第16卷(第6期);44-46 * |
Also Published As
Publication number | Publication date |
---|---|
CN110889796A (en) | 2020-03-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110889796B (en) | Watermark embedding and watermark extraction method, device and device | |
Tagliasacchi et al. | Hash-based identification of sparse image tampering | |
Pal et al. | Watermarking scheme using local binary pattern for image authentication and tamper detection through dual image | |
CN110211019A (en) | A kind of watermark insertion of image and extracting method and relevant apparatus | |
Bhautmage et al. | Advanced video steganography algorithm | |
CN110211020B (en) | Image watermark embedding and extraction method based on SWT-DFT | |
Cliang et al. | A digital watermarking scheme using human visual effects | |
CN111968026A (en) | Medical image robust watermarking method based on PHTs-DCT | |
Pizzolante et al. | Copyright protection for images on mobile devices | |
US20030172275A1 (en) | Real-time blind watermarking method using quantization | |
Liu et al. | Robustness of double random phase encoding spread-space spread-spectrum watermarking technique | |
Hadmi et al. | A robust and secure perceptual hashing system based on a quantization step analysis | |
Chang et al. | An image copyright protection scheme based on torus automorphism | |
Zeki et al. | Steganographic software: analysis and implementation | |
Al-Otum et al. | Copyright protection of color images for android-based smartphones using watermarking with quick-response code | |
Abraham et al. | Image watermarking using DCT in selected pixel regions | |
Ridzoň et al. | Content protection in grayscale and color images based on robust digital watermarking | |
Verma | Review of steganography techniques | |
Raj et al. | A survey on reversible data hiding in encrypted image | |
Roy et al. | A robust reversible image watermarking scheme in DCT domain using Arnold scrambling and histogram modification | |
Bhattacharyya et al. | Watermarking Using Multiresolution Cosine Transformation: A Review | |
Kumar et al. | A reversible high embedding capacity data hiding technique for hiding secret data in images | |
JP3943573B2 (en) | Image processing method and apparatus for digital watermark | |
Susanto et al. | A combination of Hill Cipher and LSB for image security | |
Rudder et al. | Using Bias optimization for reversible data hiding using image interpolation |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |