Friday 10 August 2012

WEEK 2 FYP 2



Title:
Least Significant Bit Source Code

Objective:
To gain and generate the coding for Image Steganography by using LSB method

Content/Result:
For method 1, I inserted the binary number of hidden image into the binary number of cover image. And the embedded image is saved with Bitmap format. The step involved in LSB coding is:

  1. read the cover and hidden image
  2. cover the cover image into binary matrix
  3. hide the hidden image into the matrix of cover matrix
  4. update the binary matrix of the cover image
  5. convert back the update binary matrix of cover + hidden into numerical
  6. extract the hidden image
  7. update the binary matrix of the cover image

Some of the coding examples is as below:

 function [I_image_rev] = lsb_image(coverimg, hiddenimg)

%% read the cover and hidden images
I_image = coverimg;
I_hidden = hiddenimg;
[m,n,o]=size(I_image);
[m1,n1] = size(I_hidden);

%% cover the cover image into binary matrix
for i=1:m,
    for j=1:n,
        for k=1:o,
            I_image_bin{i,j,k} = {dec2bin(I_image(i,j,k),8)};
        end
    end
end

%% hide the hidden image into the matrix of cover matrix
for i=1:m1,
    for j=1:n1,
            I_image_hidden{i,j} = {dec2bin(I_hidden(i,j),8)};
            
            binaryof_I_image_hidden = cell2mat(I_image_hidden{i,j});
            
            binaryof_I_image_bin_1st_R = cell2mat(I_image_bin{(i-1)*3+1,j,1});
            binaryof_I_image_bin_1st_G = cell2mat(I_image_bin{(i-1)*3+1,j,2});
            binaryof_I_image_bin_1st_B = cell2mat(I_image_bin{(i-1)*3+1,j,3});
            binaryof_I_image_bin_2nd_R = cell2mat(I_image_bin{(i-1)*3+2,j,1});
            binaryof_I_image_bin_2nd_G = cell2mat(I_image_bin{(i-1)*3+2,j,2});
            binaryof_I_image_bin_2nd_B = cell2mat(I_image_bin{(i-1)*3+2,j,3});
            binaryof_I_image_bin_3rd_R = cell2mat(I_image_bin{(i-1)*3+3,j,1});
            binaryof_I_image_bin_3rd_G = cell2mat(I_image_bin{(i-1)*3+3,j,2});
            binaryof_I_image_bin_3rd_B = cell2mat(I_image_bin{(i-1)*3+3,j,3});
            


Conclusion:
For this method, the 8th bit of each byte of the image is changed to the bit of secret message. For 24 bit image, the colours of each component like RGB (red, green and blue) are changed.






No comments:

Post a Comment