|
| 1 | +# Image Steganography Using Two LSB Embedding |
| 2 | + |
| 3 | +This project implements a simple image steganography technique using the least significant bits (LSB) embedding method. The goal is to hide a secret image inside a cover image by replacing the least significant bits of the cover image with the bits from the secret image. The process includes both embedding and extraction functionalities. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | +- [Introduction](#introduction) |
| 7 | +- [Features](#features) |
| 8 | +- [Requirements](#requirements) |
| 9 | +- [Usage](#usage) |
| 10 | + - [Embedding Process](#embedding-process) |
| 11 | + - [Extraction Process](#extraction-process) |
| 12 | + - [MSE and PSNR Calculation](#mse-and-psnr-calculation) |
| 13 | +- [Output](#output) |
| 14 | + |
| 15 | +## Introduction |
| 16 | + |
| 17 | +Steganography is a technique of hiding information in other digital media. In this project, we hide a 64x64 grayscale secret image inside a 512x512 grayscale cover image using the 2 least significant bits of the cover image's pixels. This process ensures minimal distortion in the cover image while allowing the secret image to be extracted later. |
| 18 | + |
| 19 | +## Features |
| 20 | +- Embeds a secret image into a cover image using the two least significant bits (LSB). |
| 21 | +- Extracts the hidden secret image from the stego image. |
| 22 | +- Computes Mean Squared Error (MSE) and Peak Signal-to-Noise Ratio (PSNR) between images. |
| 23 | + |
| 24 | +## Requirements |
| 25 | + |
| 26 | +- Python 3.x |
| 27 | +- OpenCV (`cv2`) |
| 28 | +- NumPy |
| 29 | +- Matplotlib |
| 30 | + |
| 31 | +You can install the required libraries using the following command: |
| 32 | + |
| 33 | +```bash |
| 34 | +pip install numpy opencv-python matplotlib |
| 35 | +``` |
| 36 | + |
| 37 | +## Usage |
| 38 | +- ### Embedding Process |
| 39 | + The `Embedding_two_lsb` function hides the secret image into the cover image using the LSB method. The cover image and secret image are resized to 512x512 and 64x64 respectively before embedding. |
| 40 | +- ### Extraction Process |
| 41 | + The `Extraction_two_lsb` function retrieves the hidden secret image from the stego image. |
| 42 | +- ### MSE and PSNR Calculation |
| 43 | + The `mse_psnr` function calculates the Mean Squared Error (MSE) and Peak Signal-to-Noise Ratio (PSNR) between two images. These metrics help quantify the distortion between the original and stego images, and the original and extracted secret images. |
| 44 | + |
| 45 | +## Output |
| 46 | +The output includes: |
| 47 | + |
| 48 | +- The cover image and secret image displayed using Matplotlib. |
| 49 | +- The stego image after embedding the secret image. |
| 50 | +- The extracted secret image after applying the extraction algorithm. |
| 51 | +- The MSE and PSNR values. |
| 52 | +- ### Sample Output (PSNR): |
| 53 | + |
| 54 | +``` |
| 55 | +MSE between Cover Image and Stego Image: 0.1834 |
| 56 | +PSNR: 55.4957 |
| 57 | +
|
| 58 | +MSE between Secret Image and Extracted Image: 0.0 |
| 59 | +PSNR: -999 (Perfect recovery, no error) |
| 60 | +``` |
| 61 | + |
1 | 62 |
|
0 commit comments