wave let domain image water marking

Upload: georgianp-giurgea

Post on 14-Apr-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Wave Let Domain Image Water Marking

    1/13

    Wavelet Domain Image

    WatermarkingThis numerical tour explores robust watermarking over the wavelet domain.

    Contents

    Installing toolboxes and setting up the path.

    Digital Image Watermarking

    Watermark Embedding

    Watermark Detection

    Quantization Attack

    Many thanks to Patrick Bas and Teddy Furon for their usefuladvices on digital image watermarking.

    Installing toolboxes and setting up the

    path.

    You need to download the following files: signaltoolbox and general toolbox.

    You need to unzip these toolboxes in your working directory,so that you havetoolbox_signal and toolbox_general in your

    directory.

    For Scilab user: you must replace the Matlab comment '%'by its Scilab counterpart '//'.

    Recommandation: You should create a text file named forinstance numericaltour.sce (in Scilab) or numericaltour.m (in Matlab)

    to write all the Scilab/Matlab command you want to execute.Then, simply run exec('numericaltour.sce'); (in Scilab)

    or numericaltour; (in Matlab) to run the commands.

    Execute this line only if you are using Matlab.

    getd = @(p)path(p,path); % scilab users must *not* execute this

    http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/coding_5_watermarking/#2http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/coding_5_watermarking/#9http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/coding_5_watermarking/#17http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/coding_5_watermarking/#38http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/coding_5_watermarking/#50http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/toolbox_signal.ziphttp://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/toolbox_signal.ziphttp://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/toolbox_general.ziphttp://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/coding_5_watermarking/#2http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/coding_5_watermarking/#9http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/coding_5_watermarking/#17http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/coding_5_watermarking/#38http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/coding_5_watermarking/#50http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/toolbox_signal.ziphttp://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/toolbox_signal.ziphttp://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/toolbox_general.zip
  • 7/30/2019 Wave Let Domain Image Water Marking

    2/13

    Then you can add the toolboxes to the path.

    getd('toolbox_signal/');getd('toolbox_general/');

    Digital Image WatermarkingDigital media watermarking is a popular image forensicproblem. It requires to embed a signature into a sound, image,video, 3D mesh, etc.

    An good source of information regarding digital watermarkingis the book

    Digital Watermarking and Steganography, 2nd Ed, Ingemar J.Cox, Matthew L. Miller, Jeffrey Bloom, Morgan Kaufmann,2007.

    One can also visit the BOWS-2 challenge homepage for a stateof the art digital watermarking implementation.

    We consider here a robust watermarking embedding, i.e. thegoal is to embed a watermark that is both impercevable anddifficult to remove (by attack such as compression, denoising,

    adding noise, blurring, etc).

    This is somehow conflicting goals since impercevableinformation is likely to be removed by an efficient compressionor denoising algorithm. An efficient watermarking schemeshould thus use more clever tools than state of the artdenoising/compression algorithms.

    Note also that we perform here "0 bit" watermarking, i.e. wedo not embed a meaningful message within the watermarking.

    We are only interested in testing the presence of a givenwatermark.

    Here we bench a wavelet method for the embedding of asingle watermark. We check how much the watermark can bedetected after various attack. Depending on a probability of

    http://bows2.gipsa-lab.inpg.fr/http://bows2.gipsa-lab.inpg.fr/
  • 7/30/2019 Wave Let Domain Image Water Marking

    3/13

    false alarm, we compute the probability of detecting thewatermark.

    Watermark Embedding

    A watermark is computed as a weighted random vector that isadded to the wavelet coefficient.

    The weighting of the watermark vector takes into account theamplitude of the host coefficient in order to reduce visualdistortion. This also increases the robustness to denoising andcompression attacks.

    Load an image of pixels.

    n = 256;name = 'hibiscus';f = load_image(name, n);f = rescale(sum(f,3));

    Display the original image.

    clf;imageplot(f);

  • 7/30/2019 Wave Let Domain Image Water Marking

    4/13

    Shortcut for the wavelet transform that maps an image towavelet coefficients . We note its inverse using theshortcut PsiS.Jmin = log2(n)-2;Psi = @(f)perform_wavelet_transf(f, Jmin, +1);PsiS = @(a)perform_wavelet_transf(a, Jmin, -1);

    Compute the wavelet coefficients.

    a = Psi(f);

    Display the wavelet coefficients.

    clf;

    plot_wavelet(a,Jmin);

  • 7/30/2019 Wave Let Domain Image Water Marking

    5/13

    The coefficients to be watermarked is only a subset of thetotal set of coefficients, where .

    We select here only the fine scale wavelets.

    A = ones(n); A(1:2^Jmin,1:2^Jmin) = 0;I = find(A(:));P = length(I);

    Extract the coefficients .x0 = a(I);

    The watermarking is embedded using a multiplicative rule as

    where is a random Gaussian vector and where is a constant that ensure that is a given

    deviation value.

    Generate the base watermark vector .w = randn(P,1);

    Target embedding PSNR (should be quite large for theembedding to be unoticeable).

    psnr_embedding = 50;

  • 7/30/2019 Wave Let Domain Image Water Marking

    6/13

    Exercice 1: (the solution is exo1.m) Compute rho so

    that PSNR(y,x0,1)=snr_embedding.

    exo1;rho = 0.0785.

    Exercice 2: (the solution is exo2.m) According to you, forwhich PSNR the watermark becomes unoticeable?

    exo2;

    Perform the embedding .x = x0 + rho*abs(x0).*w;

    The distortion of the embedding is measured using the PSNR

    Check the PSNR of embedding.

    disp(['PSNR(x,x0) = ' num2str(psnr(x,x0,1), 3) 'dB.']);PSNR(x,x0) = 50dB.

    Given the watermarked coefficients , a watermarked image isreconstructed using the inverse wavelet transform as

    Compute the image with the watermark embedded.

    a1 = a; a1(I) = x;f1 = PsiS(a1);

    Display the watermark over the spacial domain (with contrastboosting).delta = f-f1;clf;imageplot( clamp(delta/std(delta(:)),-3,3) );

    http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/missing-exo.htmlhttp://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/missing-exo.htmlhttp://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/missing-exo.htmlhttp://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/missing-exo.html
  • 7/30/2019 Wave Let Domain Image Water Marking

    7/13

    Watermark Detection

    The watermark is detected (or not detected) from an input

    vector using a detector function where is the basewatermark vector. Usually, a large value of means that islikely to come from a watermarked content.

    The detection is carried over by a simple thresholding, and thewatermark is declared to be present if

    where is a threshold that should be set to guarantee a given probability of false alarms

    (i.e. ratio of contents declared to be watermarked whereas they were not watermarked).

    The detection corresponds to an hypothesis testing. Oneassumes that is obtained by attacking some vector , and onehas the following alternative depending on wether thecontent is watermarked or not:

    The two important quantities to monitor is the probability offalse alarms

  • 7/30/2019 Wave Let Domain Image Water Marking

    8/13

    and the probability of true positives

    Note that here refers to the probability of an event with respect to the randomization of .

    The goal is to design a watermarking scheme (i.e. anembedding strategy and a detection strategy) in order tomaximize for a given .

    The simplest detector is a normalized correlation

    C = @(y,w)sum(w.*y)./sqrt( sum(w.^2).*sum(y.^2) );

    To estimate easily the probability of false alarm, we make theasumption that is close enough to to estimate on the cleanoriginal signalExercice 3: (the solution is exo3.m) Using a Monte Carlosimulation (generation of the order of watermarks, display thehistogram of the repartition of . Compute the variance of thisdistribution.exo3;

    We make another approximation : we approximate this densityprobability with a Gaussian density of mean 0 and variance .Under this assumption, one haswhere is the cumulative density function of the Gaussian of variance .

    http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/missing-exo.htmlhttp://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/missing-exo.html
  • 7/30/2019 Wave Let Domain Image Water Marking

    9/13

    Hence one can use the threshold

    This is an example of determination of threshold given a value of .pfa = 1e-3;T = sqrt(2)/2 * sigma0 * erfinv(1-2*pfa);

    Actually, it is possible to compute exactly this probability offalse alarm as

    where is the incomplete beta function (use betainc function) and is the dimension.

    Exercice 4: (the solution is exo4.m) Compare, for variousvalues of the estimation obtained by the Gaussianapproximation with the true value obtained with theincomplete beta function.exo4;

    Quantization Attack

    A compression attack is simulated by quantizing the waveletcoefficients. We consider here a dead zone quantization attack.

    Quantization step (the larger, the more aggressive thecompression.tau = .2;

    A quantization attack reads:

    Quantization/Dequantization operators, and attack operator.

    Quant = @(x)floor(abs(x/tau)).*sign(x);DeQuant = @(v)sign(v) .* (abs(v)+.5) * tau;A = @(x)DeQuant(Quant(x));

    Display it.

    t = linspace(-2,2,500);plot(t, A(t));

    axis('equal');

    http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/missing-exo.htmlhttp://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/missing-exo.html
  • 7/30/2019 Wave Let Domain Image Water Marking

    10/13

    Attacked watermarked signal

    y = A(x);

    Display the attacked image.

    a1 = a; a1(I) = y;f1 = PsiS(a1);

    Display the watermarked image.

    clf;imageplot(clamp(f1));

  • 7/30/2019 Wave Let Domain Image Water Marking

    11/13

    Compute the detection .disp(['C(y,w) = ' num2str(C(y,w), 2) '.']);C(y,w) = 0.015.

    The probability of true positive is

    Exercice 5: (the solution is exo5.m) Compute, by Monte Carlosampling (i.e. draw at random many ) the distribution of for .Store the different realization of in a vector c. Note: the value

    of should be recomputed for each .exo5;

    http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/missing-exo.htmlhttp://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/missing-exo.html
  • 7/30/2019 Wave Let Domain Image Water Marking

    12/13

    Exercice 6: (the solution is exo6.m) Compute, for a varyingvalue of , the corresponding value of . Display the resultingcurve (ROC curve). This computation should be performedexperimentally using e.g. 1000 random sampling.exo6;

    http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/missing-exo.htmlhttp://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/missing-exo.html
  • 7/30/2019 Wave Let Domain Image Water Marking

    13/13

    Exercice 7: (the solution is exo7.m) Try different attackstrengths, by changing the value of . For a , determine thevalue of for witch drops bellow .exo7;

    Exercice 8: (the solution is exo8.m) Try different attacks, forinstance on the image itself (blurring, denoising, etc.).

    exo8;

    Copyright (c) 2010 Gabriel Peyre

    http://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/missing-exo.htmlhttp://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/missing-exo.htmlhttp://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/missing-exo.htmlhttp://www.ceremade.dauphine.fr/~peyre/numerical-tour/tours/missing-exo.html