1.算法运行效果图预览
灰度图
彩色图
2.算法运行软件版本
matlab2022a
3.算法理论概述
双重水印嵌入算法涉及两个独立的水印:主水印和辅水印,它们可以是灰度图像、二进制序列或其他形式的数据。以下简述嵌入过程:
图像预处理:将彩色图像从RGB空间转换至YCbCr或YIQ等色彩空间,仅对亮度分量(如Y分量)进行水印嵌入,以减少对颜色信息的影响。
图像分割:将亮度分量图像分割成若干个非重叠的M×N大小的子块。
DCT变换:对每个子块进行二维DCT变换,得到DCT系数矩阵。
具体的算法流程图如下所示:
第一重水印:
第二重水印:
4.部分核心程序
%基于论文的双重水印算法嵌入
%第1重
%设置嵌入强度
Power = 20;
%设置块的大小
Blksize = 8;
%改变水印大小,如果太大,则没法全部插入
RR = 32;
CC = 32;
%第1重
mwk_image1r = func_wk_insert_first(I0r,Marks1r,Power,Blksize,RR,CC);
mwk_image1g = func_wk_insert_first(I0g,Marks1g,Power,Blksize,RR,CC);
mwk_image1b = func_wk_insert_first(I0b,Marks1b,Power,Blksize,RR,CC);
%第2重
mwk_image2r = func_wk_insert_second(mwk_image1r,Marks2r,Power,Blksize,RR,CC);
mwk_image2g = func_wk_insert_second(mwk_image1g,Marks2g,Power,Blksize,RR,CC);
mwk_image2b = func_wk_insert_second(mwk_image1b,Marks2b,Power,Blksize,RR,CC);
%%---------------------------------------------------------------------------------------
%增加攻击
noise0 = 1*randn(size(mwk_image1r));
mwk_image2r = double(mwk_image2r) + noise0;
mwk_image2g = double(mwk_image2g) + noise0;
mwk_image2b = double(mwk_image2b) + noise0;
mwk_image(:,:,1) = mwk_image2r;
mwk_image(:,:,2) = mwk_image2g;
mwk_image(:,:,3) = mwk_image2b;
Msg1r = func_wk_desert_first(mwk_image2r,Blksize,RR,CC,0.8);
Msg1g = func_wk_desert_first(mwk_image2g,Blksize,RR,CC,0.8);
Msg1b = func_wk_desert_first(mwk_image2b,Blksize,RR,CC,0.8);
Msg1(:,:,1) = Msg1r;
Msg1(:,:,2) = Msg1g;
Msg1(:,:,3) = Msg1b;
Msg2r = func_wk_desert_second(mwk_image2r,Blksize,RR,CC,2.2);
Msg2g = func_wk_desert_second(mwk_image2g,Blksize,RR,CC,2.2);
Msg2b = func_wk_desert_second(mwk_image2b,Blksize,RR,CC,2.2);
Msg2(:,:,1) = Msg2r;
Msg2(:,:,2) = Msg2g;
Msg2(:,:,3) = Msg2b;
figure(1)
subplot(231);
imshow(I0,[]);
title('原始图像');
subplot(232);
imshow(I1,[]);
title('第一重水印');
subplot(233);
imshow(I2,[]);
title('第二重水印');
subplot(234);
imshow(uint8(mwk_image));
title('加入旋转攻击和噪声攻击的图像');
subplot(235);
imshow(uint8(Msg1));
title('第一重水印提取');
subplot(236);
imshow(uint8(Msg2));
title('第二重水印提取');