Vous êtes sur la page 1sur 52

Implementation of steganography on various datasets

By: Shiladitya Mandal & Ankit Vikrant Project Mentor: Mr. Manoj Pandya

Overview
Spatial domain steganography DCT domain steganography Steganography for indexed images

A watermarking application for BISAG

Before we start!
Language : C IDE: Visual Studio 2010 External Libraries used : OpenCV 2.1

SPATIAL DOMAIN STEGANOGRAPHY

Hide & Seek: Sequential


If we consider a 8-bit image, each pixel value is an unsigned integer in the range 0-255. If we edit the least significant bit(LSB) of every pixel value, it would cause negligible visual difference!

LSB plane of a sample image

since our secret message/image is a stream of bits , we can simply replace the pixel LSBs with the bits of the message.

Pros and Cons


Pros Simple and fast to implement, almost lossless Cons Might cause significant statistical differences such as histograms and PSNR Also, transformations like compression or resizing will damage the covert data.

DEMO 1

Carrier image

Secret image

After encoding

Cover Image

Stego Image

After encoding one wouldnt be able to distinguish between the original file and the one after embedding!

Hide & Seek: Randomized


Replacing LSBs sequentially might make it easier for the intruder to decode the message if suspected. Instead, we can embed the message bits in some random pixels! These random pixel values will be generated by a Pseudo Random Number Generator(PRNG) based on a password key provided at the encoding stage. Pros added security with a stego-key system. Cons once again, statistical noise is produced, and low robustness to compression, etc.

Improved LSB technique


This method also uses a stego-key provided to the encoder and a PRNG. Another way of storing information sequentially securely instead of directly replacing the LSB of pixels with the message bits, we generate random pixel bit locations(2 to 8) and compare the bit value at that location with the message bit. If they are equal, the LSB is set to 1, else set to 0. The method of generating the random numbers is Discrete Logarithm.

Demo2
Secret message embedded:

Copyright 2012 @ BISAG. In Association with BITS Pilani

TRANSFORM DOMAIN STEGANOGRAPHY

Transform Domain
Spatial domain steganography prone to data loss if cover image is cropped or compressed. Transform domain comes to the rescue! Embedding in the transform domain spreads it throughout the spatial domain. Any change in one coefficient in a transform domain will spread across the entire image in spatial domain.

Discrete Cosine Transform


DCT( g(x,y,u,v) ) and IDCT( h(x,y,u,v) ) have the same form.

TECHNIQUES OF STEGANOGRAPHY IN THE TRANSFORM DOMAIN

Jsteg
Similar to the simple sequential LSB algorithm in the spatial domain. JSteg algorithm only differs from the Hide & Seek algorithm because it embeds the message data within the LSBs of the DCT coefficients, rather than its pixel values in the spatial domain.

Proposed technique:
Encoding For each 8x8 block extracted from the cover image perform the following operations: 1. Shift all elements of the block by CF(compression factor)=2^k where k should be less than 8. For steganography, CF of 4 or less is preferred. 2. Take DCT to obtain the matrix T(u,v).

3. Quantization: T1(u,v)=round(T(u,v)/Z(u,v));

A Standard Quantization Matrix

4. Apply simple sequential LSB algorithm on the matrix obtained to encode the secret message. 5. Post encoding process: Simply reverse the process used before step 4. 5.1 Convolute the matrix obtained in 4. with the quantization matrix Z(u,v) to get T2(u,v). 5.2 Follow this by taking the inverse DCT of the matrix T2(u,v). 5.3 Now, add the CF chosen in 1. to the above matrix which gives us the final processed block.

Original Sub-image

Decompressed Sub-image

Decoding process: This too follows the same 5 steps as above except in step4 where we extract the LSB of each element of the matrix to reconstruct the hidden message provided the size of the hidden message.

Outguess
Similar to the Randomized Hide and Seek algorithm in spatial domain. PRNG helps to randomly embed the bits of the secret message in the image in transform domain making the hidden message highly covert. Encoding: After obtaining the quantized DCT in this method, the coefficients are shuffled into a seemingly random order using a PRNG according to a seed k.

The message data is then embedding using the same technique as for JSteg before finally inversing the shuffle such that the coefficients are back in the correct positions. Decoding: -Obtain the quantized DCT and then shuffle the coefficients using the same seed k that was used before for the PRNG. -We can then extract the LSBs from the matrix elements sequentially to reconstruct the covert data.

STEGANOGRAPHY FOR INDEXED IMAGES

Indexed Images
The pixel values in indexed images are indexes of a palette defined for the image. In this way color images can be seen in single channel images.

Changing the LSB will not be of any help as two consecutive colors in the palette might have significant visual difference!

Simple palette extension


So, instead of changing the pixel values, we can extend the existing palette into 2 copies of itself. Referencing a color from the first two lines could mean "message bit is 0", and referencing the same color from the lower two lines could mean "message bit is 1".

Theoretical summary Spatial steganography


Security Statistical Noise Robustness Sequential Low High Low

Randomised

High

High

Medium

Secure Sequential

High

Low

Low

Experimental results
Difference in image histograms Difference in LSB plane images. PSNR Peak Signal to Noise Ratio PSNR determines the overall statistical noise introduced in an image or a signal

PSNR

MSE: Mean-Square error. x: width of image. y: height. x*y: number of pixels

Demo 1 ( continued)

Carrier : 1600 x 1200 pixels

secret image : 449 x 359 pixels

Histogram comparison

You can make out the difference in their histograms easily! ( this is the histogram of only the R plane )

Demo 2 (contd.)
Secret message embedded:

Copyright 2012 @ BISAG. In Association with BITS Pilani

Histogram comparison

PSNR Results of sample tests

Figure: Dolphin

Figure: City

Figure: BITS

Figure: Circuit

Sample tests simple sequential


Dimension
1600 x 1200 x 3 720 x 612 x 3 540 x 540 468 x 448

Message Type
Color image ASCII text ASCII text Grayscale image

Dimension
449 x 359 x 3 55 bytes 55 bytes 128 x 128

PSNR (dB)
48.32 77.78 72.56 54.18

Sample tests secure sequential


Dimension
1600 x 1200 x 3 720 x 612 x 3 540 x 540 468 x 448

Message Type
Color image ASCII text ASCII text Grayscale image

Dimension
449 x 359 x 3 55 bytes 55 bytes 128 x 128

PSNR (dB)
48.33 77.85 72.26 54.08

A Watermarking Application for BISAG

Watermarking Application
When pictures are zoomed in/out in any general photo viewer, even the watermark is enlarged! Objective To develop a basic photo viewer where the watermark always has constant size.

Google Map view

Google Map view - zoomed in

How we did this


Made a user defined data structure.
struct wateripl { IplImage *img; IplImage *water; };

All operations were done on this structure! IplImage is structure for image in OpenCV

Mouse movements
To zoom in/out, the user can simply draw boxes on the image, and that portion is enlarged and shown on an adjacent window. Use of Mouse callback function cvSetMouseCallback(win",callback,(void*)); We used the MOUSEMOVE, LBUTTONDOWN, LBUTTONUP

Design of watermark
A direct way cvAddWeighted ( img1, wt1, img2, wt2, alpha) It simply returns a matrix which is a result of weighted addition of 2 matrices! To insert a transparent watermark Output=cvAddWeighted(inp,x,water,1-x,0); X= transparency

But color space?


The default color space used by OpenCV is RGB! Represents cartesian coordinate system. Any change in any plane changes the color

We want a faint watermark which should not tamper the color of any portion of an image, esp. a map!

Solution HSV color space! H for Hue, S for saturation, and V for intensity

HSV Color Model

Watermark size: 50 x 100 pixels Position: Top Left

Future plans
Add more user friendly features such as zoom in on click and mouse scroll. Zoom output display in same window as original image. Copyright symbol at multiple positions but faintly small change in intensity Feature of removing watermark

Vous aimerez peut-être aussi