-3

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');  
Community
  • 1
  • 1

1 Answers1

2

The error «Function definitions are not permitted at the prompt or in scripts» — tells you that you trying to define function in a wrong place. According to the similar question at matlab answers, you should :

Write each function in an editor file and save it as the title of function, e.g:

function hello_world(hObject,evt)
  fprintf(2,'Hello World!');
end

saved in hello_world.m

and after that you should call your functions from your main application.

Igor Milla
  • 2,767
  • 4
  • 36
  • 44