Skip to content

This is an image processing-based project in python using OpenCV which involves hiding data(in the form of text or image) in images(cover images) and then retrieving them using proper techniques.

Notifications You must be signed in to change notification settings

Natasha2001/Image_Steganography

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Image Steganography

Image steganography refers to hiding information i.e. text or image files in another image file. This hidden information can be retrieved only through proper decoding technique.

The method commonly used is the LSB method which involves changing the least significant bits(LSB) of the cover image pixels with the least significant bits(LSB) of the secret message/image. We have used more secure methods of image steganography:

Discrete Cosine Transform(DCT) method of Image Steganography

We have used Discrete Cosine Transform(DCT) method for hiding test messages in a cover image.

Algorithm

Algorithm to embed text message:-

Step 1: Read the cover image and split it into its RGB(red, green, blue) channels(the original DCT works on the cover image itself but in order to enhance security we have split it into RGB and then performed the operations).
Step 2: Read the secret message and convert it into binary.
Step 3: The blue channel image is broken into 8×8 blocks of pixels(blue channel is an arbitrary channel chosen, you may choose any).
Step 4: Subtract 128 from each pixel in a block.
Step 5: Apply DCT to each block.
Step 6: Compress each block using a quantization matrix.
Step 7: Extract the first pixel of each block.
Step 8: Find the LSB of the first pixel.
Step 7: Replace the LSB with bit of secret message.
Step 8: Expand each block using quantization matrix.
Step 8: Apply inverse DCT to each block.
Step 9: Add 128 from each pixel in a block.
Step 10: Merge the blocks to form the stego image.
Step 11: Write stego image.
Step 12: The stego image is then sent to the other person.

Algorithm to retrieve text message:-

Step 1: Read stego image.
Step 2: Stego image is split into its RGB(red, green, blue) channels.
Step 3: The blue channel is broken into 8×8 block of pixels.
Step 4: Subtract 128 from each block of pixels.
Step 5: Apply DCT to each block.
Step 6: Compress each block through a quantization table.
Step 7: Find the LSB of the first pixel for each block and store it in a list.
Step 8: Merge the LSBs in a group of 8 to find the binary code hidden.
Step 9: Convert each 8 bit into character.

Implementaion

To embed the message:-
  • Change the directory to Embed Message
  • Save the cover image with the name cover_image
  • Save the message to embed in message.txt file
  • Run the notebook
  • The image with the message hidden will be saved in the same directory with the name "stego_img.png"
To retrieve the message:-

Discrete Wavelet Transform(DWT) method of Image Steganography

We have used Discrete Wavelet Transform(DWT) method for hiding a secret image in a cover image.

Algorithm

Algorithm to embed the image:-

Step 1: Read cover image and split it into its RGB(red, green, blue) channels(the original DWT works on the cover image itself but in order to enhance security we have split it into RGB and then performed the operations).
Step 2: Read the secret image and split it into its RGB(red, green, blue) channels(the original DWT works on the secret image itself but in order to enhance security we have split it into RGB and then performed the operations).
Step 3: Each channel of the cover image is then decomposed using DWT into 4 non-overlapping sub-bands.These are LL (approximation coefficients), LH (vertical details), HL (horizontal details) and HH(diagonal details). The division is done by employing Haar filters.
Step 4: Secret image is also disintegrated into four sub-bands (LL, LH, HL, HH).
Step 5: Information contained in the LL sub-band of the secret image is embedded into LL bands of the cover image.
Step 6: Inverse transformation (IDWT) is performed to merge the sub-bands.
Step 7: The RGB channel images are then merged to form the stego image.

Algorithm to retrieve the image:-

Step 1: Read stego image and cover image.
Step 2: Stego and the cover image are split into its RGB(red, green, blue) channels.
Step 3: Each channel of the cover image is then decomposed using DWT into 4 non-overlapping sub-bands.These are LL (approximation coefficients), LH (vertical details), HL (horizontal details) and HH(diagonal details). The division is done by employing Haar filters.
Step 4: Stego image is also disintegrated into four sub-bands (LL, LH, HL, HH).
Step 5: Information contained in the LL sub-band of stego image is retrieved using the cover image and stego image.
Step 6: Inverse transformation (IDWT) is performed to merge the LL sub-band of stego image and LH,HL,HH sub-band of stego image.
Step 7: The RGB channel images are then merged to form the secret image.

Implementation

To embed the image:-
  • Change the directory to Embed Image
  • Save the cover image with the name cover_img
  • Save the secret image with the name secret_img
  • Run the notebook
  • The image with the image hidden will be saved in the same directory with the name "img_with_secret.png"
To retrieve the image:-

About

This is an image processing-based project in python using OpenCV which involves hiding data(in the form of text or image) in images(cover images) and then retrieving them using proper techniques.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published