Steganography
A C++ Steganography tool which leverages the LSB and DCT embedding techniques
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DiscreteCosineTransform Class Reference
Inheritance diagram for DiscreteCosineTransform:
Inheritance graph
Collaboration diagram for DiscreteCosineTransform:
Collaboration graph

Public Member Functions

 DiscreteCosineTransform (const boost::filesystem::path &image_path, int persistence)
 
void Encode (const boost::filesystem::path &payload_path)
 
void Decode ()
 
- Public Member Functions inherited from Steganography
 Steganography (const boost::filesystem::path &image_path)
 

Private Member Functions

void EncodeChunk (const int &start, std::vector< unsigned char >::iterator it, std::vector< unsigned char >::iterator en)
 
void EncodeChunkLength (const int &start, const unsigned int &chunk_length)
 
void DecodeChunk (const int start, std::vector< unsigned char >::iterator it, std::vector< unsigned char >::iterator en)
 
unsigned int DecodeChunkLength (const int &start)
 
void SwapCoefficients (cv::Mat *block, const int &value)
 

Private Attributes

std::vector< cv::Mat > channels
 
int persistence
 
int image_capacity
 

Additional Inherited Members

- Protected Member Functions inherited from Steganography
std::vector< unsigned char > ReadPayload (const boost::filesystem::path &payload_path)
 
void WritePayload (const boost::filesystem::path &payload_path, const std::vector< unsigned char > &payload)
 
template<class T >
void SetBit (T *target, const int &bit, const int &value)
 
template<class T >
int GetBit (const T &target, const int &bit)
 
- Protected Attributes inherited from Steganography
boost::filesystem::path image_path
 
cv::Mat image
 

Constructor & Destructor Documentation

◆ DiscreteCosineTransform()

DiscreteCosineTransform::DiscreteCosineTransform ( const boost::filesystem::path &  image_path,
int  persistence 
)
inlineexplicit

Default constructor for the DiscreteCosineTransform class which overrides the default constructor from the Steganography class.

Parameters
image_pathThe path to the input carrier image.
persistenceThe persistence value for this instance.

Member Function Documentation

◆ Decode()

void DiscreteCosineTransform::Decode ( )
virtual

Decode the payload from the steganographic image by comparing DCT coefficients.

Implements Steganography.

◆ DecodeChunk()

void DiscreteCosineTransform::DecodeChunk ( const int  start,
std::vector< unsigned char >::iterator  it,
std::vector< unsigned char >::iterator  en 
)
private

Attempt to decode a chunk of information from the steganographic image.

Parameters
startThe bit index to start decoding at.
itAn iterator to a start position in the payload_bytes vector.
enAn iterator to an end position in the payload_bytes vector.
Exceptions
DecodeExceptionThrown when decoding fails.

◆ DecodeChunkLength()

unsigned int DiscreteCosineTransform::DecodeChunkLength ( const int &  start)
private

Attempt to decode the 32bit integer stating the length of the following chunk.

Parameters
startThe bit index to start decoding at.
Returns
The length of the following chunk.
Exceptions
DecodeExceptionThrown when decoding fails.

◆ Encode()

void DiscreteCosineTransform::Encode ( const boost::filesystem::path &  payload_path)
virtual

Encode the payload file into the carrier image by swapping DCT coefficients.

Parameters
payload_pathPath to the file we are encoding.
Exceptions
EncodeExceptionThrown when encoding fails.

Implements Steganography.

◆ EncodeChunk()

void DiscreteCosineTransform::EncodeChunk ( const int &  start,
std::vector< unsigned char >::iterator  it,
std::vector< unsigned char >::iterator  en 
)
private

Encode a chunk of information into the carrier image.

Before encoding a chunk of information you "should" first encode its length using the EncodeChunkLength function.

Parameters
startThe bit index to start encoding at.
itThe position in the chunk of information to start encoding.
enThe position in the chunk of information to stop encoding.

◆ EncodeChunkLength()

void DiscreteCosineTransform::EncodeChunkLength ( const int &  start,
const unsigned int &  chunk_length 
)
private

Encode a 32bit integer stating the length of the following chunk into the carrier image.

Parameters
startThe bit index to start encoding at.
chunk_lengthThe length of the next chunk in bytes.

◆ SwapCoefficients()

void DiscreteCosineTransform::SwapCoefficients ( cv::Mat *  block,
const int &  value 
)
private

Swap two DCT coefficients.

Swap two DCT coefficients and apply a persistence value to ensure that the data survives the compression process.

Parameters
blockA pointer to the block which is currently be operated on.
valueThe value which is being stored, will be 0 or 1.

Member Data Documentation

◆ persistence

DiscreteCosineTransform::persistence
private

Value which will be applied during the DCT coefficient swapping. Higher values ensure that the data persists, however, cause more visual degradation.


The documentation for this class was generated from the following files: