Beruflich Dokumente
Kultur Dokumente
________________________________________________________________________
Chapter 1
INTRODUCTION
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 2
________________________________________________________________________
INTRODUCTION
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 3
________________________________________________________________________
1.1 Motivation
1.2 Definition
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 4
________________________________________________________________________
1.3 Literature
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 5
________________________________________________________________________
1.3.1 Description
The contents of the image can be marked without visible loss of value
or dependence on specific formats. For example a bitmap (BMP) image can be
compressed to a JPEG image [2]. The result is an image that requires less
storage space but cannot be distinguished from the original. Generally, a
JPEG compression level of 70% can be applied without humanly visible
degradation. This property of digital images allows insertion of additional
data in the image without altering the value of the image. The message is
hidden in unused “visual space” in the image and stays below the human
visible threshold for the image.
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 6
________________________________________________________________________
1.3.2 Building an Effective Watermarking Algorithm
Watermark
In case detection is necessary, then Fig 1.2 shows the block diagram of
a detection algorithm. The detector algorithm generally follows a reverse path
to that of the watermarking algorithm.
Original image
or watermark
Watermarked Detector
Watermark
image Algorithm
The dotted line implies the original image may or may not be used for
detection. When it is used we call it as private watermarking and if it is not
used then we call it a public watermarking scheme.
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 7
________________________________________________________________________
A watermark shall convey as much information as possible, which
means the watermark data rate should be high.
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 8
________________________________________________________________________
1.3.3 Classifications of digital image watermarking
Visible and invisible watermarks both serve to deter theft but they do
so in very different ways. Visible watermarks are especially useful for
conveying an immediate claim of ownership. The main advantage of visible
watermarks, in principle at least, is that they virtually eliminate the
commercial value of the document to a would-be thief without lessening the
document's utility for legitimate, authorized purposes. Invisible watermarks,
on the other hand, are more of an aid in catching the thief than discouraging
the theft in the first place.
The watermark may be inserted into the image either in the spatial
domain or the transform (frequency) domain. Spatial domain techniques are
easier to implement. However with transform domain techniques it is easier
to develop invisible watermarks and also the watermarks produced are more
robust to attacks.
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 9
________________________________________________________________________
The idea is to directly insert a watermark in the pixel value when the
image is in the spatial domain. The robustness of this domain is weak
compared to transform domain. The most widely used algorithm in the spatial
domain is – Least Signification Bit (LSB) technique, which is the simplest
method of inserting the watermark. As the LSB provides the least
information in a byte, it can be replaced with the watermark bit. Hence the no
of watermark bits that can be inserted depends on the size of the image.
Figs 1.3 below shows some of the methods used in the spatial and
transform domains for image watermarking.
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 10
________________________________________________________________________
Wavelets transform
Spread Spectrum
(DWT)
Other transforms
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 11
________________________________________________________________________
……………(1)
for u= 0,1,2,…,N− 1.
where the function α(u) is defined as
…………....(2)
……………………………… (3)
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 12
________________________________________________________________________
Thus, the first transform coefficient is the average value of the sample
sequence. In literature, this value is referred to as the DC Coefficient. All
other transform coefficients are called the AC Coefficients .
The 2-D DCT [4] is a direct extension of the 1-D case. The 2-D DCT
definition C(u,v) of a function f(x,y) which is a 2-D sequence of size NxN is
……….....(4)
for u ,v = 0,1,2,…,N −1.
where α ( u ) and α ( v ) are as defined in equation (2).
……………(5)
for x, y = 0,1,2,…,N −1.
where α (u) and α (v) are as defined in equation (2).
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 13
________________________________________________________________________
Properties of DCT
1. Decorrelation
2. Energy Compaction
Advantages of DCT
Compared to other transforms DCT, it has fixed basis images and fast
implementations are possible. It also exhibits good decorrelation and energy
compaction characteristics [5]. However, a transform like DFT is a complex
transform and therefore stipulates that both image magnitude and phase
information be encoded. Furthermore, the implicit periodicity of DFT gives
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 14
________________________________________________________________________
rise to boundary discontinuities that result in significant high-frequency
content. After quantization, Gibbs Phenomenon causes the boundary points to
take on erroneous values, which appears in the image as blocking artifacts.
That is the boundaries between the adjacent sub images become visible
because the boundary pixels of the adjacent sub images assume the mean
value of discontinuities formed at the boundary points. The DCT reduces this
effect, because its implicit 2n point periodicity does not inherently produce
boundary discontinuities.
In visible watermarking the image of Lena is the cover image and our
college logo is the watermark. The logo is satisfactorily embedded in the host
image without any significant degradation. In case of colour image
watermarking the picture of the national emblem is embedded in picture of
Tajmahal which is the cover image.
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 15
________________________________________________________________________
Invisible watermarking was implemented by embedding a watermark
image of size (1/64) t h the size of the cover image, that is maximum size of
watermark that can be embedded . Invisible watermarking is performed for
different values of scaling factors and hence different watermarked images
with different quality are obtained.
Chapter 2
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 16
________________________________________________________________________
MATLAB
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 17
________________________________________________________________________
MATLAB
MATLAB has evolved over a period of years with input from many
users. In university environments, it is the standard instructional tool for
introductory and advanced courses in mathematics, engineering, and science.
In industry, MATLAB is the tool of choice for high-productivity research,
development, and analysis.
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 18
________________________________________________________________________
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 19
________________________________________________________________________
Chapter 3
IMPLEMENTATION
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 20
________________________________________________________________________
IMPLEMENTATION
In this chapter we discuss about the implementation details of our
project. Since we have used two methods, one each for visible and invisible
watermarking, we discuss both methods in sufficient detail.
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 21
________________________________________________________________________
The α n and β n coefficients are for block n. The Cij(n) are the DCT
coefficients of the host image block I and Wij(n) the DCT coefficients of the
watermark image block W. The α n and β n values are found out using a
mathematical model developed by exploiting the texture sensitivity of the
human visual system (HVS). This ensures that the perceptual quality of the
image is better preserved. We call α n the scaling factor and β n as the
embedding factor. Xij(n) the DCT coefficients of watermarked image.
The distortion visibility is low when the background has strong texture.
In a highly textured block, energy tends to be more evenly distributed among
the different AC DCT coefficients. That means AC DCT coefficients of
highly textured blocks have small variances and we can add more to those
blocks. So for convenience, we assume α n to be directly proportional to
variance (σ n ) and β n to be inversely proportional to variance (σ n ).
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 22
________________________________________________________________________
Let us denote the mean gray value of each image block as μ n and that of
the image as μ. The blocks with mid-intensity values (μ n ≈ μ) are more
sensitive to noise than that of low intensity blocks (μ n < μ) as well as high
intensity blocks (μ n > μ). This means that α n should increase with μ n as long
as (μ n < μ) and should decrease with μ n as long as (μ n > μ).For convenience,
the relationship between α n and μ n is taken to be truncated Gaussian. The
variation of β n with respect to μ n is the reverse of that of α n . The mean gray
value of each block is given by its DC DCT coefficient.
Using the observations made in the above discussions α n and β n are computed
as:
α n = σ’ n exp. ( - (μ’ n - μ’ ) 2 )...................................……………………(2)
Divide the original image I into 8x8 blocks and find the DCT
coefficients of each block. Let us denote the DCT coefficients of block n by
Cij(n),n = 1, 2 ... N, where n represents the position of block in image I (if
we traverse the image in a raster-scan manner).
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 24
________________________________________________________________________
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 26
________________________________________________________________________
values of mean gray level and then increasing back to 0.17 at higher values of
mean gray level.
Thus from the four figures we can see that the values of scaling and
embedding factors conform to the ranges that were discussed above.
The original image is divided into blocks of size 8x8 each. The DCT of
each block is taken. We analyze the properties of these blocks to find the
scaling and embedding factors. The watermark image is similarly divided into
8x8 blocks and DCT of each block is taken. Finally we add the corresponding
elements of the original image times the scaling factor and the watermark
image times the embedding factor to obtain the watermarked image.
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 27
________________________________________________________________________
Flowchart
The original image IM and the watermark image WM are divided into blocks of size
8x8. Depending on the properties of IM, the scaling and embedding factors are found using
the above mentioned algorithm. Finally we add the corresponding elements of the
original image times the scaling factor and the watermark image times the
embedding factor to obtain the watermarked image XM. This is shown in Fig
3.6.
Start
N=size (IM)/8*8
n=1
No
Is L
n<=N 1
Yes
n=n+1
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 28
________________________________________________________________________
L
1
n=1, sumdc=0
No
Is L
n<=N 2
Yes
n=n+1
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 29
________________________________________________________________________
L
2
n=1
If
No
Is L
n<=N 3
Yes
temp(n)=exp(-((blk_meandc(n)-im_meandc)^2) )
scalef(n)=blkn_acvar(n)*temp(n)
embedf(n)=(1-temp(n))/blkn_acvar(n)
L
4
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 30
________________________________________________________________________
L
4
n=n+1
If
L
3
Stop
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 31
________________________________________________________________________
a. Embedding watermark
b. Extracting watermark
3.2.1 Description
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 32
________________________________________________________________________
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 33
________________________________________________________________________
The quantization matrix is the 8x8 matrix of step sizes (also called
quantums) one element for each DCT coefficient. JPEG uses this quantization
table to compress images, in brief different parts of the images are
compressed unequally depending on the quantization values given in the
quantization matrix which was obtained by exploiting HVS. Based on the
table, we can observe that coefficients (4, 1) and (3, 2) or (1, 2) and (3, 0)
would make suitable candidates for comparison, as their quantization values
are equal. The swapping of such coefficients should not alter the watermarked
image significantly, as it is generally believed that DCT coefficients of
middle frequencies have similar magnitudes.
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 34
________________________________________________________________________
Design parameters
The two DCT coefficients selected for in the algorithm should be in the
mid frequency band of a 8x8 DCT block. Coefficients corresponding to (4,1)
and (3,2) are selected as both lie in the mid frequency band and have same
quantization values in the JPEG quantization table .
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 35
________________________________________________________________________
• Watermark strength constant (k)
1. The cover image (original image) is obtained and its size (i.e.
number of pixels) is calculated.
6. The values of the message array are in the range of 0 – 255 since the
image is bit map image represented using 8 bits. The message array is
normalized by dividing entire message array by 255 and rounding off
the values to obtain either 0s or 1s.
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 36
________________________________________________________________________
7. If the size of the message array is less than maximum size of the
watermark that can be embedded in given cover image then message
array is appended with either 0s or 1s to maximum size.
10. Similarly to embed a ‘0’ from the message array the coefficients are
varied accordingly to obtain B (u 2 , v 2 ) > B (u 1 , v 1 ).
12. Now this 8x8 block is converted back to spatial domain by performing
2 dimensional Inverse DCT.
13. Steps no.8 to step no.12 are applied to all the 8x8 blocks of the cover
image.
14. The resulting image obtained is the watermarked image which is saved
and then displayed.
Start
No
Can watermark of
this size be A
embedded
Yes
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 38
________________________________________________________________________
Yes Is No
message
bit =’1’
B(u1,v1) B(u2,v2)
>B(u2,v >
No B(u1,v1) No
2
)
Yes Yes
Swap both
Swap both coefficients
coefficients
No
|B(u1,v1)- | B(u2,v2)- B(u1,v1)|
B(u2,v2)| < k <k
Yes Yes
B(u1,v1)= B(u1,v1)-k/2 B(u2,v2)= B(u2,v2)-k/2
________________________________________________________________________
B(u2,v2)= B(u2,v2)+k/2 B(u1,v1)= B(u1,v1)+k/2
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 39
________________________________________________________________________
Yes Is No
message
bit =’1’
B(u1,v1) B(u2,v2)
>B(u2,v >
No B(u1,v1) No
2
)
Yes Yes
Swap both
Swap both coefficients
coefficients
No
|B(u1,v1)- | B(u2,v2)- B(u1,v1)|
B(u2,v2)| < k <k
Yes Yes
B(u1,v1)= B(u1,v1)-k/2 B(u2,v2)= B(u2,v2)-k/2
B(u2,v2)= B(u2,v2)+k/2 B(u1,v1)= B(u1,v1)+k/2
Perform 2D IDCT
for this 8x8 block
Stop
3. Obtain the original watermark from the user and calculate its
dimensions.
9. Step no.7 to step no.8 are applied to all the 8x8 blocks of the
watermarked image.
Start
Can watermark of No
this size be present in B
watermarked image
Yes
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 42
________________________________________________________________________
Yes Is No
B (u1,v1) > B (u2,v2)
Bit ‘1’ is extracted and stored Bit ‘0’ is extracted and stored
in 1D message array in same 1D message array
Display watermark
Stop
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 43
________________________________________________________________________
Chapter 4
RESULTS
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 44
________________________________________________________________________
RESULTS
The algorithm for visible watermarking was implemented using Fig 4.1
and Fig 4.4 as the cover images and Fig 4.2 and Fig 4.5 as the watermarks.
Fig 4.3 and Fig 4.6 shows the resultant watermarked images. The scaling
factor has been reduced and embedding factor has been increased
considerably for increasing perceptibility.
Fig 4.4 Original colour image Fig 4.5 Watermark colour image
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 46
________________________________________________________________________
The algorithm has been implemented using the original image shown in
Fig 4.7 and watermark image shown in Fig 4.8. The watermark strength
constant (k) has been varied, and watermarked image obtained for different
cases for k = 0, 1, 50, 100 has been shown in Fig 4.9 to Fig 4.12 respectively.
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 47
________________________________________________________________________
Case 1: K=0
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 48
________________________________________________________________________
Case 2: K=1
Case 3: K=50
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 49
________________________________________________________________________
Case 4: K=100
Chapter 5
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 50
________________________________________________________________________
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 52
________________________________________________________________________
1. Susceptible to image cropping and geometric distortions like scaling
and rotation.
2. Grey levels in watermark image should preferably be at max (255)
or min (0) limits for better results.
3. Cannot be applied to colour images.
5.3 Applications
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 54
________________________________________________________________________
Chapter 6
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 55
________________________________________________________________________
BIBLIOGRAPHY
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 56
________________________________________________________________________
BIBLIOGRAPHY
Papers
4. Syed Ali Khayam, The Discrete Cosine Transform (DCT): Theory and
Applications.
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010
“Digital image watermarking using Discrete Cosine Transform” Page 57
________________________________________________________________________
12. Koch, E., & Zhao, J. (1995), Towards robust and hidden image
copyright labeling, Proceeding of IEEE Nonlinear Signal Processing
Workshop, (pp. 452-455).
Books
________________________________________________________________________
Dept of IT,JSSATE, Bangalore 8th Semester Project 2010