Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当打上水印的图片再次打上水印时的问题 #115

Open
ThinkCodeStudio opened this issue Aug 2, 2023 · 2 comments
Open

当打上水印的图片再次打上水印时的问题 #115

ThinkCodeStudio opened this issue Aug 2, 2023 · 2 comments

Comments

@ThinkCodeStudio
Copy link

测试图片
使用项目中自带的二维码图片给这个图片打上水印

第一次打水印的结果
再次给上面打上水印的图片再次打上自己的二维码图片水印

第二次打水印的结果

成功解出了我的水印, 并且设置不同的密码依然可以覆盖
wm_extracted

测试代码:

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import cv2

from blind_watermark import WaterMark
import os

os.chdir(os.path.dirname(__file__))
bwm = WaterMark(password_wm=123, password_img=123)
# 读取原图
bwm.read_img(filename='pic/ori_img.jpeg')
# 读取水印
bwm.read_wm('pic/watermark.png')
# 打上盲水印
bwm.embed('output/embedded.png')
wm_shape = cv2.imread('pic/watermark.png', flags=cv2.IMREAD_GRAYSCALE).shape

# 再次打水印
bwm = WaterMark(password_wm=1, password_img=1)
# 读取原图
bwm.read_img(filename='output/embedded.png')
# 读取水印
bwm.read_wm('pic/watermark2.png')
# 打上盲水印
bwm.embed('output/embedded2.png')
wm_shape = cv2.imread('pic/watermark2.png', flags=cv2.IMREAD_GRAYSCALE).shape

# %% 解水印
bwm1 = WaterMark(password_wm=1, password_img=1)
# 注意需要设定水印的长宽wm_shape
print(wm_shape)
bwm1.extract('output/embedded2.png', wm_shape=wm_shape, out_wm_name='output/wm_extracted.png', mode='img')

bwm1 = WaterMark(password_wm=123, password_img=123)
# 注意需要设定水印的长宽wm_shape
print(wm_shape)
bwm1.extract('output/embedded2.png', wm_shape=wm_shape, out_wm_name='output/wm_extracted2.png', mode='img')
@ThinkCodeStudio
Copy link
Author

当图片打上图片水印后再次打上文字水印, 图片水印将无法解出

@Gu-f
Copy link

Gu-f commented Aug 2, 2023

当图片打上图片水印后再次打上文字水印, 图片水印将无法解出

我猜测应该是再次打上水印的时候破坏了频域特征。频域隐写无法抵御滤波攻击,这种攻击方式可以改变信号的频域特征以及同步性。这个水印的利用了频域特征,当再次打水印的时候又在原来的特征上再次做了变更,从另一方面考虑,其实就等同于实施了一次频域攻击。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants