Saturday, 11 January 2014

LSB Substitution Steganography MATLAB Implementation.

Basically there are main four mediums in which steganography is to be carried out. These four mediums are Text, Image, Audio/Video and Protocol. Image stegnography plays important role in stenographic field. Image stegnography is divided into Spatial domain and Transform domain. Spatial domain further divided into simple LSB (least significant bit) substitution, LSB matching and PVD (pixel value difference). Transform domain is one of most significant domain in image stegnography.
In transform domain DCT (discrete cosine transform) and DWT (discrete wavelet transform) are used. DCT belongs to a lossy compression field. DWT is used for both lossy as well as lossless compression.

Basic Types of Stegnography
 
Spatial Domain Steganography:

Basically spatial domain is divided into LSB (least significant bit) substitution, LSB matching and PVD (pixel value difference). In this domain all operations are directly concerned with the image pixels.  


Least Significant Bit (LSB) Substitution:
The principle involved in this method is to replace all LSB bits of pixels of the cover image with secret bits. This method embeds the fixed-length secret bits in the same fixed length LSBs of pixels. Although this technique is simple, it generally causes noticeable distortion when the number of embedded bits for each pixel exceeds three. 


LSB Substitution (a) Image having size 2*2, (b) Binary format of image (a), (c) Binary secret data, (d) LSB substitution-embedding (c) into (b), (e) Final image after substitution
 
Above figures shows you detailed information about LSB substitution method. Figure (a) is a original image having size of 2*2. Figure (b) shows binary format of image. Figure (c) is a secret image; this image will be embedded into (b). Figure (d) is a stego object in which secret data is embedded. Embedded data is indicated by bold font and finally figure (e) is a modified image after embedding process. 
  
Advantages
1. This method having high embedding capacity. This method directly replaces LSBs of all pixels of image.
2. Second advantage of this method is that it is easily implementable. Algorithms proposed for LSB substitution method are very easy for implementation.

Limitations
1. This method is easily detectable. Steganalysis is very easy because LSBs of each pixels are directly replaced by secret bits.
2. Quality of stego image is very poor because LSBs of each pixel is replaced. Quality of stego image drastically decreases if more than one secret bit embedded into cover image pixels. 

MATLAB Program:  

Function of Message Embedding:

function out_emd_img=embed1(img,sec_msg)
%This function embeds message into cover image.....
%output=====
       %out_emd_img=message embedded image
%input======
       %img=input image
       %sec_msg=secrete message
[r c p]=size(img);
len=length(sec_msg);
j1=1;
count=1;
if(length(sec_msg)<=(r*c))
    for i=1:r
        for j=1:c
            if(count<=len)
                img(i,j)=bitset(img(i,j),1,sec_msg(1,j1));
                j1=j1+1;
                count=count+1;
            end
        end
    end
out_emd_img=img;
else
    disp('Opeartion is Invalid')
end
Test Application:
clc
a=[1 2 3;2 3 4;3 4 5];% Cover Image Matrix
s=[1 0 1 1 1 1 0];% Secrete Data
out_emd_img=embed1(a,s);


Output of the Program:

3 comments:

  1. Do you have a matlab program for retrieve or extract LSB hidden message?

    ReplyDelete