Image Steganography Gaming Project in C++

Explanation

  1. Include Libraries: The program includes the OpenCV library for image processing and standard I/O libraries for handling input and output.
  2. Encode Message:
    • Message Length Check: Verifies that the message can fit within the image.
    • Convert Message to Binary: Converts each character of the message to an 8-bit binary representation and concatenates them.
    • Add Terminator: Appends a binary terminator (00000000) to mark the end of the message.
    • Hide Binary Message: Embeds each bit of the binary message into the least significant bit (LSB) of the pixel values of the image. Each color channel of each pixel is modified accordingly.
  3. Decode Message:
    • Extract Binary Message: Reads the LSB of each color channel to reconstruct the binary message.
    • Terminate Reading: Stops reading when the terminator (00000000) is detected and converts the binary message back to text.
  4. Main Function:
    • Load Image: Loads an image from a file.
    • Encode Message: Calls encodeMessage to hide a predefined message in the image.
    • Save and Reload Image: Saves the image with the hidden message and then reloads it.
    • Decode Message: Calls decodeMessage to extract and print the hidden message.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top