一个基于DCT的水印嵌入程序,请问大家怎么提取水印啊?
请大家帮忙,不知怎么提取出水印信息,我是刚学习这个,谢谢大家!I=imread('14.jpg');
I=rgb2gray(I);
%disp(I);
I=double(I)/255;
%disp(I);
I1=ceil(I);
%%%%%%%%%%显示水印图像%%%%%%%%%%%%%
figure(1);
subplot(2,3,1);
imshow(I1),title('水印图像')
dimI=size(I1);
rm=dimI(1);
cm=dimI(2);
%%%%%%%%%%%%%%%5以下生成水印信息 %%
mark=I1;
alpha=50,
k1=randn(1,8);
k2=randn(1,8);
a0=imread('17.jpg');
a0=rgb2gray(a0);
%disp(a0);
%a0=double(a0)/255;
%disp(a0);
psnr_cover=double(a0);
subplot(2,3,2),imshow(a0,[]),title('载体图像');
=size(a0);
cda0=blkproc(a0,,'dct2');
%%%%%%%%%%%%%%%%%%%%% 嵌入 %%%%%%%%%%
cda1=cda0; % cda1 = 256_256
for i=1:32 % i=1:32
for j=1:32% j=1:32
x=(i-1)*8;y=(j-1)*8;
if mark(i,j)==1
k=k1;
else
k=k2;
end
cda1(x+1,y+8)=cda0(x+1,y+8)+alpha*k(1);
cda1(x+2,y+7)=cda0(x+2,y+7)+alpha*k(2);
cda1(x+3,y+6)=cda0(x+3,y+6)+alpha*k(3);
cda1(x+4,y+5)=cda0(x+4,y+5)+alpha*k(4);
cda1(x+5,y+4)=cda0(x+5,y+4)+alpha*k(5);
cda1(x+6,y+3)=cda0(x+6,y+3)+alpha*k(6);
cda1(x+7,y+2)=cda0(x+7,y+2)+alpha*k(7);
cda1(x+8,y+1)=cda0(x+8,y+1)+alpha*k(8);
end
end
%%%%% 嵌入水印后图像 %%%%%%%%%%%%%%
a1=blkproc(cda1,,'idct2');
a_1=uint8(a1);
subplot(2,3,3),imshow(a_1,[]),title('嵌入水印后的图像');
页:
[1]