Projeto ITP - Esteganografia 1.0
|
Defines a dinamically allocated PPM image and provides various methods to manipulate and access the image data. More...
#include <Image.h>
Public Member Functions | |
Image () | |
Default constructor for the Image class. | |
Image (int w, int h) | |
Constructor to initialize an image with given width and height. | |
int | GetWidth () const |
Gets the Width object. | |
int | GetHeight () const |
Gets the Height object. | |
void | AllocatePixels () |
Memory allocation of the matrix of pixels, which is fundamental in defining any Image object. | |
void | LiberatePixels () |
Deallocates the memory previously allocated by the AllocatePixels() function, as well as the memory alocated by the array of the pixels' 'R', 'G' and 'B' values. | |
void | GetPixels () |
Function that fills in the matrix of pixels. | |
bool | ExtensionCheck (const string &input_text, const string &file_type) |
Function that checks if a string ends with the valid substring. | |
void | PrintPPM () const |
Function that prints out the parameters of a PPM image. Mostly used for testing purposes. | |
string | CreatePPM () const |
Function that creates a string containing all the data of a PPM image. | |
bool | ReadPPM (const string &file_name) |
Reads and dynamically stores the content of an image from a valid PPM file. | |
void | ShowArray () const |
Function that outputs a previously defined array of 'R', 'G' and 'B' values. Mostly used for testing purposes. | |
string | IntToBin (int num, int bits=8) |
Function that receives an integer value and converts it to binary. | |
void | CodeMsg (string msg) |
Main function used in encrypting and hiding an ASCII message inside the least significant bits (LSB) of a PPM image's pixels. | |
int | BinToInt (string bin_num, int index=0) |
Recursive function used to convert a binary value into an integer value. | |
void | DecodeMsg () |
Main function used in uncovering and decrypting an ASCII message inside the least significant bits (LSB) of a PPM image's pixels. | |
Defines a dinamically allocated PPM image and provides various methods to manipulate and access the image data.
|
inline |
Default constructor for the Image class.
|
inline |
Constructor to initialize an image with given width and height.
< This variable defines the size of the array of pixels, counting each R, G and B value as a separate unit of the array.
|
inline |
|
inline |
Recursive function used to convert a binary value into an integer value.
bin_num | String containing the binary value that will be converted into an integer. |
index | The index of the string. |
Base case: if the index reaches the end of the binary string.
Recursive call to calculate the value of the current and subsequent binary digits.
|
inline |
Main function used in encrypting and hiding an ASCII message inside the least significant bits (LSB) of a PPM image's pixels.
msg | Message that will be stored inside the image. |
The number of characters in the message.
Array that stores the ASCII values of each of the message's characters.
Fills in the chars[] array.
Stores the binary value of the number of characters in the message.
Modification of the first 8 bits of the array of 'R', 'G' and 'B' values, which store the message's size.
Modifies the bits of the array of 'R', 'G' and 'B' values which will store the actual message.
Index for each of the message's bits.
|
inline |
Function that creates a string containing all the data of a PPM image.
Gets the pixels from a previously defined array of pixels.
|
inline |
Main function used in uncovering and decrypting an ASCII message inside the least significant bits (LSB) of a PPM image's pixels.
String that stores the size of the message in binary.
Gets (in binary) the size of the message stored in the image from the first 8 bits of it's pixels' 'R', 'G' and 'B' values, previously stored in an array.
Adds the character '0' to bin_size.
Adds the character '1' to bin_size.
String that stores the ASCII message in binary.
Stores the size of the image as an integer value.
Gets (in binary) the message stored in the image, using the message's size and using the array of the pixels' 'R', 'G' and 'B' values.
Adds the character '0' to bin_msg.
Adds the character '1' to bin_msg.
String that stores the completely decoded message.
Repeats the process below until every character of the message has been decoded and stored.
Stores a binary value of a single character.
Gets 8 bits (or a single character) from the message in binary, then adds up so it does the same to the next bit (if there is a next bit).
Stores the decoded ASCII character as a char.
Pushes a new decoded character into the string that stores the message.
|
inline |
Function that checks if a string ends with the valid substring.
input_text | Text inputed into the function, which is to be checked. |
file_type | The substring which you wish to check if exists in the end of a given string. |
|
inline |
Gets the Height object.
|
inline |
|
inline |
Gets the Width object.
|
inline |
Function that receives an integer value and converts it to binary.
num | Integer value to be converted into binary. |
bits | The max size of the returned binary value. |
Base case: when there are no more bits to convert.
Determines the current bit in binary.
Recursive call to calculate the subsequent bits in binary.
|
inline |
Deallocates the memory previously allocated by the AllocatePixels() function, as well as the memory alocated by the array of the pixels' 'R', 'G' and 'B' values.
Deallocates the memory utilized by the array of the pixels' 'R', 'G' and 'B' values, used in the CreatePPM(), ReadPPM(), ShowArray(), CodeMsg() and DecodeMsg() functions.
|
inline |
Function that prints out the parameters of a PPM image. Mostly used for testing purposes.
|
inline |
Reads and dynamically stores the content of an image from a valid PPM file.
file_name | The name of a PPM file previously stored inside the source folder, which will be read by the function. |
Tests if the file does exist inside the source folder.
Tests if the file is in fact a P3/PPM file by looking at it's content.
Memory allocation of the array of pixels, used in decodification and codification.
Reads and stores in an array the pixels' 'R', 'G' and 'B' values.
|
inline |
Function that outputs a previously defined array of 'R', 'G' and 'B' values. Mostly used for testing purposes.