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:
We have used Discrete Cosine Transform(DCT) method for hiding test messages in a cover image.
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.
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.
- 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"
- Change the directory to Retrieve Message
- Save the stego image generated in the Retrieve Message Directory here
- Run the notebook
- The hidden message will be saved in the secret_message file
We have used Discrete Wavelet Transform(DWT) method for hiding a secret image in a cover 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.
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.
- 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"
- Change the directory to Retrieve Image
- Save the stego image and cover image(generated in the Embed Image Directory) in Retrieve Image Directory
- Run the notebook
- The secret will be saved in the same directory