1.Bring the image to frequency domain by applying the DCT
2.generate a watermark signal
3.Use the thousand largest coefficients of the original image to embed a watermark sequence of length 1000.
4.Coefficients are modified according to the stream bits of the message using the equation below,
|CAW = CA (1 + α Wi)|
5.Extraction process – simply subtracting the original DCT coefficients from the watermarked image coefficients
function WM_plot(r,c,ext_wm,orig_wm)
for k=1:1000
wm=randn(r,c);%depending on the size of the watermark
wm=uint8(wm);%if necessary
store(k)=WM_detect(ext_wm,wm);%wrong watermarks
if k == 400
store(k)=WM_detect(ext_wm,orig_wm);%original watermark detection
end
end
figure(1),plot(1:k,[store]),ylabel('Watermark detector response'),xlabel('random watermarks');
hold on
%threshold calculation
[peak,ind]=sort(store,'descend');
threshold=peak(2)+(peak(2)*0.1);%T=second highest peak+10percentof the same
figure(1),plot(1:1000,[threshold],'red');
hold on
figure(1),plot(1:1000,peak(2),'green');