This action might not be possible to undo. Are you sure you want to continue?

# Wavelet Domain Image Watermarking

This 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 useful advices on digital image watermarking.

**Installing toolboxes and setting up the path.
**

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

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 for instance 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

Note also that we perform here "0 bit" watermarking. etc). adding noise. Here we bench a wavelet method for the embedding of a single watermark. we do not embed a meaningful message within the watermarking. One can also visit the BOWS-2 challenge homepage for a state of the art digital watermarking implementation. It requires to embed a signature into a sound. This is somehow conflicting goals since impercevable information is likely to be removed by an efficient compression or denoising algorithm.e. blurring. getd('toolbox_signal/'). video.Then you can add the toolboxes to the path. 3D mesh. image. Cox. 2nd Ed. We are only interested in testing the presence of a given watermark. etc. An efficient watermarking scheme should thus use more clever tools than state of the art denoising/compression algorithms. Miller. Matthew L. Ingemar J. denoising.e. An good source of information regarding digital watermarking is the book Digital Watermarking and Steganography. i. the goal is to embed a watermark that is both impercevable and difficult to remove (by attack such as compression. Digital Image Watermarking Digital media watermarking is a popular image forensic problem. We consider here a robust watermarking embedding. getd('toolbox_general/'). We check how much the watermark can be detected after various attack. Jeffrey Bloom. 2007. Depending on a probability of . i. Morgan Kaufmann.

This also increases the robustness to denoising and compression attacks.3)). imageplot(f). Load an image of pixels. . n = 256. The weighting of the watermark vector takes into account the amplitude of the host coefficient in order to reduce visual distortion. Display the original image.false alarm. Watermark Embedding A watermark is computed as a weighted random vector that is added to the wavelet coefficient. we compute the probability of detecting the watermark. n). clf. name = 'hibiscus'. f = rescale(sum(f. f = load_image(name.

Shortcut for the wavelet transform that maps an image to wavelet coefficients . a = Psi(f). +1).Jmin). -1). . Display the wavelet coefficients. Psi = @(f)perform_wavelet_transf(f. Jmin = log2(n)-2. We note its inverse using the shortcut PsiS. Compute the wavelet coefficients. plot_wavelet(a. Jmin. Jmin. PsiS = @(a)perform_wavelet_transf(a. clf.

Extract the coefficients . x0 = a(I). where .1).1:2^Jmin) = 0. I = find(A(:)).The coefficients to be watermarked is only a subset of the total set of coefficients. psnr_embedding = 50. Target embedding PSNR (should be quite large for the embedding to be unoticeable). . w = randn(P. A = ones(n). 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. P = length(I). A(1:2^Jmin. Generate the base watermark vector . We select here only the fine scale wavelets.

x0. delta = f-f1.3) ). Given the watermarked coefficients .x0) = 50dB.x0. for which PSNR the watermark becomes unoticeable? exo2. is exo1.m) According to you. clf. f1 = PsiS(a1). a watermarked image is reconstructed using the inverse wavelet transform as Compute the image with the watermark embedded. Display the watermark over the spacial domain (with contrast boosting). disp(['PSNR(x.*w. Perform the embedding .1)=snr_embedding. imageplot( clamp(delta/std(delta(:)).-3. PSNR(x. a1(I) = x.x0) = ' num2str(psnr(x. a1 = a. rho = 0.']). 3) 'dB. .Exercice 1: (the solution that PSNR(y. The distortion of the embedding is measured using the PSNR Check the PSNR of embedding.1).m) Compute rho so Exercice 2: (the solution is exo2. exo1.0785. x = x0 + rho*abs(x0).

The detection is carried over by a simple thresholding.Watermark Detection The watermark is detected (or not detected) from an input vector using a detector function where is the base watermark vector. The detection corresponds to an hypothesis testing.e. and one has the following alternative depending on wether the content is watermarked or not: The two important quantities to monitor is the probability of false alarms . Usually. ratio of contents declared to be watermarked whereas they were not watermarked). One assumes that is obtained by attacking some vector . and the watermark is declared to be present if where is a threshold that should be set to guarantee a given probability of false alarms (i. a large value of means that is likely to come from a watermarked content.

Under this assumption. The goal is to design a watermarking scheme (i. one has where is the cumulative density function of the Gaussian of variance . We make another approximation : we approximate this density probability with a Gaussian density of mean 0 and variance .^2). Compute the variance of this distribution. we make the asumption that is close enough to to estimate on the clean original signal Exercice 3: (the solution is exo3. The simplest detector is a normalized correlation C = @(y. To estimate easily the probability of false alarm.*y). an embedding strategy and a detection strategy) in order to maximize for a given ./sqrt( sum(w.e.w)sum(w.^2) ). exo3.m) Using a Monte Carlo simulation (generation of the order of watermarks. display the histogram of the repartition of . .*sum(y.and the probability of true positives Note that here refers to the probability of an event with respect to the randomization of .

Quantization Attack A compression attack is simulated by quantizing the wavelet coefficients.m) Compare. A(t)). tau = . Quant = @(x)floor(abs(x/tau)). the more aggressive the A quantization attack reads: Quantization/Dequantization operators. T = sqrt(2)/2 * sigma0 * erfinv(1-2*pfa). A = @(x)DeQuant(Quant(x)). it is possible to compute exactly this probability of false alarm as where is the incomplete beta function (use betainc function) and is the dimension. We consider here a dead zone quantization attack.Hence one can use the threshold This is an example of determination of threshold given a value of . larger. axis('equal').2.*sign(x).* (abs(v)+. pfa = 1e-3. exo4.5) * tau. Exercice 4: (the solution is exo4. for various values of the estimation obtained by the Gaussian approximation with the true value obtained with the incomplete beta function. and attack operator. Display it. .500). Actually. Quantization step (the compression. DeQuant = @(v)sign(v) . t = linspace(-2. plot(t.2.

. imageplot(clamp(f1)). Display the watermarked image. clf.Attacked watermarked signal y = A(x). a1 = a. a1(I) = y. Display the attacked image. f1 = PsiS(a1).

e. exo5. The probability of true positive is Exercice 5: (the solution is exo5.w) = 0.w). Note: the value of should be recomputed for each .w) = ' num2str(C(y. C(y.']).Compute the detection .015. Store the different realization of in a vector c. 2) '. draw at random many ) the distribution of for . .m) Compute. by Monte Carlo sampling (i. disp(['C(y.

Exercice 6: (the solution is exo6.m) Compute. for a varying value of . the corresponding value of . Display the resulting curve (ROC curve). 1000 random sampling.g. This computation should be performed experimentally using e. exo6. .

m) Try different attack strengths.Exercice 7: (the solution is exo7. exo8. determine the value of for witch drops bellow . For a . for instance on the image itself (blurring. Copyright (c) 2010 Gabriel Peyre .). Exercice 8: (the solution is exo8. denoising. etc.m) Try different attacks. by changing the value of . exo7.