Prerequisite: LSB based Image steganography using MATLAB
In LSB based Image steganography using MATLAB, we saw how to hide text inside an image. In this article, we are going to see given the stego image or the pixel values and the length of the text embedded as input, how to extract the text from it.
The extraction process is simple. We need to first calculate how many pixels is the text stored in. For example, the text “geeksforgeeks” has 13 characters. Each character is represented in 8 bits. So, the number of pixels in which the text is stored will be 13 * 8 = 104. Now after knowing this, we need to traverse through the image, one pixel at a time. We store the Least Significant Bit (LSB) of each pixel in an array extracted_bits. After extracting the LSBs of the required pixels, we need to take every 8 bits from extracted_bits and convert it to the corresponding character. In this way, the text stored in the stego image can be extracted.
In this article, we take the pixel values of the image obtained in the prerequisite article. The values are stored in xlsx format. The message embedded in the image is “geeksforgeeks”.
Note: To store the output image pixels into
.xlsx format, add the following lines of code to the end of the previous code:
Here is a screenshot of the input image and the stego image obtained from the prerequisite article:
Input : A screenshot of the pixel values of the image:
Output : geeksforgeeks
The input file in xlsx format is given here: input_image.xlsx
Below is the implementation in MATLAB:
As we can see the output, the text was extracted from the pixel values and result was diplayed to the command window.
- Image based Steganography using Python
- LSB based Image steganography using MATLAB
- Image Steganography in Cryptography
- Text Detection and Extraction using OpenCV and OCR
- Python | Foreground Extraction in an Image using Grabcut Algorithm
- Project Idea | (Model based Image Compression of Medical Images)
- Project Idea | (Optimization of Object-Based Image Analysis with Super-Pixel for Land Cover Mapping)
- Early Evidence of Steganography
- Image Processing in Java | Set 3 (Colored image to greyscale image conversion)
- Image Processing in Java | Set 6 (Colored image to Sepia image conversion)
- Image Processing in Java | Set 4 (Colored image to Negative image conversion)
- Image Processing in Java | Set 5 (Colored to Red Green Blue Image Conversion)
- Image Processing in Java | Set 7 (Creating a random pixel image)
- MATLAB | Converting a Grayscale Image to Binary Image using Thresholding
- Image Edge Detection Operators in Digital Image Processing
- Image Processing in Java | Set 8 (Creating mirror image)
- Image Processing in Java | Set 11 (Changing orientation of image)
- Getting started with Scikit-image: image processing in Python
- Image Processing in Java | Set 10 ( Watermarking an image )
- MATLAB | RGB image to grayscale image conversion
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.