Code base obscuration (for images) 1.0
It implements different obscuration methods on portable images (.pgm and .ppm)
Loading...
Searching...
No Matches
obscurationPPM Class Reference

This class implements various image obscuration techniques for the PPM image format. More...

#include <obscurationPPM.hpp>

Inheritance diagram for obscurationPPM:
Collaboration diagram for obscurationPPM:

Static Public Member Functions

static int interpolate_color (int p11, int p21, int p12, int p22, float dx, float dy)
 Interpolates the color value of a pixel at a given position using bilinear interpolation.
 
static void interpolate_bilinear (ImageBase &image, int &valR, int &valG, int &valB, float i, float j)
 Interpolates the color values of a pixel at a given position in an image using bilinear interpolation.
 
static void bilinearRedim299 (ImageBase &image, ImageBase &o_image)
 Resizes an image to 299x299 pixels using bilinear interpolation.
 
static void computeColorHist (ImageBase &image, int histR[256], int histG[256], int histB[256])
 Computes the histograms of the red, green, and blue color components of an image.
 
static void compareImagesByHist (ImageBase &image1, ImageBase &image2)
 Compares the histograms of two images.
 
static void generateGaussianKernel (std::vector< std::vector< float > > &kernel, int size, float sigma)
 Generates a Gaussian kernel for image blurring.
 
static void gaussianBlur (ImageBase &image, ImageBase &o_image, int kernelSize, float sigma)
 Applies Gaussian blurring to an image using a given kernel size and standard deviation.
 
static void averageBlurring (ImageBase &image, ImageBase &o_image, int regionSize)
 Applies average blurring to an image using a given region size.
 
static void newAverageBlurring (ImageBase &image, std::vector< ImageBase > &o_images)
 Applies new average blurring to an image using a given number of images.
 
static void areaScrambling (ImageBase &image, ImageBase &o_image, int start_i, int start_j, int area_h, int area_w)
 Applies area scrambling to an image using a given start position and area size.
 
static void scrambling (ImageBase &image, ImageBase &o_image, int regionHeight, int regionWidth)
 Applies scrambling to an image using a given region size.
 
static void areaAverager (ImageBase &image, ImageBase &o_image, int start_i, int start_j, int area_h, int area_w)
 Applies area averaging to an image using a given start position and area size.
 
static void averageByRegion (ImageBase &image, ImageBase &o_image, int regionHeight, int regionWidth)
 Applies average by region to an image using a given region size.
 
static void selectiveProgressiveEncryption (ImageBase &image, ImageBase o_images[8], bool MSBtoLSB)
 Applies selective progressive encryption to an image using a given encryption direction.
 
static void selectiveIndividualEncryption (ImageBase &image, ImageBase o_images[8])
 Applies selective individual encryption to an image.
 
static void selectiveGroupEncryption (ImageBase &image, ImageBase &o_image, int bitsGroup[8], int groupSize)
 Applies selective group encryption to an image using a given bit group and group size.
 
static double computePSNR (ImageBase &image1, ImageBase &image2)
 Computes the peak signal-to-noise ratio (PSNR) between two images.
 
static void computePSNRforAllAlterations (std::vector< double > &PSNRArray, const char *baseName, int i_min, int i_max, int step)
 Computes the PSNR for all alterations in a given range.
 
static void writeDataOnTxt (std::vector< double > &data, std::string filename)
 Writes data to a text file.
 
static void RGB2GREY (ImageBase &imColor, ImageBase &imGrey)
 Converts an RGB image to grayscale.
 
static double computeImageMean (ImageBase &image)
 Computes the mean value of an image.
 
static double computeSSIM (ImageBase &image1, ImageBase &image2)
 Computes the structural similarity index (SSIM) between two images.
 
- Static Public Member Functions inherited from obscurationCommon
static void genPRNS (unsigned int seq[8])
 Generate a random sequence of 8 bits.
 
static void genBitsGroups (std::vector< std::vector< int > > &groups, int groupSize)
 Generate groups of bits.
 
static void intVec2intArray (std::vector< int > &vec, int arr[8])
 Convert a vector of integers to an array of integers.
 

Detailed Description

This class implements various image obscuration techniques for the PPM image format.

subclass obscurationCommon

Author
Norman Hutte
Date
6 March 2024

Member Function Documentation

◆ areaAverager()

void obscurationPPM::areaAverager ( ImageBase & image,
ImageBase & o_image,
int start_i,
int start_j,
int area_h,
int area_w )
static

Applies area averaging to an image using a given start position and area size.

Parameters
imageThe input image.
o_imageThe output image.
start_iThe vertical start position of the averaging area.
start_jThe horizontal start position of the averaging area.
area_hThe height of the averaging area.
area_wThe width of the averaging area.
Author
Norman Hutte
Date
6 March 2024

◆ areaScrambling()

void obscurationPPM::areaScrambling ( ImageBase & image,
ImageBase & o_image,
int start_i,
int start_j,
int area_h,
int area_w )
static

Applies area scrambling to an image using a given start position and area size.

Parameters
imageThe input image.
o_imageThe output image.
start_iThe vertical start position of the scrambling area.
start_jThe horizontal start position of the scrambling area.
area_hThe height of the scrambling area.
area_wThe width of the scrambling area.
Author
Norman Hutte
Date
6 March 2024

◆ averageBlurring()

void obscurationPPM::averageBlurring ( ImageBase & image,
ImageBase & o_image,
int regionSize )
static

Applies average blurring to an image using a given region size.

Parameters
imageThe input image.
o_imageThe output image.
regionSizeThe size of the averaging region.
Author
Norman Hutte
Date
6 March 2024

◆ averageByRegion()

void obscurationPPM::averageByRegion ( ImageBase & image,
ImageBase & o_image,
int regionHeight,
int regionWidth )
static

Applies average by region to an image using a given region size.

Parameters
imageThe input image.
o_imageThe output image.
regionHeightThe height of the averaging region.
regionWidthThe width of the averaging region.
Author
Norman Hutte
Date
6 March 2024

◆ bilinearRedim299()

void obscurationPPM::bilinearRedim299 ( ImageBase & image,
ImageBase & o_image )
static

Resizes an image to 299x299 pixels using bilinear interpolation.

Parameters
imageThe input image.
o_imageThe output image.
Author
Norman Hutte
Date
6 March 2024

◆ compareImagesByHist()

void obscurationPPM::compareImagesByHist ( ImageBase & image1,
ImageBase & image2 )
static

Compares the histograms of two images.

Parameters
image1The first image.
image2The second image.
Author
Norman Hutte
Date
6 March 2024

◆ computeColorHist()

void obscurationPPM::computeColorHist ( ImageBase & image,
int histR[256],
int histG[256],
int histB[256] )
static

Computes the histograms of the red, green, and blue color components of an image.

Parameters
imageThe input image.
histRThe histogram of the red color component.
histGThe histogram of the green color component.
histBThe histogram of the blue color component.
Author
Norman Hutte
Date
6 March 2024

◆ computeImageMean()

double obscurationPPM::computeImageMean ( ImageBase & image)
static

Computes the mean value of an image.

Parameters
imageThe input image.
Returns
The mean value.
Author
Norman Hutte
Date
6 March 2024

◆ computePSNR()

double obscurationPPM::computePSNR ( ImageBase & image1,
ImageBase & image2 )
static

Computes the peak signal-to-noise ratio (PSNR) between two images.

Parameters
image1The first image.
image2The second image.
Returns
The PSNR value.
Author
Norman Hutte
Date
6 March 2024

◆ computePSNRforAllAlterations()

void obscurationPPM::computePSNRforAllAlterations ( std::vector< double > & PSNRArray,
const char * baseName,
int i_min,
int i_max,
int step )
static

Computes the PSNR for all alterations in a given range.

Parameters
PSNRArrayThe output array of PSNR values.
baseNameThe base name of the input files.
i_minThe minimum alteration index.
i_maxThe maximum alteration index.
stepThe step size between alteration indices.
Author
Norman Hutte
Date
6 March 2024

◆ computeSSIM()

double obscurationPPM::computeSSIM ( ImageBase & image1,
ImageBase & image2 )
static

Computes the structural similarity index (SSIM) between two images.

Parameters
image1The first image.
image2The second image.
Returns
The SSIM value.
Author
Norman Hutte
Date
6 March 2024

◆ gaussianBlur()

void obscurationPPM::gaussianBlur ( ImageBase & image,
ImageBase & o_image,
int kernelSize,
float sigma )
static

Applies Gaussian blurring to an image using a given kernel size and standard deviation.

Parameters
imageThe input image.
o_imageThe output image.
kernelSizeThe size of the Gaussian kernel.
sigmaThe standard deviation of the Gaussian distribution.
Author
Norman Hutte
Date
6 March 2024

◆ generateGaussianKernel()

void obscurationPPM::generateGaussianKernel ( std::vector< std::vector< float > > & kernel,
int size,
float sigma )
static

Generates a Gaussian kernel for image blurring.

Parameters
kernelThe output kernel.
sizeThe size of the kernel.
sigmaThe standard deviation of the Gaussian distribution.
Author
Norman Hutte
Date
6 March 2024

◆ interpolate_bilinear()

void obscurationPPM::interpolate_bilinear ( ImageBase & image,
int & valR,
int & valG,
int & valB,
float i,
float j )
static

Interpolates the color values of a pixel at a given position in an image using bilinear interpolation.

Parameters
imageThe input image.
valRThe interpolated red color value.
valGThe interpolated green color value.
valBThe interpolated blue color value.
iThe vertical coordinate of the target position.
jThe horizontal coordinate of the target position.
Author
Norman Hutte
Date
6 March 2024

◆ interpolate_color()

int obscurationPPM::interpolate_color ( int p11,
int p21,
int p12,
int p22,
float dx,
float dy )
static

Interpolates the color value of a pixel at a given position using bilinear interpolation.

Parameters
p11The color value at the top-left corner of the interpolation rectangle.
p21The color value at the top-right corner of the interpolation rectangle.
p12The color value at the bottom-left corner of the interpolation rectangle.
p22The color value at the bottom-right corner of the interpolation rectangle.
dxThe horizontal distance from the top-left corner of the interpolation rectangle to the target position.
dyThe vertical distance from the top-left corner of the interpolation rectangle to the target position.
Returns
The interpolated color value.
Author
Norman Hutte
Date
6 March 2024

◆ newAverageBlurring()

void obscurationPPM::newAverageBlurring ( ImageBase & image,
std::vector< ImageBase > & o_images )
static

Applies new average blurring to an image using a given number of images.

Parameters
imageThe input image.
o_imagesThe output images.
Author
Norman Hutte
Date
6 March 2024

◆ RGB2GREY()

void obscurationPPM::RGB2GREY ( ImageBase & imColor,
ImageBase & imGrey )
static

Converts an RGB image to grayscale.

Parameters
imColorThe input RGB image.
imGreyThe output grayscale image.
Author
Norman Hutte
Date
6 March 2024

◆ scrambling()

void obscurationPPM::scrambling ( ImageBase & image,
ImageBase & o_image,
int regionHeight,
int regionWidth )
static

Applies scrambling to an image using a given region size.

Parameters
imageThe input image.
o_imageThe output image.
regionHeightThe height of the scrambling region.
regionWidthThe width of the scrambling region.
Author
Norman Hutte
Date
6 March 2024

◆ selectiveGroupEncryption()

void obscurationPPM::selectiveGroupEncryption ( ImageBase & image,
ImageBase & o_image,
int bitsGroup[8],
int groupSize )
static

Applies selective group encryption to an image using a given bit group and group size.

Parameters
imageThe input image.
o_imageThe output image.
bitsGroupThe bit group to encrypt.
groupSizeThe size of the bit group.
Author
Norman Hutte
Date
6 March 2024

◆ selectiveIndividualEncryption()

void obscurationPPM::selectiveIndividualEncryption ( ImageBase & image,
ImageBase o_images[8] )
static

Applies selective individual encryption to an image.

Parameters
imageThe input image.
o_imagesThe output images.
Author
Norman Hutte
Date
6 March 2024

◆ selectiveProgressiveEncryption()

void obscurationPPM::selectiveProgressiveEncryption ( ImageBase & image,
ImageBase o_images[8],
bool MSBtoLSB )
static

Applies selective progressive encryption to an image using a given encryption direction.

Parameters
imageThe input image.
o_imagesThe output images.
MSBtoLSBThe encryption direction (true for MSB to LSB, false for LSB to MSB).
Author
Norman Hutte
Date
6 March 2024

◆ writeDataOnTxt()

void obscurationPPM::writeDataOnTxt ( std::vector< double > & data,
std::string filename )
static

Writes data to a text file.

Parameters
dataThe data to write.
filenameThe name of the output file.
Author
Norman Hutte
Date
6 March 2024