当前位置:网站首页>Chapter 25 digital watermarking technology based on Wavelet Transform
Chapter 25 digital watermarking technology based on Wavelet Transform
2022-06-22 02:09:00 【Haibao 7】
Deep learning machine learning image processing matlab Project practical case series
Digital watermarking technology based on wavelet transform
Digital watermarking technology
As an effective multimedia copyright protection technology, it has attracted more and more attention . An image digital watermarking algorithm based on wavelet transform is proposed . According to human visual characteristics , The digital watermark information is embedded into the high-frequency subband texture region of the image after wavelet transform , It's hard for the human eye to detect , Then the embedded watermark is extracted from the watermarked image and the original image .
Wavelet transform
Wavelet transform (wavelet transform,WT) It is a new transformation analysis method , It inherits and develops the idea of STFT localization , At the same time, it overcomes the disadvantage that the window size does not change with frequency , Can provide a frequency dependent “ Time - frequency ” window , It is an ideal tool for signal time-frequency analysis and processing . Its main feature is that it can fully highlight the characteristics of some aspects of the problem through transformation , To be able to ( Space ) Localized analysis of frequency , Through the expansion and translation operation on the signal ( function ) Step by step multi-scale refinement , Finally, time subdivision at high frequency , Frequency subdivision at low frequencies , It can automatically adapt to the requirements of time-frequency signal analysis , So that any detail of the signal can be focused , It's solved Fourier The difficult problem of transformation , To become a successor Fourier A major breakthrough in scientific methods since the transformation .
Wavelet transform is related to applied mathematics 、 physics 、 Computer science 、 Signal and information processing 、 Image processing and other methods . This method also inherits and develops the idea of short-time Fourier transform localization , At the same time, it overcomes the disadvantage that the window size does not change with frequency , Can provide a frequency dependent “ Time - frequency ” window , It is an ideal tool for signal time-frequency analysis and processing . Its main feature is that it can fully highlight the characteristics of some aspects of the problem through transformation , therefore , Wavelet transform has been successfully applied in many fields , In particular, the discrete digital algorithm of wavelet transform has been widely used in the transformation research of many problems .
Function and file directory

Effect display :

For the main function
main.m
close all
I = imread('office_5.jpg');
I = rgb2gray(I);
W = imread('logo.tif');
W=W(12:91,17:96);
figure('Name',' Carrier image ')
imshow(I);
title(' Carrier image ')
figure('Name',' Watermark image ')
imshow(W);
title(' Watermark image ')
ntimes=23;
rngseed=59433;
flag=1;
[Iw,psnr]=setdwtwatermark(I,W,ntimes,rngseed,0);
[Wg,nc]=getdwtwatermark(Iw,W,ntimes,rngseed,0);
close all
action={
'filter','resize','crop','noise','rotate'};
for i=1:numel(action)
dwtwatermarkattack(action{
i},Iw,W,ntimes,rngseed);
end
Watermark function 1
function [Wg,nc]=getdwtwatermark(Iw,W,ntimes,rngseed,flag)
[mW,nW]=size(W);
if mW~=nW
error('GETDWTWATERMARK:ARNOLD','ARNOLD Scrambling requires that the length and width of the watermark image must be equal !')
end
Iw=double(Iw);
W=logical(W);
ca1w=dwt2(Iw,'haar');
ca2w=dwt2(ca1w,'haar');
Wa=W;
rng(rngseed);
idx=randperm(numel(ca2w),numel(Wa));
for i=1:numel(Wa)
c=ca2w(idx(i));
z=mod(c,nW);
if z<nW/2
Wa(i)=0;
else
Wa(i)=1;
end
end
Wg=Wa;
H=[2 -1;-1,1]^ntimes;
for i=1:nW
for j=1:nW
idx=mod(H*[i-1;j-1],nW)+1;
Wg(idx(1),idx(2))=Wa(i,j);
end
end
nc=sum(Wg(:).*W(:))/sqrt(sum(Wg(:).^2))/sqrt(sum(W(:).^2));
if flag
figure('Name',' Digital watermark extraction results ')
subplot(121)
imshow(W)
title(' Original watermark ')
subplot(122)
imshow(Wg)
title([' Extracting watermark ,NC=',num2str(nc)]);
end
Watermark function
function dwtwatermarkattack(action,Iw,W,ntimes,rngseed)
switch lower(action)
case 'filter'
Ia=imfilter(Iw,ones(3)/9);
case 'resize'
Ia=imresize(Iw,0.5);
Ia=imresize(Ia,2);
case 'noise'
Ia=imnoise(Iw,'salt & pepper',0.01);
case 'crop'
Ia=Iw;
Ia(50:400,50:400)=randn();
case 'rotate'
Ia=imrotate(Iw,45,'nearest','crop');
Ia=imrotate(Ia,-45,'nearest','crop');
end
[Wg,nc]=getdwtwatermark(Ia,W,ntimes,rngseed,0);
figure('Name',[' Digital watermark ',upper(action),' Attack test '],'Position',[287,108,943,557]);
subplot(221)
imshow(Iw)
title(' Embedded watermark image ')
subplot(222)
imshow(Ia)
title([' Suffer ',upper(action), ' attack '])
subplot(223)
imshow(W)
title(' Original watermark image ')
subplot(224)
imshow(Wg)
title([' Extracting watermark ,NC=',num2str(nc)]);
Watermark processing function
function [Iw,psnr]=setdwtwatermark(I,W,ntimes,rngseed,flag)
type=class(I);
I=double(I);
W=logical(W);
[mI,nI]=size(I);
[mW,nW]=size(W);
if mW~=nW
error('SETDWTWATERMARK:ARNOLD','ARNOLD Scrambling requires that the length and width of the watermark image must be equal !')
end
[ca1,ch1,cv1,cd1]=dwt2(I,'haar');
[ca2,ch2,cv2,cd2]=dwt2(ca1,'haar');
if flag
figure('Name',' Carrier wavelet decomposition ')
subplot(121)
imagesc([wcodemat(ca1),wcodemat(ch1);wcodemat(cv1),wcodemat(cd1)])
title(' First level wavelet decomposition ')
subplot(122)
imagesc([wcodemat(ca2),wcodemat(ch2);wcodemat(cv2),wcodemat(cd2)])
title(' Two level wavelet decomposition ')
end
Wa=W;
H=[1,1;1,2]^ntimes;
for i=1:nW
for j=1:nW
idx=mod(H*[i-1;j-1],nW)+1;
Wa(idx(1),idx(2))=W(i,j);
end
end
if flag
figure('Name',' Watermark scrambling effect ')
subplot(121)
imshow(W)
title(' Original watermark ')
subplot(122)
imshow(Wa)
title([' Scrambling watermark , Transformation Times =',num2str(ntimes)]);
end
ca2w=ca2;
rng(rngseed);
idx=randperm(numel(ca2),numel(Wa));
for i=1:numel(Wa)
c=ca2(idx(i));
z=mod(c,nW);
if Wa(i)
if z<nW/4
f=c-nW/4-z;
else
f=c+nW*3/4-z;
end
else
if z<nW*3/4
f=c+nW/4-z;
else
f=c+nW*5/4-z;
end
end
ca2w(idx(i))=f;
end
ca1w=idwt2(ca2w,ch2,cv2,cd2,'haar');
Iw=idwt2(ca1w,ch1,cv1,cd1,'haar');
Iw=Iw(1:mI,1:nI);
mn=numel(I);
Imax=max(I(:));
psnr=10*log10(mn*Imax^2/sum((I(:)-Iw(:)).^2));
I=cast(I,type);
Iw=cast(Iw,type);
if flag
figure('Name',' Embedded watermark image ')
subplot(121)
imshow(I);
title(' original image ')
subplot(122);
imshow(Iw);
title([' Add watermark ,PSNR=',num2str(psnr)]);
end
Mainly the addition of watermark 、 Get and process related . Embedded development .hhh


This article is a complete set The source code file –—> Portal
边栏推荐
- Chapter 18 build a general video processing tool based on GUI matlab application GUI implementation
- 稳扎稳打学爬虫08—Selenium的使用方法详解
- Google Earth engine (GEE) - line chart of time series image combining VCI index and TCI temperature (Guatemala and El Salvador as examples)
- SQL Server recursive query
- Individual problem solution of the 298th round of force deduction
- 剑指offer 26:树的子结构
- Appium interview questions
- cmake常用命令分类备忘
- 微信小程序影视评论交流平台系统毕业设计毕设(3)后台功能
- 博途PLC和CODESYS平台下FB编程(如何实现100路FB循环遍历执行)
猜你喜欢

Atguigu---- filter

微信小程序影视评论交流平台系统毕业设计毕设(2)小程序功能

Android使用SQL数据库进行登录功能时报错Attempt to invoke virtual method ' ' on a null object reference

Lianfa science and technology -- Introduction to Lianfa science and technology ++ attached

Wechat applet film and television review and exchange platform system graduation design completion (8) graduation design thesis template

atguigu----过滤器

Chapter 18 build a general video processing tool based on GUI matlab application GUI implementation

excel常用快捷鍵excel快捷鍵匯總

Test APK exception control sensor attacker development

Games-101 personal summary rasterization
随机推荐
Atguigu---- filter
FB programming under botu PLC and CoDeSys platform (how to realize 100 channel FB cycle traversal execution)
Mysql database easy to learn 07 - select statement writing order and execution order
excel常用快捷键excel快捷键汇总
[chapter 07 face QR code recognition based on principal component analysis matlab deep learning practical case]
excel常用快捷键excel快捷键汇总
LeetCode 513 找树左下角的值[BFS 二叉树] HERODING的LeetCode之路
[chapter 01 image defogging technology based on histogram optimization - full system matlab intelligent driving depth learning]
New employees enter the company and learn about work information
Idea ---- copy and paste
微信小程序影视评论交流平台系统毕业设计毕设(1)开发概要
idea----bookmark
AHA C language Chapter 5 the good play is later (Lecture 24-25)
Five strokes first lesson fingering
Right alignment of MathType formula right number in word
[Chapter 20 video target detection based on inter frame difference method -- Application of MATLAB software in-depth learning]
Mba-day23 at most at least questions - exercises
快速学会CAD绘制传输线路图纸
Courses learned
acwing 837. Number of points in connected blocks (additional information maintained by querying sets - number of sets)