当前位置: 首页 > news >正文

blind-watermark - 水印绑定

文章目录

    • 一、关于 blind-watermark
      • 安装
    • 二、bash 中使用
    • 三、Python 调用
      • 1、基本使用
      • 2、attacks on Watermarked Image
      • 3、embed images
      • 4、embed array of bits
    • 四、并发
    • 五、相关 Project


一、关于 blind-watermark

Blind watermark 基于 DWT-DCT-SVD.

  • github : https://github.com/guofei9987/blind_watermark
  • Documentation: https://blindwatermark.github.io/blind_watermark/#/en/
  • 文档: https://blindwatermark.github.io/blind_watermark/#/zh/
  • Source code: https://github.com/guofei9987/blind_watermark
  • Discussions : https://github.com/guofei9987/blind_watermark/discussions

安装

pip install blind-watermark

源码安装当前开发版本

git clone git@github.com:guofei9987/blind_watermark.git
cd blind_watermark
pip install .


二、bash 中使用

# embed watermark into image:
blind_watermark --embed --pwd 1234 examples/pic/ori_img.jpeg "watermark text" examples/output/embedded.png# extract watermark from image:
blind_watermark --extract --pwd 1234 --wm_shape 111 examples/output/embedded.png

三、Python 调用

1、基本使用

Original Image + Watermark = Watermarked Image

origin_image + ‘@guofei9987 开源万岁!’ = 打上水印的图


See the codes

嵌入水印:

from blind_watermark import WaterMarkbwm1 = WaterMark(password_img=1, password_wm=1)
bwm1.read_img('pic/ori_img.jpg')
wm = '@guofei9987 开源万岁!'
bwm1.read_wm(wm, mode='str')
bwm1.embed('output/embedded.png')
len_wm = len(bwm1.wm_bit)
print('Put down the length of wm_bit {len_wm}'.format(len_wm=len_wm))

提取水印:

bwm1 = WaterMark(password_img=1, password_wm=1)
wm_extract = bwm1.extract('output/embedded.png', wm_shape=len_wm, mode='str')
print(wm_extract)

输出:

@guofei9987 开源万岁!


2、attacks on Watermarked Image

attack methodimage after attackextracted watermark
Rotate 45 Degrees在这里插入图片描述‘@guofei9987 开源万岁!’
Random crop在这里插入图片描述‘@guofei9987 开源万岁!’
Masks在这里插入图片描述‘@guofei9987 开源万岁!’
Vertical cut横向裁剪攻击‘@guofei9987 开源万岁!’
Horizontal cut纵向裁剪攻击‘@guofei9987 开源万岁!’
Resize缩放攻击‘@guofei9987 开源万岁!’
Pepper Noise椒盐攻击‘@guofei9987 开源万岁!’
Brightness 10% Down亮度攻击‘@guofei9987 开源万岁!’

3、embed images

嵌入水印:

from blind_watermark import WaterMarkbwm1 = WaterMark(password_wm=1, password_img=1)
# read original image
bwm1.read_img('pic/ori_img.jpg')
# read watermark
bwm1.read_wm('pic/watermark.png')
# embed
bwm1.embed('output/embedded.png')

提取水印:

bwm1 = WaterMark(password_wm=1, password_img=1)
# notice that wm_shape is necessary
bwm1.extract(filename='output/embedded.png', wm_shape=(128, 128), out_wm_name='output/extracted.png', )

attack methodimage after attackextracted watermark
Rotate 45 Degrees[旋转攻击在这里插入图片描述
Random crop在这里插入图片描述多遮挡_提取水印
Mask多遮挡攻击多遮挡_提取水印

4、embed array of bits

See it here

作为 demo,我们嵌入 6 bytes 数据:

wm = [True, False, True, True, True, False]

嵌入:

from blind_watermark import WaterMarkbwm1 = WaterMark(password_img=1, password_wm=1)
bwm1.read_ori_img('pic/ori_img.jpg')
bwm1.read_wm([True, False, True, True, True, False], mode='bit')
bwm1.embed('output/embedded.png')

提取:

bwm1 = WaterMark(password_img=1, password_wm=1, wm_shape=6)
wm_extract = bwm1.extract('output/打上水印的图.png', mode='bit')
print(wm_extract)

请注意,wm_shape(水印的形状)是必需的

输出 wm_extract 是一个浮点数组。设置阈值,例如0.5。


四、并发

WaterMark(..., processes=None)

  • processes 进程数可以是整数。默认为 None,这意味着使用所有进程。

五、相关 Project

  • text_blind_watermark (将消息嵌入文本): https://github.com/guofei9987/text_blind_watermark
  • HideInfo(隐藏为图像、隐藏为声音、隐藏为文本):https://github.com/guofei9987/HideInfo

http://www.lryc.cn/news/485474.html

相关文章:

  • reduce-scatter:适合分布式计算;Reduce、LayerNorm和Broadcast算子的执行顺序对计算结果的影响,以及它们对资源消耗的影响
  • DAY64||dijkstra(堆优化版)精讲 ||Bellman_ford 算法精讲
  • 使用Git工具在GitHub的仓库中上传文件夹(超详细)
  • Python酷库之旅-第三方库Pandas(218)
  • 斗鱼大数据面试题及参考答案
  • 后仿真中的GLS测试用例的选取规则
  • 对接阿里云实人认证
  • UI库架构设计
  • 电子应用产品设计方案-9:全自动智能马桶系统设计方案
  • My_SQL day3
  • 【代码随想录day31】【C++复健】56. 合并区间;738.单调递增的数字
  • jmeter常用配置元件介绍总结之逻辑控制器
  • 解决Windows远程桌面 “为安全考虑,已锁定该用户账户,原因是登录尝试或密码更改尝试过多。请稍后片刻再重试,或与系统管理员或技术支持联系“问题
  • 中文书籍对《人月神话》的引用(161-210本):微软的秘密
  • 关于写React的一些反思和总结
  • Qt 每日面试题 -10
  • 三正科技笔试题
  • Selective attention improves transformer详细解读
  • git配置用户信息
  • 【eNSP】路由基础与路由来源——静态路由实验
  • Python Web 应用开发基础知识
  • STM32 标准库函数 GPIO_SetBits、GPIO_ResetBits、GPIO_WriteBit、GPIO_Write 区别
  • 【Redis_Day4】内部编码和单线程模型
  • Vue模块化开发的理解
  • 在Ubuntu22.04上源码构建ROS noetic环境
  • 算法--解决二叉树遍历问题
  • [刷题]入门1.矩阵转置
  • Flutter开发之flutter_local_notifications
  • Gradle和maven
  • RabbitMQ教程:发布/订阅模式(Publish/Subscribe)(三)