Secret Communication Using Digital Image Steganography
Secret Communication Using Digital Image Steganography
INTRODUCTION
1.1 Cryptography:
Why then pursue the field of information hiding? Several good reasons exist, the
first being that “security through obscurity” isn’t necessarily a bad thing, provided that it
isn’t the only security mechanism employed. Steganography for instance allows us to
hide encrypted messages in mediums less likely to attract attention. A garble of random
characters being transmitted between two users may tip off a watchful 3rd party that
sensitive information is being transmitted; whereas baby pictures with some additional
noise present may not. The underlying information in the pictures is still encrypted, but
attracts far less attention being distributed in the picture then it would otherwise.
1
This becomes particularly important as the technological disparity between
individuals and organizations grows. Governments and businesses typically have access
to more powerful systems and better encryption algorithms then individuals. Hence, the
chance of individual’s messages being broken increases which each passing year.
Reducing the number of messages intercepted by the organizations as suspect will
certainly help to improve privacy.
2
1.2 Steganography:
“Steganography is the art of hiding information in ways that prevent the detection of
hidden messages,”
3
message is present. Once this message detection can be reliably achieved, the
steganographic tool becomes useless.
Obviously, the less information is embedded into the cover-image, the smaller the
probability of introducing detectable artifacts by the embedding process. Another
important factor is the choice of the cover-image. The selection is at the discretion of the
person who sends the message. The sender should avoid using cover-images that would
be easy to analyze for presence of secret messages. For example, one should not use
computer art, charts, images with large areas of uniform color, images with only a few
colors, and images with a unique semantic content, such as fonts. Although computer-
generated fractal images may seem as good covers6 because of their complexity and
irregularity, they are generated by strict deterministic rules that may be easily violated by
message embedding.
Cryptography is the science of encrypting data in such a way that nobody can
understand the encrypted message, whereas in steganography the existence of data is
conceived means its presence cannot be noticed. The information to be hidden is
embedded into the cover object which can be text, image, audio or video so that the
appearance of cover object doesn’t vary even after the information is hidden.
To add more security the data to be hidden is encrypted with a key before
embedding. To extract the hidden information one should have the key. A stego object is
one, which looks exactly same as cover object with hidden information.
4
to be hidden is related to the cover object it is extended data or attribute of the cover
object, here our main intention is to stop piracy of digital data. Steganography is a very
powerful tool because, as the stated above, it can be very difficult to detect.
1.5 Stegosystem:
Emb: The message to be embedded. It is anything that can be represented as a bit stream
(an image or text).
Stego: Modified version of the cover that contains the embedded message,
fE: Steganographic function that has cover, emb & key as parameters.
5
Figure 1.2 Graphical version of the Stegosystem
The stego-object is then sent through the public channel. The warden, Wendy,
who is free to examine all messages exchanged between Alice and Bob, can be passive or
active. A passive warden simply examines the message and tries to determine if it
potentially contains a hidden message. If it appears that it does, she then takes appropriate
action else she lets the message through without any action. An active warden, on the
other hand, can alter messages deliberately, even though she may not see any trace of a
hidden message, in order to foil any secret communication that can nevertheless be
occurring between Alice and Bob. The amount of change the warden is allowed to make
6
depends on the model being used and the cover objects being employed. For example,
with images, it would make sense that the warden is allowed to make changes as long as
she does not alter significantly the subjective visual quality of a suspected stego-image.
7
LSB plane to thwart communication. In order to deal with an active warden Alice must
embed her message in a robust manner. That is, Bob should be able to accurately recover
the secret message despite operations like LSB randomizing, compression, filtering, and
rotation by small degrees, etc. performed by the active warden Wendy. Indeed, the
problem of embedding messages in a robust manner has been the subject of intense
research in the image processing community, albeit for applications other than
steganography, under the name of robust digital watermarking A robust digital watermark
is an imperceptible signal added to digital content that can be later detected or extracted n
order to make some assertion about the content. For example, the presence of her
watermark can be used by Alice to assert ownership of the content. Recent years have
seen an increasing interest in digital watermarking with many different applications,
ranging from copyright protection and digital rights management, to secret
communication.
8
message when the embedded signal is in the context of an active warden and a passive
warden, respectively.
Furthermore, we simply use the terms marking or embedding when the context of
discussion is general to include both active and passive warden steganography. The
techniques we present are novel and to the best of our knowledge, the first attempt at
designing general purpose tools for steganalysis. General detection techniques as applied
to steganography have not been devised and methods beyond visual inspection and
specific statistical tests for individual techniques like LSB embedding are not present in
the literature. Since too many images have to be inspected visually to sense hidden
messages, the development of a technique to automate the detection process will be very
valuable to the steganalyst. Our approach is based on the fact that hiding information in
digital media requires alterations of the signal properties that introduce some form of
degradation, no matter how small. These degradations can act as signatures that could be
used to reveal the existence of a hidden message. For example, in the context of digital
watermarking, the general underlying idea is to create a watermarked signal that is
perceptually identical but statistically different from the host signal. A decoder uses this
statistical difference in order to detect the watermark. However, the very same statistical
difference that is created could potentially be exploited to determine if a given image is
watermarked or not.
One goal has been to compile an introduction to the subject of steganography and
steganalysis. There exist a number of studies on various algorithms, but complete
treatments on a technical level are not as common. Material from papers, journals, and
conference proceedings are used that best describe the various parts.
Another goal has been to search for algorithms that can be used to implement for
the detection of steganographic techniques.
9
A third goal is to evaluate their performance of with different image quality
metrics. These properties were chosen because they have the greatest impact on the
detection of steganography algorithms
A final goal has been to design and implement the steganalysis detector in
MATLAB.
10
CHAPTER 2
WAVELET TRANSFORM
2.1 Overview:
Wavelets are mathematical functions defined over a finite interval and having an
average value of zero that transform data into different frequency components,
representing each component with a resolution matched to its scale.
The basic idea of the wavelet transform is to represent any arbitrary function as a
superposition of a set of such wavelets or basis functions. These basis functions or baby
wavelets are obtained from a single prototype wavelet called the mother wavelet, by
dilations or contractions (scaling) and translations (shifts). They have advantages over
traditional Fourier methods in analyzing physical situations where the signal contains
discontinuities and sharp spikes. Many new wavelet applications such as image
compression, turbulence, human vision, radar, and earthquake prediction are developed in
recent years. In wavelet transform the basis functions are wavelets. Wavelets tend to be
irregular and symmetric. All wavelet functions, w(2kt - m), are derived from a single
mother wavelet, w(t). This wavelet is a small wave or pulse like the one shown in Figure
2.1.
11
Figure 2.1 Mother wavelet w(t)
12
(a)w(2t) (b)w(4t) (c)w(8t)
The wavelets are called orthogonal when their inner products are zero. The
smaller the scaling factor is, the wider the wavelet is. Wide wavelets are comparable to
low-frequency sinusoids and narrow wavelets are comparable to high-frequency
sinusoids.
2.2 Scaling:
13
“compressed” the wavelet. The scale is inversely related to the frequency of the signal in
wavelet analysis.
2.3 Shifting:
Shifting a wavelet simply means delaying (or) hastening its onset.
Mathematically, delaying a function f(t) by k is represented by: f(t-k) and the schematic
is shown in Figure 2.3.
14
Low scale High scale
15
details are the low-scale, high frequency components. The filtering process is
schematically represented as in Figure2.5.
The original signal, S, passes through two complementary filters and emerges as
two signals. Unfortunately, it may result in doubling of samples and hence to avoid this,
downsampling is introduced. The process on the right, which includes downsampling,
produces DWT coefficients. The schematic diagram with real signals inserted is as shown
in Figure 2.6.
16
Figure 2.6 Decomposition and decimation
17
Figure 2.8 Wavelet Reconstruction
The wavelet analysis involves filtering and downsampling, whereas the wavelet
reconstruction process consists of upsampling and filtering. Upsampling is the process of
lengthening a signal component by inserting zeros between samples as shown in Figure
2.9.
18
2.5.4 Reconstructing Approximations and Details:
The reconstructed details and approximations are true constituents of the original
signal. Since details and approximations are produced by downsampling and are only half
the length of the original signal they cannot be directly combined to reproduce the signal.
It is necessary to reconstruct the approximations and details before combining them. The
reconstructed signal is schematically represented as in Figure 2.10.
19
Repeating the filtering and decimation process on the lowpass branch outputs
make multiple levels or “scales” of the wavelet transform only. The process is typically
carried out for a finite number of levels K, and the resulting coefficients are called
wavelet coefficients.
nL nH
j=-nl j=-nH
Although l and h are two separate output streams, together they have the same
total number of coefficients as the original data. The output stream l, which is commonly
referred to as the low-pass data may then have the identical process applied again
repeatedly. The other output stream, h (or high-pass data), generally remains untouched.
The inverse process expands the two separate low- and high-pass data streams by
inserting zeros between every other sample, convolves the resulting data streams with
two new synthesis filters s’ and t’, and adds them together to regenerate the original
double size data stream.
nH nl
To meet the definition of a wavelet transform, the analysis and synthesis filters s,
t, s’ and t’ must be chosen so that the inverse transform perfectly reconstructs the original
20
data. Since the wavelet transform maintains the same number of coefficients as the
original data, the transform itself does not provide any compression. However, the
structure provided by the transform and the expected values of the coefficients give a
form that is much more amenable to compression than the original data. Since the filters
s, t, s’ and t’ are chosen to be perfectly invertible, the wavelet transform itself is lossless.
Later application of the quantization step will cause some data loss and can be used to
control the degree of compression. The forward wavelet-based transform uses a 1-D sub-
band decomposition process; here a 1-D set of samples is converted into the low-pass
sub-band (Li) and high-pass sub-band (Hi). The low-pass sub-band represents a down
sampled low-resolution version of the original image. The high-pass sub-band represents
residual information of the original image, needed for the perfect reconstruction of the
original image from the low-pass sub-band
LL1 HL1
LH1 HH1
Figure 2.12 Sub-band Labeling Scheme for a one level, 2-D Wavelet Transform
21
The original image of a one-level (K=1), 2-D wavelet transform, with
corresponding notation is shown in Figure 2.12. The example is repeated for a three-level
(K =3) wavelet expansion in Figure 2.13. In all of the discussion K represents the highest
level of the decomposition of the wavelet transform.
LL1 HL1
HL2
LH1 HH1
HL3
LH2 HH2
LH3 HH3
Figure 2.13 Sub-band labeling Scheme for a Three Level, 2-D Wavelet Transform
Similarly, the high pass sub-band (Hi) is further decomposed into HLi and HHi.
After one level of transform, the image can be further decomposed by applying the 2-D
sub-band decomposition to the existing LLi sub-band. This iterative process results in
multiple “transform levels”. In Figure 2.13 the first level of transform results in LH 1,
HL1, and HH1, in addition to LL1, which is further decomposed into LH2, HL2, HH2, LL2
at the second level, and the information of LL2 is used for the third level transform. The
22
sub-band LLi is a low-resolution sub-band and high-pass sub-bands LHi, HLi, HHi are
horizontal, vertical, and diagonal sub-band respectively since they represent the
horizontal, vertical, and diagonal residual information of the original image. An example
of three-level decomposition into sub-bands of the image CASTLE is illustrated in Figure
2.14.
Figure 2.14 The process of 2-D wavelet transform applied through three transform levels
24
The DCT function:
. The idea behind it in regard to steganography is to hide the data bits in the least
significant coefficients.
25
• Take the inverse transform
• Store as regular image
26
CHAPTER 3
METHODS OF STEGANOGRAPHY
The proposed approach utilizes the sensitivity of the human visual system to
adaptively modify the intensities of some pixels in a high frequency components spatial
image (HFSI) of the cover image. The modification of pixel intensities depends on the
magnitude of the pixels in HFSI and also on the local features of the cover image. If the
contrast of the image is large (e.g., an edge), the intensities can be changed greatly
without introducing any distortion to human eyes. On the other hand, if the contrast is
small (e.g. a smooth), the intensities can only be tuned slightly. In this method, first the
cover image is passed through a filter to separate the high and low frequency components
of the image. The inverse transform of both the images is computed. Now the pixels
values of HFSI are modified depending on the magnitude of the pixel i.e. more the
magnitude more the Least Significant Bits (LSB's) of that pixel are changed and also the
local features of cover image are considered. Now both the LFSI (Low Frequency
27
components spatial image of cover image) and HFSI are added to form the stego - image.
At the receiver the reverse process is to be done to recover the message.
Maintaining the secrecy of digital information when being communicated over the
Internet is presently a challenge. Given the amount of cheap computation power available
and certain known limitations of the encryption methods it is not too difficult to launch
attacks on cipher-text. An ideal steganographic technique embeds message information
into a carrier image with virtually imperceptible modification of the image. Adaptive
steganography comes closer to this ideal since it exploits the natural variations in the
pixel intensities of a cover image to hide the secret message. The objective of
steganography is a method of embedding additional information into the digital contents
that is undetectable to listeners. We are investigating its embedding, detecting, and
coding techniques.
The idea behind the LSB algorithm is to insert the bits of the hidden message into
the least significant bits of the pixels. As the application domain of embedding data in
digital multimedia sources becomes broaden, several terms are used by various groups of
researchers, including steganography, digital watermarking, and data hiding. This paper
introduces a new, principled approach to detecting least significant bit (LSB)
steganography in digital signals such as images and audio. It is shown that the length of
hidden messages embedded in the least significant bits of signal samples can be estimated
with relatively high precision. The new steganalytic approach is based on some statistical
measures of sample pairs that are highly sensitive to LSB embedding operations. The
28
resulting detection algorithm is simple and fast. To evaluate the robustness of the
proposed steganalytic approach, bounds on estimation errors are developed. Furthermore,
the vulnerability of the new approach to possible attacks is also assessed, and counter
measures are suggested A detailed algorithm is presented along with results of its
application on some sample images.
A major advantage of the LSB algorithm is it is quick and easy. There has also
been steganography software developed which work around LSB color alterations via
palette manipulation. LSB insertion also works well with gray-scale images.
1 pixel:
Insert 101:
1 pixel:
(00 01 10 11)
Insert 0011:
29
(00 00 11 11)
Usually 24-bit or 8-bit files are used to store digital images. The former one
provides more space for information hiding however, it can be quite large. The colored
representations of the pixels are derived from three primary colors: red, green and blue.
24-bit images use 3 bytes for each pixel, where each primary color is represented by 1
byte. Using 24-bit images each pixel can represent 16,777,216 color values. We can use
the lower two bits of these color channels to hide data, then the maximum color change in
a pixel could be of 64-color values, but this causes so little change that is undetectable for
the human vision system. This simple method is known as Least Significant Bit insertion
Using this method it is possible to embed a significant amount of information with no
visible degradation of the cover image. Figure 3.11 shows the process.
30
Figure 3.1 Graphical representation of LSB insertion
31
3.5.1 Algorithm:
Step 1: Let the cover image is represented by c(x,y). It is then passed through a filter
with transfer function h(x,y) to separate high and low frequency components.
Where C(X, Y) represents Fourier Transform of the cover image. In this paper capital
letters representation for pixel is used for frequency domain and small letters for spatial
Representation.
Where LO(X, Y), HI(X, Y) represent low frequency and high frequency components of
cover image respectively, obtained after passing through the filter with cut off as stated
above.
Step 2: Inverse transform of both the frequency components is found out, known as HFSI
(High Frequency components Spatial Image) and LFSI (Low Frequency components
Spatial Image) separately.
Where lo(xy) and hi(x,y) are the spatial components of low and high frequencies in the
cover image respectively.
Step 3: Now message is embedded into HFSI image. The number of bits modified in a
pixel is made to depend up on its magnitude and also on the local features of the cover
image. Let the message is represented as m(x,y) and the embedding function as M[].
Step 4: Both the modified HFSI and unmodified LFSI are added to form stego - image.
Step5: At the receiver LFSI is subtracted from stego - image leaving modified HFSI
image.
32
mhi(x, y) = steg(x, y) - hi(x, y)
Step 6: Now the message is decoded from the Modified HTSI image using the stego –
key.
This type of reversible steganography directly modifies image pixels in the spatial
domain to achieve reversibility. Since this technique is easy to implement, offer a
relatively high hiding capacity, and the quality of the cover image can be easily
controlled, it has become a popular method for reversible steganography.
Reversible data embedding, which is also called lossless data embedding, embeds
invisible data (which is called a payload) into a digital image in a reversible fashion. As a
basic requirement, the quality degradation on the image after data embedding should be
low. An intriguing feature of reversible data embedding is the reversibility, that is, one
can remove the embedded data to restore the original image. From the information hiding
point of view, reversible data embedding hides some information in a digital image in
such a way that an authorized party could decode the hidden information and also restore
the image to its original, pristine state. The performance of a reversible data-embedding
algorithm can be measured by the following.
1) Payload capacity limit: what is the maximal amount of information can be embedded?
Our method can be applied to digital audio and video as well. We calculate the
differences of neighboring pixel values, and select some difference values for the
difference expansion (DE). The original content restoration information, a message
authentication code, and additional data (which could be any data, such as date/time
information, auxiliary data, etc.) will all be embedded into the difference values. In this
paper we will consider grayscale images only. For color images, there are several options.
One can decorrelate the dependence among different color components by a reversible
color conversion transform, and then reversibly embed the data in the decorrelated
components. Or one can reversibly embed each color component individually. Please
note that reversible data embedding is a fragile technique When the embedded image is
manipulated and/or lossy compressed, the decoder will find out it is not authentic and
thus there will be no original content restoration.
Obviously, most of the existing data hiding techniques are not reversible. For
instance, the widely utilized spread-spectrum based data hiding methods are not
invertible owing to truncation (for the purpose to prevent over/underflow) error and
round-off error. The well-known least significant bit plane (LSB) based schemes and are
not lossless owing to bit replacement without “memory.” Another category of data
hiding techniques, quantization-index-modulation (QIM) based schemes and , are not
distortion-free owing to quantization error.
Recently, some reversible marking techniques have been reported in the literature.
The first method is carried out in the spatial domain. It uses modulo 256 addition
(assuming here that eight-bit grayscale images are considered) to embed the hash value of
the original image for authentication. The embedding formula is Iω =(I+W)mod(256), in
which I denotes the original image, Iω the marked image, and W = W(H(I),K) the
watermark, where H(I) denotes the hash function operated on the original image I, and K
the secret key. Because of using modulo 256 additions, the over/underflow is prevented
and the reversibility is achieved. Some annoying salt-and-pepper noise, however, is
generated owing to possible grayscale value flipping over between 0 and 255 in either
direction during the modulo 256 addition.
The second reversible marking technique was developed in the transform domain,
which is based on a lossless multi resolution transform and the idea of patchwork. It also
35
uses modulo 256 addition. Note that no experimental results about this technique have
been reported. Another spatial domain technique was reported in that losslessly
compresses some selected bit plane(s) to leave space for data embedding. Because the
necessary bookkeeping data are also embedded in the cover media as an overhead, the
method is reversible.
Since these techniques aim at authentication, the amount of hidden data is limited.
The capacity of method, which is based on the idea of patchwork and modulo 256
addition, is also limited except that the hidden data exhibit some robustness against high
quality JPEG compression. Since it uses modulo 256 addition, it also suffers from salt-
and-pepper noise. As a result, the technique cannot be utilized in many applications. This
observation is valid to all lossless data hiding algorithms that use modulo 256 addition to
achieve reversibility.
The first reversible marking technique that is suitable for a large amount of data
hiding was presented. This technique first segments an image into non-overlapping
blocks, and then introduces a discriminating function to classify these blocks into three
groups: R(egular), S(ingular), and U(nusable). It further introduces a flipping operation,
which can convert an R-block to an S-block and vice versa. A U-block remains intact
after the flipping operation. By assigning, say, binary 1 to an R-block and binary 0 to an
S-block, all R- and S-blocks are scanned in a chosen sequential order, resulting in a
biased (meaning that the binary numbers of 1 and 0 are not balanced) binary sequence.
This biased binary sequence is losslessly compressed to leave space for data embedding
and the compressed bit sequence is embedded into the cover media as an overhead for
later reconstruction of the original image. In data embedding, the R- and S-blocks are
scanned once again and the flipping operation is applied whenever necessary to make the
changed R- and S-block sequence coincident with the to-be-embedded data followed by
the overhead data mentioned above. While it is novel and successful in reversible data
hiding, the payload is still not large enough for some applications. Specifically, the
embedding capacity estimated by authors ranges from 3 to 41 kb for a 512 *512 *8 cover
grayscale image when the embedding amplitude is 4 (the estimated average PSNR of the
marked image versus the original image is 39 dB) .
36
Another problem with the method is that when the embedding strength increases
in order to increase the payload, the visual quality of the marked image will drop severely
due to annoying artifacts. To increase the payload dramatically, a new lossless data
hiding technique based on integer wavelet transform (IWT) (a second generation wavelet
transform, which has avoided round-off errors) was developed recently. Because of the
superior decorrelation capability of wavelet transform, the selected bit plane compression
of IWT coefficients in high frequency sub-bands creates more space for data hiding,
resulting in a two to five times payload as large. Specifically, its payload ranges from 15
to 94 kb for a 512 512 8 grayscale image at the same (39 dB) PSNR of the marked
images compared with the original images.
The compressed residual and the payload data are concatenated and embedded
into the host signal via generalized-LSB modification method. The payload of this
technique is from 15 to 143 kb for a 512 512 8 grayscale image while the PSNR is
38 dB. Even though the payload is high, the PSNR is still not high enough. In this paper,
we propose a new reversible data embedding technique, which can embed a large amount
of data (5–80 kb for a 512 512 8 grayscale image) while keeping a very high visual
quality for all natural images, specifically, the PSNR of the marked image versus the
original image is guaranteed to be higher than 48 dB. It utilizes the zero or the minimum
point of the histogram (defined below) and slightly modifies the pixel
37
Figure 3.3 Histogram of an image
grayscale values to embed data. This technique can be applied to virtually all types of
images. Up to now, it has been successfully tested on different types of images, including
some commonly used images, medical images, texture images, aerial images, and all of
the 1096 images in CorelDraw database. The computation of our proposed technique is
quite simple and the execution time is rather short. Although the proposed lossless data
hiding technique is applied to still images, it is also applicable to videos which consist of
a sequence of images.
1. In LSB Technique only you are going to hide in least significant only. So, anyone can
easily retrieve the secret information.
3. After hiding the data in image by using LSB algorithm, if someone takes the Image
and compress the image means definitely lsb value will be change.
38
CHAPTER 4
4.1 Introduction:
Information hiding is a technique that inserts secret messages into a cover file, so
that the existence of the messages is not apparent. Research in information hiding has
tremendous increased during the past decade with commercial interests. Information
hiding techniques that are used today include watermarking and steganography. The
major concern of watermarking is to protect the ownership of a digital content, while
steganography is to embed secret messages into digital content so that the secret
messages are not detectable. All digital media, such as digital images, videos and audio
files, can be used to hide secret messages. However, digital images are often used for
steganography. This is because nature images usually have higher degree of redundancy,
which are suitable to embed information without degrading the visual quality of the
images. Moreover, images are widely used throughout the internet, which usually arouse
little suspicion than other digital media. Although many steganography techniques have
been developed for digital images, most of them are irreversible. That is, the original
image cannot be recovered to its original state after the extraction of the secret data.
At present, there is only a small amount of literature dealing with reversible data
hiding. However, most of them are focused on spatial domain; rare of them addressed the
reversibility on the compressed domain. In 2006, Chang and Lin proposed a reversible
data embedding mechanism for VQ compressed images.
39
process. However, the quality of the stego-image depends largely on a specially designed
codebook, and distortions of the stego-image may become unacceptable if a poor
codebook is selected.
In this paper, we propose a new lossless steganography scheme that embeds secret
data into AMBCT-compressed images. AMBTC is a well known lossy, block based
compression scheme. Each image block is compressed by using two quantization levels
and one bit plane. Due to its low complexity, low computational cost, and easy to
implement, AMBTC has gained wide interest in its further development, including image
compression and steganography. In our scheme, we will take the advantage of the order
of two quantization levels to hide secret data and achieve reversibility.
Secre Secre
t t
Data Data
40
blocks of n× n pixels. These image blocks can be viewed as k-dimensional vectors, where
k = n× n. Each image block is then compressed by using two quantization levels ai and bi,
and one bit plane B. Let oi be image block i, oi1,oi2,oi3,….oik be the pixels of image block
i, the two quantization levels ai and bi of AMBTC for block i can be calculated as follow:
Here qi denotes the number of pixels having a value higher than or equal to the
block mean oi. Once the two quantization levels, i.e., lower mean ai and higher mean bi
Once the quantization levels and the bit plane have been calculated, the
compressed code of this image block comes out as a trio of [84,132, (1000 1100 1100
41
1110)] . All image blocks are encoded with the same manner, until all the blocks are
processed.
42
The AMBTC compressed code C consists of a sequence of trios (two quantization
level a and b, and a bit plane B). Each trio (a, b, B) represents the compressed code for an
image block. Note that if we interchange two quantization levels a and b, and perform
Logical NOT operation on the bit plane B, the reconstructed AMBTC image blocks will
remain the same. Let R() denotes the reconstruction function for AMBTC compressed
image blocks with 3 parameters a, b and B, then the following equation always hold true
for every trio (a, b, B) :
R(a,b, B) ≡ R(b,a, )
where B is the resultant of the Logical NOT operation on the bit plane B. Equation
3 implies that the reconstructed image E and the recovered stego-image E’ are exactly the
same, i.e. E ≡ E′ .
Since the interchange of the quantization levels together with logical NOT
operation on bit the plane B does not change the value of decoded image blocks, we may
adopt this property to embedded one bit into each trio without losing any image quality.
The embedding procedures are described in the following section.
Step 2. Sequentially embed secret data into AMBTC encoded blocks. For each AMBTC
encoded block I with trio , if the corresponding embedded bit ei =1 , then the
43
trio is changed to . Otherwise, leave the trio remain
unchanged.
Step 3. Repeat step 1 and step 2 until the entire encrypted bit stream E is embedded.
The data extraction procedures are similar to that of the embedding procedures.
For each AMBTC compressed block i, if i i a < b, then the embedded secret bit ei =0 is
extracted. Otherwise, ei =1 is extracted. This procedure is repeated until all the encrypted
secret data Ebs have been extracted, and then decrypted using the secret key k to obtain
the original secret data S.
The peak signal to noise ratio (PSNR) is used to measure the distortion between the
original image and the stego image. The computation of PSNR is defined as
Here ij x denotes the original pixel value, and x ij denotes the processed pixel value. To
investigate the performance of our scheme, we compare the stegoimage quality,
recovered image quality.
44
CHAPTER 5
Selection of
Cover Image
Block
Sender (User) Separation
Trio
Formation
Stego Image
Formation
45
Figure 5.1 Formation of a stego image
Receiving of
Stego Image
Block
Sender (User) Separation
Trio
Formation
Original
Image
46
Figure 5.2 Extraction of a stego image
CHAPTER 6
MATLAB
6.1 Introduction:
The past decade has been a tremendous escalation in the use of computers. There
is a wealth of software packages available for analysis, design and manufacture of
devices, equipment, machinery and systems. There is no doubt that we have familiar with
computing techniques and have an awareness of these software packages. MATLAB is
such a software package that serves a vehicle for analysis and performance of a system.
6.2 Features:
47
• There are several ‘Tool boxes’ available for users of MATLAB. These tool boxes
are collections of functions written for special applications such as statistics,
communications, and control system design, signal processing and neural
networks.
MATLAB Includes Tools For:
1. Data acquisition.
2. Data analysis and Exploration.
3. Visualization and Image Processing.
4. Algorithm Programming and Development.
5. Modeling and simulation.
6. Programming and Application Development.
These tools allow you to solve the problems in Applied Maths, Physics,
Chemistry, Engineering and Finance – almost any application area that deals with
complex numerical calculations.
• Command Window: This is the main window characterized by the prompt ‘>>’.
• All commands, including those for running user written programs are typed here.
• Command history: All commands typed on MATLAB prompt in command
window get recorded, even across multiple sessions.
• Workspace: It lists all variable that have been generated so far and shows there
type and size.
• Edit Window: This where we write, edit, create and save our own programs in
files called ‘M-Files’.
MATLAB for Speech Recognition:
48
2. Symbolic math tool box.
3. General MATLAB instructions.
49
5. Signal plotting and analysis, Spectral analysis and filtering signals-SP tool.
The symbolic math tool box integrates powerful symbolic and variable precision
computing into MATLAB environment. This tool box supplement MATLAB numeric
and graphic facilities with several other types of mathematical computation.
In this worksheet we will continue to learn Matlab programming. The main goal is
that you by completing the worksheet can write your own Runge Kutta 4 ODE-
solver. The worksheet centers around a few examples, and it is important to
implement these examples, run them and carefully compare the output with the code.
The prerequisites for this worksheets are the worksheets Introduction to Matlab and
Introduction to programming in Matlab.
You have already encountered functions that are built in to Matlab. The sin() is a
function that takes an argument and returns an output. As you start to write your own
programs in Matlab you will need to create your own functions that takes one or more
arguments and does something with these arguments.
Example:
50
commands
The code above must be written in a separate m-file! The name of the file should coincide
with the name of the function. Remember to save the file with a .m after the file name.
gui_Singleton = 1;
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
else
51
gui_mainfcn(gui_State, varargin{:});
end
handles.output = hObject;
guidata(hObject, handles);
a=ones(256,256);
axes(handles.axes1);
imshow(a);
axes(handles.axes2);
imshow(a);
axes(handles.axes3);
imshow(a);
varargout{1} = handles.output;
if isequal(filename,0) | isequal(pathname,0)
else
a=imread(filename);
[r c p]=size(a);
52
if p==3
a=rgb2gray(a);
end
axes(handles.axes1);
imshow(a);
handles.input=a;
guidata(hObject, handles);
end
input=handles.input;
input=double(input);
len=row*col;
block=0;
Q1={};
Q2={};
z=1;
pop=get(handles.popupmenu1,'value');
switch pop
case 1
k=16;
53
case 2
k=64;
end
mid=sqrt(k);
handles.blokval=k;
bit=zeros(1,len);
bitcount=1;
for x=1:mid:row
for y=1:mid:col
count=0;
t=0;
s=0;
a = input(x:x+(mid-1),y:y+(mid-1));
block=block+1;
m=mean(mean(a));
m=round(m);
for i=1:mid
for j=1:mid
if a(i,j)>=m
bit(1,bitcount)=1;
bitcount=bitcount+1;
54
count=count+1;
p=a(i,j);
s=s+p;
else
bit(1,bitcount)=0;
bitcount=bitcount+1;
c=a(i,j);
t=t+c;
end
end
end
q1=floor(inv((k-count)) *t);
Q1{z}=q1;
q2=floor(inv((count))*s);
Q2{z}=q2;
z=z+1;
clear a;
end
end
lev=size(Q2);
levv=lev(2)*(k+2);
55
tt=1;
zz=1;
ww=1;
trio=zeros(1,levv);
while(zz<=lev(2))
trio(1,tt)=Q1{zz};
tt=tt+1;
trio(1,tt)=Q2{zz};
tt=tt+1;
for kk=1:k
trio(1,tt)=bit(1,ww);
tt=tt+1;
ww=ww+1;
end
zz=zz+1;
end
bitcount=bitcount-1;
save Q1 Q1;
save Q2 Q2;
56
save row row;
save block;
warndlg('Encoding completed');
guidata(hObject, handles);
load bit;
load q1;
load q2;
load count;
load row;
load col;
load block;
bit1=reshape(bit,[row,col]);
N=sqrt(block);
load trio;
trionew=trio;
Input=bit1;
original=Input;
target=Input;
57
fid = fopen('message.txt','r');
F = fread(fid);
s = char(F');
fclose(fid);
len=length(F);
handles.lend=len;
sz1=size(Input);
segblock=sz1(1)/N;
size1=sz1(1)*sz1(2);
sz2=size(F);
size2=sz2(1);
if (len*8)<=(N*N)
val=(N*N)-(len*8);
j=1;
for i=1:len
k=8 ;
while(k>=1)
x(1,j)=bitget(F(i),k);
k=k-1;
j=j+1;
end
58
end
for v=(len*8)+1:N*N
x(1,v)=0;
end
Mc=size(sz1,1);
Nc=size(sz1,2);
Mm=size(sz2,1);
Nm=size(sz2,2);
message_vector=round(F./256);
rand('state',34);
for (kk=1:100)
pn_sequence_h=round(rand(sz1/segblock,sz1/segblock));
end
size1=N*N;
sequence=reshape(abs(pn_sequence_h),[1,size1]);
for z=1:size1
xored(1,z)=xor(x(z),sequence(z));
end
mm=1;
gg=1;
segblock1=segblock^2;
59
for z=1:size1
if xored(1,z)==1
a = not(bit(gg:gg+(segblock1-1)));
end
mm=mm+(segblock1+2);
gg = gg +segblock1;
end
embedtrio=trionew;
kn=segblock1;
k1n=sqrt(kn);
blocksn=[];
[r c]=size(embedtrio);
len=r*c;
pp=1;
saf=1;
sa=k1n;
sbf=1;
sb=k1n;
while(pp<=len)
a=embedtrio(pp);
60
pp=pp+1;
b=embedtrio(pp);
pp=pp+1;
mn=1;
kj=1;
for jj=1:kn
if kj>k1n
mn=mn+1;
kj=1;
end
if embedtrio(pp)==0
output1(mn,kj)=a;
pp=pp+1;
kj=kj+1;
else
output1(mn,kj)=b;
pp=pp+1;
kj=kj+1;
end
end
blocksn(saf:sa,sbf:sb)=output1;
61
sbf=sb+1;
sb=sbf+(k1n-1);
if sb>row
saf=sa+1;
sa=saf+(k1n-1);
sbf=1;
sb=k1n;
end
end
axes(handles.axes2);
imshow(uint8(blocksn));
handles.out=blocksn;
guidata(hObject, handles);
warndlg('Embedding completed');
else
warndlg('The secret data size is greater than Cover Image-Reduce the data');
end
62
load trionew;
load Q1;
load Q2;
load sequence;
load xored;
load row;
load col;
len=handles.lend;
[r c] = size(trionew);
wid = r*c;
blok=handles.blokval;
e=1;
for y=1:(blok+2):wid-(blok+1)
if trionew(1,y)<trionew(1,y+1)
xr(e)=0;
else
xr(e)=1;
end
e=e+1;
end
i=1;
63
gg=1;
mm=1;
rand('state',34);
blok1=sqrt(blok);
for (kk=1:100)
pn_sequence_h=round(rand(row/blok1,row/blok1));
end
tot=row/blok1;
size1=tot*tot;
sequence=reshape(abs(pn_sequence_h),[1,size1]);
for i=1:size1
x(i)=0;
else
x(i)=1;
end
end
len2=len*8;
siz=size(x);
secret=x(1:len2);
64
place = [128 64 32 16 8 4 2 1];
cc=1;
asc=[];
for se=1:8:len2
binary=secret(cc:cc+7);
uu=(place(1).*binary(1))+(place(2).*binary(2))+(place(3).*binary(3))+
(place(4).*binary(4))+(place(5).*binary(5))+(place(6).*binary(6))+(place(7).*binary(7))+
(place(8).*binary(8));
if (exist('Output.txt'))
delete 'Output.txt';
end
fid = fopen('Output.txt','a');
fwrite(fid,char(uu),'char');
cc=cc+8;
end
fclose(fid);
output=zeros(1,65536);
load trionew;
load row;
k=handles.blokval
65
k1=sqrt(k);
blocks=[];
[r c]=size(trionew);
len=r*c;
pp=1;
saf=1;
sa=k1;
sbf=1;
sb=k1;
while(pp<=len)
a=trionew(pp);
pp=pp+1;
b=trionew(pp);
pp=pp+1;
mn=1;
kj=1;
for jj=1:k
if kj>k1
mn=mn+1;
kj=1;
end
66
if trionew(pp)==0
output1(mn,kj)=a;
pp=pp+1;
kj=kj+1;
else
output1(mn,kj)=b;
pp=pp+1;
kj=kj+1;
end
end
blocks(saf:sa,sbf:sb)=output1;
sbf=sb+1;
sb=sbf+(k1-1);
if sb>row
saf=sa+1;
sa=saf+(k1-1);
sbf=1;
sb=k1;
end
end
axes(handles.axes3);
67
imshow(blocks,[]);
handles.out=blocks;
warndlg('Decoding Completed');
guidata(hObject, handles);
reconstruct=handles.out;
input=handles.input;
reconstruct=double(reconstruct);
input=double(input);
[M N]=size(input);
MSE = sum(sum((input-reconstruct).^2))/(M*N);
PSNR = 10*log10(255*255/MSE);
PSNR=num2str(PSNR);
set(handles.psnr1,'String',PSNR);
set(handles.mse1,'String',MSE);
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
68
end
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
delete('Output.txt');
a=ones(256,256);
axes(handles.axes1);
imshow(a);
axes(handles.axes2);
imshow(a);
axes(handles.axes3);
imshow(a);
set(handles.psnr1,'String',' ');
set(handles.mse1,'String',' ');
69
close gui;
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
70
CHAPTER 7
71
7.1 Results:
72
Figure 7.1 New command window of MATLAB
73
Figure 7.2 Source code of our gui file
74
Figure 7.3 GUI window in the MATLAB
75
Figure 7.4 Message file which we are embedding
76
Figure 7.5 Selection of image for covering
77
Figure 7.6 Selected image shown in GUI
78
Figure 7.7 Completion of Decoding Process
79
Figure 7.8 Completion of Embedding Process
80
Figure 7.9 Text file extracted in file named output
81
Figure 7.10 Extracted output file
82
Figure 7.11 Completion of Decoding Process
83
Figure 7.12 Retrieving of Original Image
84
Figure 7.13 File erased successfully
85
7.2 Conclusion:
The steganography method presented here can also be combined with some
cryptography method to keep the data non-decipherable even if it is detected. The reserve
bytes in the header could also be used to encode a password or a key, which would have
to be matched to decode the rest of the data. In this method we can only use a square
image it can also be changed to any type of image. In addition to being vulnerable to
detection techniques, LSB is extremely vulnerable to corruption. That is, the integrity of
the hidden message can easily be destroyed. All the attacker must do is to randomize the
LSBs of the image. The attacker may not even know that it is a stego-image, but such
actions would destroy the secret message. Let us hope to overcome these disadvantages
in near future.
86
REFERENCES
4. Fridrich, J., Goljan, M., Du, R., ‘Detecting LSB steganography in color and gray-
scale images’, IEEE Multimedia Special Issue on Security, pp. 22-28, October-
November 2001.
5. Dumitrescu, S., Wu, X., Memon, N., 'On steganalysis of random lsb embedding in
continuoustone images', IEEE International Conference on Image Processing,
Rochester, New York, September 2002.
10. Anderson, R., R. Needham and A. Shamir, 1998. The steganographic file system.
Lecture Notes Comput. Sci., 1525: 73-82.
http://www.springerlink.com/content/jmw3k974qybrqd20
87
88