You are on page 1of 49

1

CHAPTER 1
INTRODUCTION

1.1 OVERVIEW OF THE PROJECT

Hybrid digital embedding is a technique for embedding a signature,


(which is a bi-color image) into the host image (which is a color image). Before
embedding, the handwritten signature is encoded. This encoding is done by using a public
key. After embedding we will be getting a composite image. Then from this composite
image, the signature image, which is secret information, will be extracted. Extracting the
signature will require private key, using this private key the secret information will be
extracted. Some noise can be made in the composite image, but visually we cannot see
the noise and finally the signature are extracted with the noise, so in the extracted
signature we can visually see where the attacks are made. Two types of noise are made in
this project, one is salt and pepper noise and another one is speckle noise.
Data hiding can be defined as the process by which a message signals or image is
imperceptibly embedded into a host or cover to get a composite signal. Our consideration
is that of embedding information into image. A significant issue here is to embed bytes
without causing visual degradation to the host image. This requires embedding data in
such a way that adapts with the local characteristics of an image. Next, a hybrid digital
embedding technique is proposed for hiding an image into another image in such a way
that the quality of the recovered image improves significantly.
Salt and pepper noise and speckle noise is done. These are some attacks which
can be made to the composite image. From this attacked image, the signature is extracted.
But the signature that is extracted will not be much clear as the original image before
being embedded. Our proposed technique can be applied for ownership protection, copy
control, annotation and authentication of digital media. This work is specifically focused
on protection and authentication of Handwritten Signature.
2

Our proposed technique can be applied for ownership protection, copy


control, annotation and authentication of digital media. This work is specifically focused
on protection and authentication of Handwritten Signature. The design of this technique
is based on extensive analytical as well as experimental modeling of the data-hiding
process.

1.2 LITERATURE SURVEY

Rehab H. Alwan, Fadhil J. Kadhim, and Ahmad T. Al- Taani, have


explained a method with three main steps. First, the edge of the image is detected using
Sobel mask filters. Second, the least significant bit LSB of each pixel is used. Finally, a
gray level connectivity is applied using a fuzzy approach and the ASCII code is used for
information hiding. The prior bit of the LSB represents the edged image after gray level
connectivity, and the remaining six bits represent the original image with very little
difference in contrast. The given method embeds three images in one image and includes,
as a special case of data embedding, information hiding, identifying and authenticating
text embedded within the digital images.
Yusuk Lim, Changsheng Xu and David Dagan Feng, described the web-based
authentication system consists of two parts. one is a watermark embedding system and
the other is authentication system. In case of watermark embedding system, it is installed
in the server as application software that any authorized user, who has access to server,
can generate watermarked image. The distribution can use any kind of network
transmission such as FTP, e-mail etc. Once image is distributed to externally, client can
access to authentication web page to get verification of image.
Yongjian Hu and Byeungwoo Jeon have proposed a reversible visible
watermarking algorithm to satisfy a new application scenario where the visible
watermark serves as a tag or ownership identifier, but can be completely removed to
resume the original image data. It includes two procedures that are data hiding and visible
In order to losslessly recover both the watermark-covered and nonwatermark-
covered image form Watermark embedding the contents at the receiver end, the payload
consists of two reconstruction data packets, one for recovering the watermark covered
3

region, and the other for the nonwatermark- covered region. The data hiding technique
reversibly hides the payload in the image region not covered by the visible watermark.

Debnath Bhattacharyya, Shanta Phani, Poulami Das and Samir Kumar


Bandyopadhyay presented that the algorithm at the source embeds a slice of the key
watermark image into the original handwritten signature image and the resultant
embedded image will be transmitted to target, where another algorithm again will extract
the sliced key image and then merge with the other slice image available at the target.
This will produce the original key image.

1.3 DEFINITIONS
Watermarking
Water line: a line marking the level reached by a body of water.

Digital watermarking
A process of possibly irreversibly embedding information into a digital signal.
The signal may be audio, pictures or video, for example. If the signal is copied, then the
information is also carried in the copy

Visible watermarking
The information is visible in the picture or video. Typically the information
is text or a logo which identifies the owner of the media.

Invisible watermarking
Information is added as digital data to audio, picture or video, but it cannot
be perceived as such. An important application of invisible watermarking is to copyright
protection systems, which are intended to prevent the unauthorized copying of digital
media.
4

1.4 SPECIFICATION REQUIREMENTS

Purpose
The purpose of this document is to elaborate the requirements to be
implemented as part of the project. This documentation will be used by the following
audience.
a. The Student:
To make the requirements/problem clear.
To present the requirements to the university project committee.
To keep track of the requirements (for future phases of the project)

b. Project Committee:
To understand the requirements of this project.

Scope
Following is the scope of the project
A new technique for digital embedding using invisible watermarking is
proposed. The purpose of this technique is to embed a handwritten signature into
a color image, so that a composite image is generated. From this composite
image, the handwritten signature will be extracted.
This technique will accept a color image and a handwritten signature as input and
provide the signature as output which is extracted from the watermarked image.
A significant issue here is to embed bytes without causing visual degradation to
the host image.
5

1.5 PROBLEM STATEMENT


A digital watermark is a short sequence of information containing an owner
identity or copyright information embedded in a way that is difficult to erase. A new
oblivious digital watermarking technique for copyright protection of secret information
is proposed.
A bi-color image which is the signature is embedded into a color image.
This color image will be converted into a grey scale image and then the embedding starts.
Before embedding the signature is encoded using a public key. This public key generation
is done by the help of knapsack algorithm. The signature is extracted from the composite
image by using the private key.
Salt and pepper noise and speckle noise is done. These are some attacks
which can be made to the composite image. From this attacked image, the signature is
extracted.But the signature that is extracted will not be much clear as the original image
before being embedded.

1.5.1 Existing system


The advent of digital age has destroyed the security and protection of
digital multimedia information. To protect this numerous schemes have been proposed in
the line of Data Hiding Techniques. Digital Watermarking is a data hiding technique
where an information or message is hidden inside a signal transparent to the user. This
method is used for copyright protection of digital media. Watermarking differs from
encryption in a way that in the former case a general user is allowed to access, view and
interpret the signal but cannot claim the ownership of the content, whereas in case of
encryption the very access to the signal itself is denied. Thus Watermarking is more
popular than encryption where the content generator wants the general user to enjoy the
content but shall not infringe upon the copyright. Digital Watermarking is emerging as a
favorite technique over traditional encryption for digital rights management (DRM). A lot
of research is still going on and new methods are emerging.
6

1.5.2 Proposed System


Hybrid digital embedding using invisible watermarking can do the
following.
Embedding
Get a handwritten signature image and a host image as input.
Encode the signature image.
Encoding is done by using a public key.
Public key is generated by knapsack algorithm.
Embedding starts from the starting point of the encoded byte.
Composite image is generated.
Extraction
Gets the private key.
Extract signature from the composite image.
Extraction is done by using the private key.
Comparison
Compare the original image and the watermarked image.
Calculate the psnr value.
Compare the original signature and the extracted signature.
Calculate the psnr value for extracted signature.

1.6 OVERALL DESCRIPTION


1.6.1 Product Perspective
Invisible watermarking is adding information as digital data to
picture, but it cannot be perceived. Invisible watermarking is used in the case of
copyright protection systems, which are intended to prevent unauthorized copying of
digital media. Data hiding can be defined as the process by which messages signal or
image is imperceptibly embedded into a host or cover to get a composite signal. The
advantage of this technique is that it can be applied for ownership protection, copy
control, annotation and authentication of digital media.
7

1.6.2 Document Conventions


Carrier File/Object
A Carrier file or Carrier object is the source file onto which the data to be
hide is written in such a way the output file resembles the initial source file to naked eye
and to the normal applications which are associated to the source file. For example, a
plain file is generally edited in notepad. If we write some message in some way into the
source file and produced an output file, the content of the file should be same as before
when the output file is opened in notepad.
Secret File/Object
This object can be message, text file. It is intended to be hidden in the
Carrier File.
Hidden File/Object
It is same as Secret File/Object.
Output File
This is the file produced as a result of extracting the signature from
the color image. It should resemble the Source file.

1.6.3 Product Features


Carrier file is an image file
Various file format are supported
Text txt, html
Image- bmp, jpg
Hidden object can be a text file.
Encoding is supported.
Public key is generate
Hybrid digital embedding is done.
Private Key is generated.
Decoding is supported.
Extraction of bi-color image from the watermarked image is done.
8

1.6.4 Operating Environment


Operating System : Win XP, 2000, 98, Vista.
Software required : MATLAB 7.0.1.
Recommended Conf.: 512MB RAM or higher, 10MB Disk space.
Screen Resolution : 1024x768.
1.6.5 Assumptions and Dependencies
Dependencies
Matlab software is required.
Assumptions
The Operating System can any one of NT Family.
File path should be specified properly.
1.6.6 External Interface Requirements
Hardware Interfaces
Apart from the recommended configuration no other specific hardware
is required to run the software.
Software Interfaces
Matlab is required.
Matlab version can be 7.0.1 or higher.

1.7 OTHER NONFUNCTIONAL REQUIREMENTS


1.7.1 Performance Requirements
The RAM should be 256 atleast. But 512MB RAM is recommended.The disk
space required to store the software is 10MB and to store the output files and for other
configuration files associated with the software 512MB disk space is required.
1.7.2 Safety Requirements
The size constraints have to be evaluated by the end user only. This is done to
enhance the performance of the software in terms of speed. In case size of hidden object
9

exceeds the maximum.Allowable size that can be hidden, the extra information is
truncated. The size of hidden object that can be stored in a carrier file depends on the
carrier file size and type. The screen resolution should be set to 1027x768 or higher to get
the complete view of the implementation. In case of lower resolution screen the
implementation not only looks awkward but also not completely visible.

1.7.3. Other Requirements


The file path should be set properly. Hidden file size should be 7050
pixels size. Carrier file size should be 512x512 pixel size .Other wise lot of errors will
occur. This will degrade the implementation. There are no further requirements other than
that specified in this SRS under different headings.

1.8 ORGANIZATION OF THE REPORT


The project chapters is organized as follows

Chapter 2 Requirement Specification: Defines the problem statement in


detail and enlist the various software features and overall functions.

Chapter 3 System Design: This chapter defines the overall design of the
system, the data flow diagrams and the module diagram.

Chapter 4 Implementation and Testing: This chapter deals with the


implementation work of each module and shows the results of various test cases.

Chapter 5 Conclusion and Results: This chapter shows out the results of
the project. Conclusion and future enhancements is given out.
10

CHAPTER 2
SYSTEM DESIGN

2.1 INTRODUCTION
This chapter deals with the block diagram, the dataflow diagram and the
module diagram. Hybrid digital embedding algorithm and digital extraction algorithm
will be discussed in detail.

2.2 BLOCK DIAGRAM


Block diagram is a diagram of a system, in which the principal parts or
functions are represented by blocks connected by lines that show the relationships of the
blocks. The block diagram is typically used for a higher level, less detailed description
aimed more at understanding the overall concepts and less at understanding the details of
implementation.

Figure 2.1 Block diagram


11

Host image is the cover image. Signature is the bi-color image. The signature is encoded
using public key. Then from the starting point of the encoded byte, the embedding starts,
which gives a composite image that is the watermarked image. Here the Significant issue
is to embed bytes without causing visual degradation to the host image. From the
composite image decoding is done using private key. Then from the starting point of the
decoded byte, the signature image is extracted.

2.3 DATA FLOW DIAGRAM


A data flow diagram (DFD) is a graphical representation of the "flow" of
data through an information system. A data flow diagram can also be used for the
visualization of data processing.

2.3.1Data Flow Diagram Level- 0

Host
Source image image
Invisible signature
Watermarking Target image

Bi -color
signature
image

Figure 2.2 Data flow diagram level-0


This is the zeroth level data flow diagram. In which the input, the process and
the output is shown. Here the source image and the signature are the inputs. Invisible
watermarking is the process. The output is the target image, which is the signature that is
extracted.
12

2.3.2. Data Flow Diagram Level- 1


This level clearly explains the flow of data through out the process. The host
image gives the source image and the signature bi-color image gives the bi-color image,
then encoding is done, this gives the starting point of the encoded byte. Then embedding
of the bi-color image into the color is done, which gives the watermarked image. Then
decoding is done using the private key which gives the decoded byte position using this
byte position the signature is extracted.

image Composite
Host Starting image(water
image point of marked
1 encoding 2 image)

Encoding Embedding

3
Signature Bi-color
image Decoding
bi-color image

Extracted 4
image
Extraction Decoded
Bi-color byte position
image

Figure 2.3 Data flow diagram level -1


13

2.4 MODULE DIAGRAM


In this project there are two modules. They are
Embedding
Extracting

2.4.1. Embedding
Embedding information into image, which could survive attacks on the untrusted
network. A significant issue here is to embed bytes without causing visual degradation to
the host image. Some secret information is embedded into the host image. Starting point
(byte) of encoding Signature Image (bi-color) file to Host Image (color) file is calculated.
This byte position is a value and that is converted to binary number. For every bit
position the weight is taken and in the super increasing order in combination, denoted as
easy key or private key. Public key is extracted from this private key, using Knapsack
Algorithm. By this public key the computed byte position is encoded and stored in the 4-
byte of the Host Image file

Figure 2.4 Embedding Module


14

In this module the watermarked image and the original host image is compared and the
psnr value is calculated for the difference.

2.4.2. Extracting
Decoding is done by private key or easy key. Creation of Recovery Image
file starts from decoded byte position of the Composite Image file and end at the end of
Composite Image file.

Figure 3.4.2 Extracting Module

Here the psnr value is calculated.Which gives the difference between the original
signature and the extracted signature. If the value is more than 35, then visually the
difference is not seen.

2.5 ALGORITHM
There are two algorithms .They are as follows
1. One is hybrid digital-embedding algorithm at source.
2. Handwritten Signature Extraction Algorithm from Hybrid
Composite Image file at target.
15

2.5.1 Hybrid Digital Embedding Algorithm


Detailed hybrid digital embedding algorithm.
1. Open Host and Signature Image files in Input Mode
2. Open Target Image (Composite) file in Output Mode
3. Initialize Integer i by 0; byte byte1, byte2 by 0;
Integer size1, size2 by 0;
4. Find sizes of Host and Signature Images and store to size1
and size2
5. Compute size = ((size1 - size2) - 1)
6. While (not end of Host Image file)
7. Loop
8. read byte from Host Image file and store to byte1
9. increase i by 1
10. if ((i >size) and (not end of Signature Image
file)) Then
11. While (not end of Signature Image file)
12. Loop
13. read byte from Signature Image file and
store to byte2
14. read byte from Host Image file and store
to byte1
15. Write byte2 to Target Image file
16. Increase i by 1
17. End Loop
18. Else
19. Write byte1 to Target Image file
20. End If
21. End Loop
22. Close Host, Signature and Target Image files.
16

Input
Host image and signature image.
Parameters
size1=size of host image.
size2=size of signature image.
size=difference between size1 and size2.
byte1=host mage file is read and its bytes are stored in byte1.
byte2=signature mage file is read and its bytes are stored in byte2.
Output
Composite image file is returned, in which the signature image file is
embedded.

Working of hybrid digital embedding algorithm.


Basic idea is that starting point (byte) of encoding Signature Image (bi-
color) file to Host Image (color) file is calculated. In the algorithm this is computed and
stored in the size. This byte position is a value and that is converted to binary number. For
every bit position the weight is taken and in the super increasing order in combination,
denoted as easy key or private key. ublic key is extracted from this private key, using
Knapsack Algorithm. By this public key the computed byte position is encoded and
stored in the 4- byte (55 to 58th bytes) of the Host Image file. In this encoding technique
both the file will end at the same point.

The host image file and the signature image file is opened in input mode.
The target image file is opened in output mode.
Initialize the variables.
Find the size of host image and signature image and store the values in size1
and size2.
Compute the difference between size1 and size 2.
Size = ((size1-size2)-1).
17

This size is calculated to check whether the size of host image is greater then the size of
signature image.
From the first byte of host image, while loop will start reading the bytes.
Read bytes from host image and signature image then store the values in byte1 and byte2.
Write byte 2 to the target image file.
Then write byte 1 to the target image file.
Close the host file, signature file and the target image file.

2.5.2 Algorithm for Extracting


Detailed Hybrid Digital Extraction Algorithm

1. Open Composite Image file in Input Mode


2. Open Recovery Image file in Output mode.
3. Initialize Integer i by 0, byte byte1 by 0
4. While (not end of Composite Image file)
5. Loop
6. Read byte from Composite Image file and
store to byte1
7. Increase i by 1
8. if (i >size) Then
9. Write byte1 to Recovery Image file
10. End If
11. End Loop
12. Close Composite and Recovery Image files

Input
Composite image file, private keys
Parameters
byte1=read byte from composite image file and store it in byte1.
18

Output
Recovered image file.

Working of hybrid digital extraction algorithm:


In this algorithm size is calculated from 4-byte (55 to 58th bytes) of the
Composite Image file which already encoded using public key. Decoding is done by
private key or easy key. Creation of Recovery Image file starts from decoded byte
position of the Composite Image file and end at the end of Composite Image file.
Open the composite image file in input mode.
Open the recovery image file in output mode.
Initialize the variables to 0.
Starting from the bytes in the private keys, the extraction starts.
Read the bytes from composite image file.
Write the bytes to the recovery image file.
Close the composite and recovery image file.

2.5.3 Knapsack Algorithm

The Superincreasing Knapsack Problem. An easy knapsack problem is one


in which the weights are in a Superincreasing sequence. A Superincreasing sequence is
one in which the next term of the sequence is greater than the sum of all preceding terms.
For example, the set {1, 2, 4, 9, 20, 38} is Superincreasing, but the set {1, 2, 3, 9, 10, 24}
is not because 10 < 1+2+3+9.It is easy to solve a Superincreasing knapsack. Simply take
the total weight of the knapsack and compare it with the largest weight in the sequence. If
the total weight is less than the number, then it is not in the knapsack. If the total weight
is greater then the number, it is in the knapsack. Subtract the number from the total, and
compare with the next highest number. Keep working this way until the total reaches
zero. If the total doesn't reach zero, then there is no solution.

Example:

Superincreasing increasing sequence; e.g. {1, 2, 4, 10, 20, 40}.


19

Multiply all the values by a number, n, modulo m. The modulus should be a


number greater than the sum of all the numbers in the sequence, for example, 110. The
multiplier should have no factors in common with the modulus. So let's choose 31.

The normal knapsack sequence would be

1* 31mod (110) =31;

2* 31mod (110) =62;

4* 31mod(110)=14;

10* 31mod(110)=90;
20

20* 31mod(110)=70;

40* 31mod(110)=30;
So the public key is: {31, 62, 14, 90, 70, 30} and the private key is {1, 2, 4, 10,
20.40}.Let's try to send a message that is in binary code: 100100111100101110.

The knapsack contains six weights so we need to split the message into groups of six:

100100111100101110.

This corresponds to three sets of weights with totals as follows

100100 = 31 + 90 = 121

111100=31+62+14+90=197

101110=1+14+90+70=205.
So the coded message is 121 197 205.

Now the receiver has to decode the message...The person decoding must know the two
numbers 110 and 31 (the modulus and the multiplier). Let's call the modulus "m" and the
number we multiply by "n".We need n1, which is a multiplicative inverse of n mod m,
i.e. n (n1) = 1 mod m
21

In this case I have calculated n1 to be 71. All we then have to do is multiply each of the
codes 71 mod 110 to find the total in the knapsack which contains {1, 2, 4, 10, 20, 40}
and hence to decode the message.

The coded message is 121 197 205:

121* 71mod (110) =11=100100

197* 71mod (110) =17=111100


22

205* 71
mod (110) =35=101110. The decoded message is: 100100111100101110.

.CHAPTER 3

IMPLEMENTATION AND TESTING

3.1 INTRODUCTION

3.1.1 Purpose

This section provides the following

Details about the implementation of hybrid digital embedding and hybrid digital
extraction algorithm.

Results of running the embedding and extraction algorithm and comparisons


between them.

3.1.2 Scope

The following segments provide the sample code, and the results of running the
code for hybrid digital embedding algorithm.

3.1.3 References
23

Please refer to Software Requirement Document (chapter 2) and system design


(chapter 3) for more details about the requirements and design of the program.

3.1.4 Overview

This section gives the overview of the following segments.

Section 4.2 gives the sample coding.

Section 4.3 gives the screen shots.

Section 4.4 gives the test cases.

CHAPTER 4

CONCLUSION AND FINAL RESULTS

4.1 ANALYSIS
Data hiding can be defined as the process by which a message
signals or image is imperceptibly embedded into a host or cover to get a composite
signal. A significant issue here is to embed bytes without causing visual degradation to
the host image. This requires embedding data in such a way that adapts with the local
characteristics of an image. Next, a hybrid digital embedding technique is proposed for
hiding an image into another image in such a way that the quality of the recovered image
improves significantly.
4.2FINAL RESULTS
The final output of this project is that the extraction of the signature
image from the composite image, in which the signature is embedded in the host image.
Figure 4.1 Final result
24

4.3 INFERENCE
Inference is the act or process of deriving a logical consequence
conclusion from premises. An efficient watermarking technique is is proposed to embed
signatures in images to attest the owner identification and discourage the unauthorized
copying. The proposed technique is based on embedding without causing any visual
degradation to the original image. Encoding and decoding is done by using the public key
and private key. These keys are generated by knapsack algorithm. Various attacks are
implemented and extracted watermark images are demonstrated. Attacks that are
performed in this project are salt and pepper noise and speckle noise. Results show that
the watermarking scheme is robust against the attacks.

4.4 CONCLUSION
Since ancient times, there has been an effort to hide information within
seemingly harmless information to avoid unwanted attention. The science of concealing
information was later to be known as steganography and the current technology of
Digital Watermarking has taken its root from it. The term watermark in terms of
digital data was taken from the concept of watermarks used to prevent faking of currency
notes. Watermarking deals with embedding information like name of the creator, status,
recipient, etc. into the host data in such a way that it remains transparent or undetectable.
The watermark information should be embedded in such a way that this should not
be detectable and removable even after many spurious or innocuous attempts.
Watermarking can be done for any form of digital data text, image, audio, or video
where copyright needs to be protected. Digital Watermarking is emerging as a favorite
technique over traditional encryption for digital rights management (DRM). A lot of
research is still going on and new methods are emerging. A new technique is proposed of
invisible watermarking. Extracted image at the target shows excellent visual quality as
well.
25

4.5 FUTURE WORK

In this project, knapsack algorithm is used to generate public key and private key
some super increasing sequence is taken to generate the keys. But some other way or
some other algorithm can be tried to generate the keys in future.

For speckle noise the psnr value is very low, which shows the visibility
of the embedded signature, also the extraction is not proper when this noise is attacked.
So some work has to be done in improving the quality of the image in the case of
speckle noise attack.
Furthermore, multi-watermark can be developed from our watermarking
strategy as long as watermark image blocks are similar to host image ones. It is
believed that the watermarking algorithm can be further developed. We will explore the
algorithm and experiment in the future.
26

APPENDIX 1
SOURCE CODING
To calculate Peak Signal to Noise Ratio value (PSNR):
function [psn] = psnr (original, target)
target=double (target);
[row col] = size (target);
original=double(original);
err = 0;
for i = 1: row
for j = 1: col
err = err + (original (i, j) - target(i,j))^2;
end
end
fprintf ('\nerr = %f \nrc = %f', err,row*col);
mse = double (err) / double ((row*col));
mse=double (mse);
psn = 10*log10 (65025/mse);
return;

Working of psnr calculation;

psnr is a function whose parameters are the original image and the target image.

Find the size of target image.

row and col will have the value of number of rows and number of columns in the target
image.

Err is a variable whose value is initialized to 0.

Then calculate the error using the formula

err=err+(original(i,j)-target(i,j))^2; where i and j values will be from 1 to row and 1 to


col.

This is the absolute error. Then calculate the mean square error (mse)
27

mse=double (err)/double((row*col))

psn = 10*log10 (65025/mse).

psn will give the value which should be greater than 35. if not the visually watermarking
is seen.

To convert from decimal to binary (d2b):


function [x] = d2b(a)
a = double(a);
x=[0,0,0,0,0,0,0,0];
pos=8;
if a==0
return ;
else
while a>0
x(pos)=mod(a,2);
a=floor(a/2);
pos=pos-1;
end
return ;
end

To convert from binary to decimal (b2d):


function [n]=b2d(x)
% x=[1,0,0,0,0,0,1,0];
sum=0;
n=numel(x);
for i=1:n
sum=sum+(x(i)*(2^(n-i)));
end
n=sum;
28

return ;
end.

d2b is a function to convert from decimal to binary .

b2d is a function to calculate from binary to decimal.

Working of d2b:

Deb is the function name, whose input is a and output variable is x.a, x is a byte value.

Initialize the 8 bits of x to be 0 and pos be a variable whose value is also initialized to be
8.calculate x (pos) =mod (a, 2).then decrement pos by 1.

Working of b2d:

b2d is the function name whose input variable is x and output variable is n.

Initialize sum to be 0.

There is function called numel, which will return the number of elements in the given
variable.

Calculate n=numel(x);

for i=1:n
sum=sum+(x(i)*(2^(n-i)));
end
n=sum;

Embed function:
function [out] = embed(input,sec)
pri = [1 2 4 10 20 40];
m=31;
n=110;
for i=1:size(pri,2)
pub(i) = mod(pri(i)*m,n);
end
k=1;
29

for i=1:size(input,2)
x = d2b (input (i));
for j=1:8
in(k) = x(j);
k=k+1;
end
end
in;
for i=1:size(pub,2)
if i==4
pub(i) = pub(i)+4; end
in(pub(i)) = sec(i);
end
%%% reconstruct %%%
k=1;
for i=1:size(input,2)
for j=1:8
x(j) = in(k);
k=k+1;
end
out (i) = b2d(x);
end.

Extract function:
function [ext] = extract(out,pri)
m=31;
n=110;
for i=1:size(pri,2)
pub(i) = mod(pri(i)*m,n);
end
k=1;
30

for i=1:size(out,2)
x = d2b(out(i));
for j=1:8
ou(k) = x(j);
k=k+1;
end
end

for i=1:size(pub,2)
if i==4
pub(i) = pub(i)+4;
end
ext(i) = ou(pub(i));
end
31

4.3 SCREEN SHOTS


This is the gui that comes when we run or press F5 in Matlab.

Figure 4.3.1 GUI Design

.
32

4.3.1 BROWSE AND SELECT THE HOST IMAGE

When we click the browse button, we will be getting this dialog box to choose the
host image.

Figure 4.3.2 Browsing window


33

4.3.2 AFTER SELECTING THE COVER IMAGE

Cover image is selected and displayed in the cover image axis

Figure 4.3.3 Cover image is selected

4.3.3 ENTER THE SIGNATURE IMAGE NAME


34

The signature image file name is entered in the text area that is available in the
gui.Then click watermark button. So that the watermarking starts.

Figure 4.3.4 Signature image is entered


35

4.3.4 COMPOSITE IMAGE

Composite image is displayed. PSNR value is the difference between the cover
image and the watermarked image.

Figure 4.3.5 Composite image

.
36

4.3.5 BROWSE THE COMPOSITE IMAGE


The difference image will show where the signature image is embedded in the
host image

Figure 4.3.6 PSNR value

.
37

4.3.6 SELECT THE TYPE OF ATTACK

If no attack is choosed, then while extracting the signature, the original signature
is extracted properly.

Figure 4.3.7Type of image is selected

.
38

4.3.7 EXTRACTED SIGNATURE IMAGE

After selecting the type of attack. In the attacked image axis, the attacked image is
displayed

Figure 4.3.8 Browse for watermarking image

.
39

4.3.8 EXTRACTED IMAGE

When we click the watermark extraction button. The extracted image is displayed
in another figure. The difference between the original image and the extracted signature
is shown by using the psnr value.

Figure 4.3.9 Extracted signature image


40

4.3.9 SALT AND PEPPER NOISE

If we select salt and pepper noise. The following will be the output.

Figure 4.3.10 Salt and pepper noise .


41

4.3.10 EXTRACT SIGNATURE FROM THE ATTACKED IMAGE

After the salt and pepper noise is selected, the attacked image will be displayed as
shown in the figure

Figure 4.3.11 Attacked image

.
42

4.3.11 EXTRACTED SIGNATURE FROM THE ATTACKED IMAGE

This figure shows the extracted image from the attacked watermarked image.

Figure 4.3.12 Extracted signature from the attacked image


43

4.3.12 SPECKLE NOISE

When the speckle noise is selected. The attacked image will look like this figure.

Figure 4.3.13 Speckle noise


44

4.3.13 EXTRACTED IMAGE FROM THE SPECKLE NOISE

After the speckle noise id attacked on the composite image. The extracted
signature will look like the above figure.

Figure 4.3.14 Extracted Image from the Speckle Noise


45

4.4. TEST CASES


There are three test cases.
Test case id: 1
Test data : .jpg format
Expected result: watermarked image in which signature is embedded in a .jpg type of
image.

Figure 4.4.1 Embedded image using .jpg image


46

Test case id: 2


Test data: .bmp format
Expected result: watermarked image in which signature is embedded in a .bmp type of
image.

Figure 4.4.2 Embedded image with a .bmp type of image.

.
47

Test case id: 3


Test data: a class of image (ex: flower image).
Expected result: Watermarked image in which signature is embedded in a flower image.

Figure 4.3.32 Embedded image with a class of image


48

REFERENCES

[1] Min Wu, Member, IEEE, and Bede Liu, Fellow, IEEE, Data Hiding in Binary Image
for Authentication and Annotation, IEEE Trans. Image Processing, vol. 12, pp. 696705,
June 2003.
[2] Bartolini.F, Tefas.A, Barni.M and Pitas.I, Image Authentication Techniques for
Surveillance Applications, IEEE Proceedings, Vol.89, No. 10, October 2001.
1. Yusuk Lim, Changsheng Xu and David Dagan Feng, Web based Image
Authentication Using Invisible Fragile Watermark, 2001, Pan-Sydney Area
Workshop on Visual Information Processing (VIP2001), Sydney, Australia.
2. Wen Chung Kuo, Chin Chih Lin and Jiin Chiou Cheng, Design a Data Hiding
Scheme using RSA, IEEE Int. Workshop VLSI Design & Video Tech. Suzhou,
China, May 28-30, 2005.
3. Haiyong Liao and Ruisong Ye A Novel Digital Image Watermarking Approach
Based on Image Blocks Similarity 2008 Congress on Image and Signal
Processing
49

You might also like