This project demonstrates how to embed an MP3 audio file invisibly into a grayscale image and later recover it. Two watermarking methods are implemented:
- Byte-level embedding: Each pixel stores one full byte of the audio data.
- Bit-level embedding (LSB): Each audio byte is spread across 8 least-significant bits (LSBs) of consecutive pixels.
- Encode and decode raw MP3 audio into an image without noticeable distortion.
- Support for Byte-level and Bit-level (LSB) watermarking.
- Metadata embedding for reliable recovery (start position, step, data length).
- Robust handling of grayscale images (color images are converted to grayscale automatically).
- Lossless watermark storage using BMP format (avoids JPEG compression artifacts).
- Input: Path to a directory containing an
.mp3file. - Output: A vector of raw bytes extracted from the MP3 file.
- Embeds audio bytes directly into pixels of a grayscale image.
- Metadata (start row, start column, step, length) is stored in the first row.
- Output: Watermarked image
waterMarker_byte.bmp.
- Extracts raw bytes from a watermarked image created by byte-level encoding.
- Output: Reconstructed audio file
recovered_byte.mp3.
- Embeds audio data at the bit level by storing each bit in the LSB of a pixel.
- Uses 32-bit metadata fields for robustness.
- Output: Watermarked image
waterMarker.bmp.
- Extracts embedded bits from an LSB watermarked image.
- Output: Reconstructed audio file
recovered.mp3.
- MATLAB R2020a or newer
- Input image in PNG format
- Audio file in MP3 format
- Output watermarked images are saved in BMP format
- Capacity Check:
- Byte-level: Each pixel stores 1 byte. Capacity ≈ available pixels.
- Bit-level: Each byte requires 8 pixels. Capacity ≈ available pixels ÷ 8.
- Metadata Consistency: Parameters
start_r,start_c,step, andnum_byte_voisemust be consistent between encoding and decoding. - File Formats: Always use BMP as the watermarked output format to avoid compression loss.
- Limitations: The watermark is not robust against image transformations (compression, resizing, filtering). This project demonstrates basic steganography, not robust watermarking.
- Activate and improve the capacity check for the byte-level method.
- Add key-based pseudo-random embedding for higher security.
- Implement progress reporting and error logging.
- Support for larger files via compression or segmentation.
This project is licensed under the MIT License. See LICENSE for details.
Project author: Shady Nikooei - Digital Image Processing