view manual.lyx @ 0:be303a3f5ea8

import
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Sun, 12 Aug 2007 13:14:34 +0200
parents
children acb6967ee76d
line wrap: on
line source

#LyX 1.1 created this file. For more info see http://www.lyx.org/
\lyxformat 218
\textclass paper
\language english
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\spacing single 
\papersize Default
\paperpackage a4
\use_geometry 0
\use_amsmath 0
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation skip
\defskip smallskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default

\layout Title

Watermarking Source Code
\layout SubTitle

version 0.4
\layout Author

Peter Meerwald
\layout Address

Dept.
 of Scientific Computing, University of Salzburg
\newline 
Jakob-Haringer-Str.
 2, A-5020 Salzburg, Austria
\newline 

\begin_inset LatexCommand \url{mailto:pmeerw@cosy.sbg.ac.at}

\end_inset 


\newline 

\begin_inset LatexCommand \url{http://www.cosy.sbg.ac.at/~pmeerw/Watermarking}

\end_inset 


\layout Abstract

This package provides source code for some watermarking algorithms in hopefully
 portable C code.
 The programs can be used to study watermarking techniques, perform comparative
 robustness tests and develop new attacks against embedded watermarks.
\layout Abstract

However, the provided programs are by no means suitable for real-world applicati
on (i.e.
 copyright protection) and the code solely serves some educational purpose.
\layout Standard


\begin_inset LatexCommand \tableofcontents{}

\end_inset 


\layout Section

Introduction
\layout Standard

Academic research in the watermarking field has grown dramatically since
 approximately 1995.
 But surprisingly, source code for the proposed watermarking schemes has
 not been made available.
 The reason is most likely the security of many watermarking systems lies
 at least to some extent in the embedding and detection algorithm itself,
 and not in the keys used -- violating the Kerckhoff principle 
\begin_inset LatexCommand \cite{Kerckhoff1883a}

\end_inset 

.
\layout Standard

With the availability of public robustness test for watermarking algorithms,
 StirMark 
\begin_inset LatexCommand \cite{Petitcolas99c, Petitcolas98b, Petitcolas98a}

\end_inset 

, Unzign
\begin_float footnote 
\layout Standard


\begin_inset LatexCommand \url{http://www.altern.org/watermark}

\end_inset 


\end_float 
 and very recently Checkmark
\begin_inset LatexCommand \cite{Pereira01b}

\end_inset 

, the situation begins to improve.
 Now it is possible to measure the performance of watermarking systems.
 
\layout Standard

In order the compare and evaluate new embedding and detection techniques,
 it is also necessary to have some reference implementations of the older,
 now often called classical schemes.
 In this work, we provide some implementations of watermarking schemes,
 some of which can be considered 'classical'.
\layout Standard

It was the goal to capture the main ideas of the proposed algorithms, as
 layed out in the respective papers.
 This is clearly not an easy task as some papers do not disclose all details
 or state which particular parameters were used to obtain the results outlined
 in the communications.
\layout Standard

I am very interested in hearing your comments, complaints and suggestions
 regarding this software.
 Moreover, if you have source code for a watermarking scheme not yet covered
 or some useful utility I would be happy to include your code in this distributi
on.
 Please see the contact information at the top of this document.
\layout Standard

If you use the accompanying code, please cite my thesis:
\layout Quotation

Peter Meerwald, Digital Image Watermarking in the Wavelet Transform Domain,
 Master's Thesis, Department of Scientific Computing, University of Salzburg,
 Austria, January 2001.
\layout Section

Software
\layout Standard

Most of the software provided herein was written by myself, as part of my
 Master thesis.
 Some contributions were made by Vassilis Fotopoulos
\begin_float footnote 
\layout Standard


\begin_inset LatexCommand \url{mailto:vfotop1@physics.upatras.gr}

\end_inset 


\end_float 
.
 The software in the archive is organized in the following sub-directories:
\layout Description

Fotopoulos/ contains contributions by Vassilis Fotopoulos
\layout Description

Meerwald/ contains my work
\layout Description

images/ contains the Lena image in PGM format; the default parameters of
 most algorithms are tuned to work best with that image
\layout Description

linux_bin/ the place where the Linux executables are stored in the binary
 distribution
\layout Description

win32_bin/ the place where Windows 32-bit executables are distributed; tested
 with Windows NT 4.0 only
\layout Description

make/ contains the 
\family typewriter 
\size small 
Makefile
\family default 
\size default 
 options to build the code on supported platforms
\layout Standard

For the purpose of this software package, a watermarking system comprises
 four parts, namely: signature generation, watermark embedding, watermark
 extraction and signature comparison or detection -- with the exception
 of Vassilis's code; there are only cast and test programs (corresponds
 to watermark embedding and detection).
 Signature is used more less as a synonym for mark and can be thought of
 as the payload (at least for some schemes :-).
\layout Standard

All programs only accept the image in NetPBM format and will also produce
 only NetPBM-format files (see section 
\begin_inset LatexCommand \ref{sec:prereq}

\end_inset 

).
 Unfortunately, most programs have only been tested with 8-bit gray-scale
 images of size 
\begin_inset Formula \( 512\times 512. \)
\end_inset 

 
\layout Standard

In order to simplify batch testing, the programs allow to read either from
 a file, e.g.
\layout Standard


\family typewriter 
\size small 
wm_cox_e -s cox.sig 
\series bold 
image.pgm
\layout Standard

or from standard input, i.e.
\layout Standard

wm_cox_e -s cox.sig 
\series bold 
< image.pgm
\layout Standard

The output is usually written to standard output, i.e.
 
\layout Standard


\family typewriter 
\size small 
wm_cox_e -s cox.sig image.pgm 
\series bold 
> wm_image.pgm
\layout Standard

unless redirected to a file, e.g.
\layout Standard


\family typewriter 
\size small 
wm_cox_e -s cox.sig 
\series bold 
-o wm_image.pgm
\series default 
 image.pgm
\layout Subsection

Featured algorithms
\layout Standard

Currently it includes the following watermarking algorithms
\layout Itemize

Bruyndonckx [bruyn], refer to
\layout Quotation

O.
 Bruyndonckx, Jean-Jacques Quisquater, and Benoit M.
 Macq.
 Spatial method for copyright labeling of digital images.
 In IEEE Workshop on Nonlinear Signal and Image Processing '95, Thessaloniki,
 Greece, pages 456 - 459, 1995.
\layout Itemize

Corvi, refer to
\layout Quotation

Marco Corvi and Gianluca Nicchiotti.
 Wavelet-based image watermarking for copyright protection.
 In Scandinavian Conference on Image Analysis SCIA '97, Lappeenranta, Finland,
 June 1997.
\layout Itemize

Cox, refer to
\layout Quotation

Ingemar J.
 Cox, Joe Kilian, Tom Leighton, and Talal G.
 Shamoon.
 Secure spread spectrum watermarking for multimedia.
 In Proceedings of the IEEE ICIP '97, volume 6, pages 1673 - 1687, Santa
 Barbara, California, USA, 1997.
\layout Itemize

Dugad, refer to
\layout Quotation

Rakesh Dugad, Krishna Ratakonda, and Narendra Ahuja.
 A new wavelet-based scheme for watermarking images.
 In Proceedings of the IEEE International Conference on Image Processing,
 ICIP '98, Chicago, IL, USA, October 1998.
 
\layout Itemize

Fridrich (2.
 scheme), refer to
\layout Quotation

Jiri Fridrich.
 Combining low-frequency and spread spectrum watermarking.
 In Proceedings of the SPIE Symposium on Optical Science, Engineering and
 Instrumentation, San Diego, USA, July 1998.
 
\layout Itemize

Kim, refer to 
\layout Quotation

Jong Ryul Kim and Young Shik Moon.
 A robust wavelet-based digital watermark using level-adaptive thresholding.
 In Proceedings of the 6th IEEE International Conference on Image Processing
 ICIP '99, page 202, Kobe, Japan, October 1999.
\layout Itemize

Koch, refer to
\layout Quotation

Eckhard Koch and Jian Zhao.
 Towards robust and hidden image copyright labeling.
 In Proceedings of the IEEE International Workshop on Nonlinear Signal and
 Image Processing, pages 452 - 455, Halkidiki, Marmaras, Greece, June 1995.
\layout Itemize

Wang, refer to
\layout Quotation

Houng-Jyh Wang, Po-Chyi Su, and C.-C.
 Jay Kuo.
 Wavelet-based digital image watermarking.
 Optics Express, volume 3, pp.
 497, December 1998.
 
\layout Itemize

Xia, refer to
\layout Quotation

Xiang-Gen Xia, Charles G.
 Boncelet, and Gonzalo R.
 Arce.
 Wavelet transform based watermark for digital images.
 Optics Express, volume 3, pp.
 497, December 1998.
\layout Itemize

Xie, refer to
\layout Quotation

Liehua Xie and Gonzalo R.
 Arce.
 Joint wavelet compression and authentication watermarking.
 In Proceedings of the IEEE International Conference on Image Processing,
 ICIP '98, Chicago, IL, USA, 1998.
\layout Itemize

Zhu, refer to
\layout Quotation

Wenwu Zhu, Zixiang Xiong, and Ya-Qin Zhang.
 Multiresolution watermarking for images and video: a unified approach.
 In Proceedings of the IEEE International Conference on Image Processing,
 ICIP '98, Chicago, IL, USA, October 1998.
 
\layout Itemize

Piva/Fotopoulos [cast|test-pv,hart,sub], contribution by Vassilis Fotopoulos,
 refer to
\layout Quotation

M.Barni, F.
 Bartolini, V.
 Cappellini, A.
 Piva.
 A DCT-Domain System for Robust Image Watermarking, Signal Processing, vol.
 66, pp 357 - 372, 1998.
\begin_deeper 
\layout Standard
\added_space_top smallskip \added_space_bottom smallskip 
and
\end_deeper 
\layout Quotation

V.
 Fotopoulos, A.
 N.
 Skodras, A Subband DCT approach to image watermarking, X European Signal
 Processing Conference, September 4 - 8, 2000, Tampere, Finland.
\layout Standard

More algorithms will be added over time, I have implemented about 13 watermarkin
g algorithms in the spatial-, DCT-, and wavelet domain so far.
\layout Subsection


\begin_inset LatexCommand \label{sec:utility_programs}

\end_inset 

Utility programs
\layout Standard

A good way to check the effect of a watermarking algorithm is computing
 the difference image, i.e.
 subtracting the original image from the watermarked image.
 Alternatively, one can also have a look at the modified coefficients in
 the transform domain.
 The following programs facilitate these tasks:
\layout Description

cmp_pgm compute difference image, PSNR, ...
\layout Description

cmp_dct compute full-frame DCT domain difference image
\layout Description

cmp_dct8x8 compute 8x8 block-based DCT difference image
\layout Description

cmp_dwt compute DWT domain difference image
\layout Standard

For example, to produce the difference image of two PGM files and compute
 the PSNR along with some other measures, the following command can be used:
\layout Standard


\family typewriter 
\size small 
cmp_pgm -p -i original.pgm -o diff.pgm watermarked.pgm
\layout Section

Usage
\layout Standard

Note, almost all programs will output usage information if called with the
 
\family typewriter 
\size small 
-h
\family default 
\size default 
 argument.
\layout Subsection

Generating a mark
\layout Standard

First, you have to generate an appropriate signature file for the corresponding
 embedding/detection algorithm; e.g.
 if you are going to use Cox' scheme, then you would run
\layout Standard


\family typewriter 
\size small 
gen_cox_sig
\layout Standard

The programs outputs some parameters and a sequence of Gaussian distributed
 random numbers (which is the watermark sequence).
 You want to save that into a signature file, so you run
\layout Standard


\family typewriter 
\size small 
gen_cox_sig > cox.sig or 
\layout Standard


\family typewriter 
\size small 
gen_cox_sig -o cox.sig
\layout Standard

You can influence e.g.
 the embedding strength that will be used in the embedding step by running
\layout Standard


\family typewriter 
\size small 
gen_cox_sig -a 0.5 > too_strong_cox.sig
\layout Standard

Usually, the programs for generating a signature will supply reasonable
 default values for marking a 8-bit gray-scale image of size 
\begin_inset Formula \( 512\times 512. \)
\end_inset 


\layout Subsection

Watermark embedding
\layout Standard

Watermark embedding is performed with the following command (for our example,
 we are using Cox' scheme):
\layout Standard


\family typewriter 
\size small 
wm_cox_e -s cox.sig -o cox_lena.pgm lena.pgm
\layout Standard

The signature file is parsed to obtain the particular watermark sequence
 and the embedding strength.
 The watermarked image is written to the file 
\family typewriter 
\size small 
cox_lena.pgm
\family default 
\size default 
.
 Now it the time to check the perceptual quality of the produced image and
 also have a look at the difference image (see section 
\begin_inset LatexCommand \ref{sec:utility_programs}

\end_inset 

).
\layout Subsection

Watermark extraction
\layout Standard

To extract the embedded signature, we execute the command 
\layout Standard


\family typewriter 
\size small 
wm_cox_d -s cox.sig -i lena.pgm -o cox.wm cox_lena.pgm 
\layout Standard

Since Cox' algorithm is not blind, the original image is needed as a reference
 to extract the embedded mark.
 The embedded mark will be stored in 
\family typewriter 
\size small 
cox.wm
\family default 
\size default 
.
 The original signature, 
\family typewriter 
\size small 
cox.sig
\family default 
\size default 
, is used to get the auxiliary embedding parameter correct (e.g.
 embedding strength).
 
\layout Subsection

Comparing the mark
\layout Standard

The final step is comparing the original signature against the extracted
 signature.
 The result here is usually a correlation factor.
 Values around 0 indicate that the mark has not been found, values around
 1 
\layout Standard

In most programs a analytical detection threshold for some detection probability
 is not used.
 Hence, one has to observe the output of the detector for many different
 keys (around 1000 I'd suggest) to establish a reasonable threshold for
 detection.
 A good value to go with initially might be 0.2 which means we claim the
 watermark detected if the correlation factor is > 0.2.
\layout Standard

The appropriate command for comparing the mark is
\layout Standard


\family typewriter 
\size small 
cmp_cox_sig -s cox.sig cox.wm 
\layout Subsection

Batch testing - benchmarking
\layout Standard

If you want to run many test you can pipe the images to be do be watermarked
 (and tested) through the embedder and detector.
 The programs then act like a filter.
 Try something like the following in a Unix shell script:
\layout Standard


\family typewriter 
\size small 
gen_cox_sig > cox.sig 
\layout Standard


\family typewriter 
\size small 
for i in *.pgm 
\layout Standard


\family typewriter 
\size small 
do 
\layout Standard


\family typewriter 
\size small 
\SpecialChar ~
\SpecialChar ~
wm_cox_e -s cox.sig $i | 
\backslash 

\layout Standard


\family typewriter 
\size small 
\SpecialChar ~
\SpecialChar ~
wm_cox_d -s cox.sig -i $i | 
\backslash 

\layout Standard


\family typewriter 
\size small 
\SpecialChar ~
\SpecialChar ~
cmp_cox_sig -s cox.sig 
\layout Standard


\family typewriter 
\size small 
done
\layout Section


\begin_inset LatexCommand \label{sec:recompile}

\end_inset 

Recompiling
\layout Standard

Note, that most watermark embedding/extraction programs use the built-in
 random number generator of the C library, i.e.
 
\family typewriter 
\size small 
srandom()
\family default 
\size default 
 and 
\family typewriter 
\size small 
random().
 
\family default 
\size default 
Therefore, if you recompile, chances are that you won't be able to use your
 images watermarked with the previous version.
\layout Standard

The Makefile options for compiling on the different platforms can be found
 in the 
\family typewriter 
\size small 
make/
\family default 
\size default 
 sub-directory of the archive.
\layout Subsection


\begin_inset LatexCommand \label{sec:prereq}

\end_inset 

Prerequisites
\layout Subsubsection

NetPBM
\layout Standard

NetPBM is responsible for image file I/O and provides a definition of a
 simple image file format along with many image file format filters that
 allow to convert images to and from NetPBM format.
 
\layout Standard

You need to get and install the NetPBM library at 
\begin_inset LatexCommand \url{http://wuarchive.wustl.edu/graphics/graphics/packages/NetPBM/}

\end_inset 

 or 
\begin_inset LatexCommand \url{http://netpbm.sourceforge.net}

\end_inset 

.
 The library provides 
\family typewriter 
\size small 
pgm.h
\family default 
\size default 
 and the appropriate implementation.
\layout Subsection

Unix/Linux platform
\layout Standard

All programs were developed using Linux and GNU C.
 The programs should compile and work with all recent versions of Linux
 and GNU C.
 
\layout Subsection


\begin_inset LatexCommand \label{sec:win32_compile}

\end_inset 

Win32 platform
\layout Standard

The programs were ported to the Windows platform using the Cygwin
\begin_float footnote 
\layout Standard


\begin_inset LatexCommand \url{http://www.cygwin.com}

\end_inset 

 
\end_float 
and Mingw
\begin_float footnote 
\layout Standard


\begin_inset LatexCommand \url{http://www.mingw.org}

\end_inset 


\end_float 
 environment.
 Most notable, the file mode for standard input and standard output has
 to be set to binary mode.
 This is accomplished with the 
\family typewriter 
\size small 
setmode()
\family default 
\size default 
 or 
\family typewriter 
\size small 
_fsetmode()
\family default 
\size default 
 commands.
\layout Section

FAQ
\layout Standard

Q: How can I report problems?
\layout Standard

A: See the contact information at the beginning of this document.
\layout Standard

Q: The compiler complains about 
\family typewriter 
\size small 
pgm.h
\family default 
\size default 
?
\layout Standard

A: You need to get and install the NetPBM library, see section 
\begin_inset LatexCommand \ref{sec:prereq}

\end_inset 

.
\layout Standard

Q: What is the best algorithm? 
\layout Standard

A: Depends on your application.
\layout Standard

Q: What is the most robust algorithm?
\layout Standard

A: Depends on the attack.
 See some results on 
\begin_inset LatexCommand \url{http://www.cosy.sbg.ac.at/~pmeerw/Watermarking}

\end_inset 

.
\layout Standard

Q: I need code for a full-frame DCT?
\layout Standard

A: See the files Meerwald/dct.* in the archive.
\layout Standard

Q: I need code for a 8x8 block DCT?
\layout Standard

A: See the files 
\family typewriter 
\size small 
Meerwald/dct.*
\family default 
\size default 
 in the archive.
\layout Standard

Q: I need code for the wavelet transform (DWT)?
\layout Standard

A: See the files 
\family typewriter 
\size small 
Meerwald/wavelet.*
\family default 
\size default 
 in the archive.
\layout Standard

Q: I get the message 'unable to open filter.dat' - what to do?
\layout Standard

A: Make sure the file filter.dat is in the current directory or accessible
 via path/filename specified in the signature file.
 Use the signature generation command to specify an absolute path if necessary.
\layout Standard

Q: I can't compile the code using some Microsoft product?
\layout Standard

A: Make your life easier, install GNU software! See section 
\begin_inset LatexCommand \ref{sec:recompile}

\end_inset 

.
\layout Section

Revision history
\layout Standard

version 0.4 (June 21, 2001)
\layout Itemize

bug fixes 
\begin_deeper 
\layout Itemize

wm_xia_{e|d}.c variable level uninitialized 
\layout Itemize

wm_zhu_{e|d}.c variable level uninitialized
\layout Itemize

issue with random() vs.
 rand() and RAND_MAX in frid2_common.c
\end_deeper 
\layout Itemize

added option to bruyn algorithm to disable block skipping
\layout Itemize

added algorithm kim
\layout Standard

version 0.3 (June 18, 2001)
\layout Itemize

created a nice (?) manual/documentation
\layout Itemize

added algorithms by Dugad, Wang, Zhu, Fridrich
\layout Itemize

added Makefiles for Win32 platform (mingw32)
\layout Standard

version 0.2 (February 22, 2001)
\layout Itemize

added contribution by Vassilis Fotopoulos (Piva's algorithm,
\layout Itemize

DCT, Hartley and subband domain) - see Fotopoulos/ subdirectory
\layout Itemize

stuff moved to Meerwald/ subdirectory
\layout Itemize

added Bruyndonckx, Corvi, Koch, Xia, Xie algorithms
\layout Standard

version 0.1 (February 18, 2001)
\layout Itemize

initial release
\layout Section

Legal statement
\layout Standard

My license is called "I-don't-care" license: (1) You can do with the accompanyin
g software whatever you want, but don't blame me if it doesn't work or it
 causes damage.
 (2) If you think my work is useful, tell me and tell others, but you are
 not obliged to do so.
 I suggest not to remove information contained in this other documentation
 file.
\layout Standard


\begin_inset LatexCommand \BibTeX[plain]{watermarking}

\end_inset 


\the_end

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.