资源简介
由python写的GUI,可以实现数字水印的添加与提取,提取是根据添加系数的相关性,实现了盲提取。含有两种攻击测试方法(高斯低通滤波、高斯白噪声)。基于python2.7,watermark.py为主程序,没有打包成exe.

代码片段和文件信息
# -*- coding: utf-8 -*-
“““
Created on Sat Nov 01 21:33:02 2014
@author: HIT706
“““
import numpy as np
from matplotlib.figure import Figure
import PIL
from PIL import Image
import cv2
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from Tkinter import *
import tkFileDialog as dialog
import tkMessageBox
import ttk
np.seterr(divide=‘ignore‘ invalid=‘ignore‘)
class WaterMark(object):
def __init__(selfparent):
self.parent = parent
self.size = 256
self.N = 32
self.K = 8
self.Key1 = np.array([12345678])
self.Key2 = np.array([87654321])
self.state =0
fig = Figure()
self.axe_1 = fig.add_subplot(221)
self.axe_1.set_title(u‘不含水印图片‘fontproperties = ‘STXingkai‘)
self.axe_2 = fig.add_subplot(222)
self.axe_2.set_title(u‘水印图片‘fontproperties = ‘STXingkai‘)
self.axe_3 = fig.add_subplot(223)
self.axe_3.set_title(u‘含水印图片‘fontproperties = ‘STXingkai‘)
self.axe_4 = fig.add_subplot(224)
self.axe_4.set_title(u‘提取的水印‘fontproperties = ‘STXingkai‘)
self.canvas = FigureCanvasTkAgg(figself.parent)
self.canvas._tkcanvas.config(bg = ‘gainsboro‘highlightthickness = 0)#
self.canvas._tkcanvas.pack(side = TOPfill = BOTHexpand = YESpadx=0)
self.canvas.show()
frame = frame(self.parent)
frame.pack(fill = X)
label = Label(frametext = ‘水印图片保存为:‘)
label.pack(side = LEFT)
self.filename = StringVar()
entry = Entry(frametextvariable = self.filename)
entry.pack(side = LEFT)
button2 = Button(frametext = ‘添加水印‘command = self.insert_mark)
button2.pack(side = LEFT)
frame2 = frame(frame)
frame2.pack(side = RIGHT)
button1 = Button(frame2text = ‘提取水印‘command = self.seperate_mark)
button1.pack(side = LEFTpadx = 20)
button3 = Button(frame2text = ‘测试‘command = self.noise_test)
button3.pack(side = LEFT)
variable = [u‘添加白噪声‘u‘高斯低通滤波‘]
self.comboBox = ttk.Combobox(frame2value = variablewidth = 10)
self.comboBox.set(u‘添加白噪声‘)
self.comboBox.pack(side = LEFT)
menubar = Menu(self.parent)
filemenu = Menu(menubar)
filemenu.add_command(label = ‘open‘command = self.open_image)
filemenu.add_command(label = ‘open mark‘command = self.open_mark)
filemenu.add_command(label = ‘open picture‘command = self.open_picture)
menubar.add_cascade(label = ‘file‘menu = filemenu)
self.parent.config(menu = menubar)
def open_image(self):
self.image = dialog.askopenfilename(parent = self.parentfiletypes = [(‘*‘‘*.*‘)]titl
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 10639 2014-12-29 21:35 watermark.py
文件 120910 2014-12-29 19:48 image\text.png
文件 190 2014-12-20 20:33 mark\mark.png
目录 0 2015-01-11 15:16 watermarked
目录 0 2014-12-29 20:04 image
目录 0 2014-12-22 15:13 mark
----------- --------- ---------- ----- ----
131739 6
- 上一篇:仿真3D版本.py
- 下一篇:用tkinter实线图片拖动
相关资源
- python+ selenium教程
- PycURL(Windows7/Win32)Python2.7安装包 P
- 英文原版-Scientific Computing with Python
- 7.图像风格迁移 基于深度学习 pyt
- 基于Python的学生管理系统
- A Byte of Python(简明Python教程)(第
- Python实例174946
- Python 人脸识别
- Python 人事管理系统
- 基于python-flask的个人博客系统
- 计算机视觉应用开发流程
- python 调用sftp断点续传文件
- python socket游戏
- 基于Python爬虫爬取天气预报信息
- python函数编程和讲解
- Python开发的个人博客
- 基于python的三层神经网络模型搭建
- python实现自动操作windows应用
- python人脸识别(opencv)
- python 绘图(方形、线条、圆形)
- python疫情卡UN管控
- python 连连看小游戏源码
- 基于PyQt5的视频播放器设计
- 一个简单的python爬虫
- csv文件行列转换python实现代码
- Python操作Mysql教程手册
- Python Machine Learning Case Studies
- python获取硬件信息
- 量化交易(附python常见函数的使用方
- python 名字用字排行
评论
共有 条评论