Code base obscuration (for images) 1.0
It implements different obscuration methods on portable images (.pgm and .ppm)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ObscurationPGM_main.cpp File Reference

Main file for the PGM image obscuration program using the Paillier cryptosystem. More...

Include dependency graph for ObscurationPGM_main.cpp:

Macros

#define FILE_EXT   ".pgm"
 

Functions

void afficherBarreDeChargement (size_t progress, size_t total)
 Displays a progress bar in the console.
 
int main (int argc, char **argv)
 Main function for the PGM image obscuration program.
 

Detailed Description

Main file for the PGM image obscuration program using the Paillier cryptosystem.

Author
Katia Auxilien
Date
April 2024

This program implements various image obscuration techniques on PGM images using the Paillier cryptosystem. The techniques include blurring, scrambling, pixelation, and selective encryption. The program takes a directory as input and applies the obscuration techniques to all PGM images in the directory. The obscured images are then saved to separate directories based on the technique used. The main function first checks if the correct number of arguments has been provided. If not, it prints a usage message and returns 1. Otherwise, it initializes an empty PGM image and proceeds to apply the obscuration techniques. The blurring technique uses a simple average filter to blur the image. The scrambling technique divides the image into regions and scrambles the pixels within each region. The pixelation technique replaces each region with its average color. The selective encryption technique encrypts only certain bits of the image data using the Paillier cryptosystem. The program uses the filesystemPGM and filesystemCommon classes to handle file I/O operations. It also uses the AES class from the encryption module to perform AES encryption on the image data. The program displays a progress bar during the obscuration process to provide feedback to the user. It also prints error messages if any issues occur during the process. Source files main.cpp and Functions.h by Norman Hutte

Macro Definition Documentation

◆ FILE_EXT

#define FILE_EXT   ".pgm"

Function Documentation

◆ afficherBarreDeChargement()

void afficherBarreDeChargement ( size_t progress,
size_t total )

Displays a progress bar in the console.

Parameters
progressThe current progress (number of completed tasks).
totalThe total number of tasks.

This function displays a progress bar in the console using ASCII characters. The color of the progress bar changes based on the percentage of completion. If the completion percentage is less than or equal to 50%, the color is red. If it is between 50% and 70%, the color is yellow. Otherwise, the color is dark green. The function takes two arguments: the current progress and the total number of tasks. It calculates the size of the progress bar based on these values and then prints the progress bar to the console using the std::cout object. The function also prints the completion percentage next to the progress bar. The function uses the std::string object to store the color code for the progress bar. It also uses a loop to print the progress bar characters one by one.

◆ main()

int main ( int argc,
char ** argv )

Main function for the PGM image obscuration program.

Parameters
argcThe number of command-line arguments.
argvThe command-line arguments.
Returns
0 if the program runs successfully, 1 otherwise.

This function is the entry point for the PGM image obscuration program. It takes two arguments: the number of command-line arguments and the command-line arguments themselves. The function first checks if the correct number of arguments has been provided. If not, it prints a usage message and returns 1. Otherwise, it initializes an empty PGM image and proceeds to apply the obscuration techniques. The function uses the filesystemPGM and filesystemCommon classes to handle file I/O operations. It also uses the AES class from the encryption module to perform AES encryption on the image data. The function displays a progress bar during the obscuration process to provide feedback to the user. It also prints error messages if any issues occur during the process. Example usage: $ ./ObscurationPGM_main /path/to/image/directory To use this program, the images contained in your files must have the name 'foldername_ (i)' where i goes from 0 to n images.