我在
fw=D_w((IND(k,1),IND(k,2));
and W2(k)= ((D_w(IND(k,1),IND(k,2))/D(IND(k,1),IND(k,2))-1)*10)
水印提取过程有问题,最后的代码有错误。任何建议。请在其中进行一些修改。
所以,我们必须保护它不被泄露,这样他们就不会接触到错误的人。我们必须找到负责数据泄露的人。如果在公共领域发现分发给第三方的数据,则可能对公司所有者造成非常严重的威胁。
I=imread('girl512.bmp');
subplot(2,3,1),imshow(I,[]),title('Original Image');
wmsz=1000;
I=I(:,:,1);
[r,c]=size(I);
D=dct2(I);
D_vec=reshape(D,1,r*c);
[D_vec_srt,Idx]=sort(abs(D_vec),'descend');
W=randn(1,wmsz);
subplot(2,3,2),plot(W),title('Watermark');
Idx2=Idx(2:wmsz+1);%choosing 1000 biggest values other than the DC
%finding associated row-column order for vector values
IND=zeros(wmsz,2);
for k=1:wmsz
x=floor(Idx2(k)/r)+1;%associated column in the image
y=mod(Idx2(k),r);%associated row in the image
IND(k,1)=y;
IND(k,2)=x;
end
D_w=D;
%WATERMARK EMBEDDING
for k=1:wmsz
fw=D_w((IND(k,1),IND(k,2));
fw=fw+0.1*fw.*W(k);
end
I2=idct2(D_w);%inverse DCT to produce the watermarked asset
I2_int=uint8(I2);
imwrite(I2_int,'I2_watermarkedn.bmp','bmp');
subplot(2,3,3),imshow('I2_watermarkedn.bmp'),title('Watermarked Image');
%WATERMARK EXTRACTION
W2=[];
for k=1:wmsz
W2(k)=((D_w(IND(k,1),IND(k,2))/D(IND(k,1),IND(k,2))-1)*10);
end
subplot(2,3,4),plot(W2),title('Extracted Watermark');