Spoofing Detection Engine  1.0
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
EngineBase Class Referenceabstract

Main engine class for processing images and applying visual features. More...

#include <EngineBase.h>

Inheritance diagram for EngineBase:
Inheritance graph
[legend]
Collaboration diagram for EngineBase:
Collaboration graph
[legend]

Public Member Functions

 EngineBase ()
 Default constructor for the EngineBase class.
 
virtual ~EngineBase ()
 Destructor for the EngineBase class.
 
virtual void init (std::string resourcePath)
 Initializes the engine with the specified resource path. More...
 
virtual void process (cv::Mat &input, cv::Mat &output)=0
 Processes an input image and produces an output image. More...
 
void addSigno (cv::Mat &image)
 Adds a watermark (signo) to the specified image. More...
 
void drawHistoryChart (cv::Mat &frame, const cv::Rect &haloRect, const std::deque< std::map< std::string, double >> &history, const std::map< std::string, cv::Scalar > &colors)
 Draw a simple line chart visualizing the value history for a detection. More...
 

Protected Member Functions

cv::Mat preProcessImage (cv::Mat &image)
 Prepare the input image for further processing. More...
 
cv::Mat postProcessImage (cv::Mat &image, cv::Mat &workingFrame)
 Remove padding and convert the processed image back to the original format. More...
 

Protected Attributes

std::string faceVerticesPath
 Path to the face vertices data file in the virtual file system.
 
core::face::FaceDetectorYunet detector
 Face detector object used for detecting faces within images.
 
visualization::FaceDrawer faceDrawer
 Face drawer object used for drawing face landmarks and features.
 
core::face::FaceMesh faceMesh
 Face mesh object used for managing facial geometry data.
 
core::filter::LandmarkFlowFilter filter
 
cv::Rect imageRect
 
float padding_ratio = 0.3
 
int top = 0
 
int bottom = 0
 
int left = 0
 
int right = 0
 
std::map< int, std::deque< std::map< std::string, double > > > mHistory
 

Static Protected Attributes

static constexpr size_t HISTORY_LENGTH = 50
 

Detailed Description

Main engine class for processing images and applying visual features.

The EngineBase class handles initialization, image processing, and adding a watermark (signo) to images. It utilizes resources for face detection, face mesh, and visual enhancements, such as makeup templates.

Member Function Documentation

◆ addSigno()

void EngineBase::addSigno ( cv::Mat &  image)

Adds a watermark (signo) to the specified image.

This method places a copyright text on the bottom right corner of the image.

Parameters
imageReference to the image (cv::Mat) where the watermark is added.
Here is the caller graph for this function:

◆ drawHistoryChart()

void EngineBase::drawHistoryChart ( cv::Mat &  frame,
const cv::Rect &  haloRect,
const std::deque< std::map< std::string, double >> &  history,
const std::map< std::string, cv::Scalar > &  colors 
)

Draw a simple line chart visualizing the value history for a detection.

Parameters
frameImage onto which the chart should be drawn.
haloRectReference face rectangle used for positioning the chart.
historyDeque containing maps of label->value pairs.
colorsColor mapping for the different labels.
Here is the caller graph for this function:

◆ init()

void EngineBase::init ( std::string  resourcePath)
virtual

Initializes the engine with the specified resource path.

Parameters
resourcePathPath to the resources needed for initialization.

Reimplemented in SpoofEngine.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ postProcessImage()

cv::Mat EngineBase::postProcessImage ( cv::Mat &  image,
cv::Mat &  workingFrame 
)
protected

Remove padding and convert the processed image back to the original format.

Parameters
imageOriginal input image.
workingFrameProcessed frame with padding.
Returns
Final output image.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ preProcessImage()

cv::Mat EngineBase::preProcessImage ( cv::Mat &  image)
protected

Prepare the input image for further processing.

Converts color formats when needed and applies padding around the original image.

Parameters
imageInput image to preprocess.
Returns
Preprocessed frame.
Here is the caller graph for this function:

◆ process()

virtual void EngineBase::process ( cv::Mat &  input,
cv::Mat &  output 
)
pure virtual

Processes an input image and produces an output image.

This method applies various transformations or effects to the input image using face detection and enhancement tools.

Parameters
inputReference to the input image (cv::Mat) to be processed.
outputReference to the output image (cv::Mat) where the result is stored.

Implemented in SpoofEngine.


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