Face3d
Face3D::Detection Class Reference

#include <Detection.hpp>

Classes

struct  ContourInfo
 
struct  DetectFaceResult
 

Public Member Functions

 Detection (const cv::Mat &front, const cv::Mat &side)
 create a Detection object More...
 
DetectFaceResult detectFace ()
 calculate the face geometry and the textures More...
 

Private Types

enum  RegionType { RegionTypeInside, RegionTypeOutside }
 

Private Member Functions

cv::Mat getCopyOfOriginal (int imgNr)
 
void doPreprocessing ()
 
void doFaceExtraction ()
 
void doFacialComponentsExtraction ()
 
void doFacialComponentsExtractionFront (FaceGeometry &faceGeometry, const std::vector< ContourInfo > &componentContourInfo, const std::vector< ContourInfo > &faceContourInfo)
 
void doFacialComponentsExtractionSide (FaceGeometry &faceGeometry, const std::vector< ContourInfo > &componentContourInfo, const std::vector< ContourInfo > &faceContourInfo)
 
std::vector< size_t > findRegions (const std::vector< std::vector< cv::Point > > &contours, const std::vector< cv::Vec4i > &hierarchy, RegionType regionType)
 
std::vector< ContourInfoextractContourInfo (const std::vector< std::vector< cv::Point > > &contours, const std::vector< size_t > indices)
 
void doMatchCoordinates ()
 
void createTextures ()
 
cv::Rect getBoundingBox (const cv::Mat &color)
 
void doFaceExtractionGUI ()
 
void createTexturesAndShowResultsGUI ()
 
cv::Mat combineVertically (const cv::Mat &a, const cv::Mat &b) const
 

Private Attributes

int m_ColorThresValue = 10
 
int m_OffsetCB =0
 
int m_OffsetCR =0
 
double m_AddTextureBottom = 0
 
double m_AddTextureTop = 0
 
const size_t frontImgNr = 0
 index of the front image when both images are stored in an array More...
 
const size_t sideImgNr = 1
 index of the side image when both images are stored in an array More...
 
const size_t imgSize = 320
 size of the images we are working with. 320x320 seems good as its fast but has still enough details More...
 
std::vector< cv::Mat > m_Originals
 original images (scaled down) More...
 
std::vector< cv::Mat > m_Preprocessed
 preprocessed images (smooth) More...
 
std::vector< cv::Mat > m_FaceExtracted
 binary image with skin as foreground More...
 
std::vector< cv::Mat > m_FaceMask
 mask of the face regions. foreground regions which are not the face are already removed More...
 
FaceGeometry m_FaceGeometry
 
FaceGeometry m_FaceGeometryBackup
 the geometry of the face, i.e. the coordinates of the facial components More...
 
std::vector< cv::Mat > m_Textures
 the textures, already in a format that can be used in OpenGL More...
 
cv::Mat m_FacialPointsGUI
 
cv::Mat m_TexturesGUI
 

Friends

void onColorThresholdsTrackbar (int, void *)
 
void onTextureAdjustmentTrackbarBottom (int, void *)
 
void onTextureAdjustmentTrackbarTop (int, void *)
 

Detailed Description

class which detects the facial components and calculates the face geometry

Member Enumeration Documentation

type of binary region to be looked for: an inner or an outer region

Enumerator
RegionTypeInside 
RegionTypeOutside 

Constructor & Destructor Documentation

Face3D::Detection::Detection ( const cv::Mat &  front,
const cv::Mat &  side 
)

create a Detection object

Parameters
frontimage of the face from the front
sideimage of the face from the side

Member Function Documentation

cv::Mat Face3D::Detection::combineVertically ( const cv::Mat &  a,
const cv::Mat &  b 
) const
private
void Face3D::Detection::createTextures ( )
private

create the textures from the two images and align them

void Face3D::Detection::createTexturesAndShowResultsGUI ( )
private
Detection::DetectFaceResult Face3D::Detection::detectFace ( )

calculate the face geometry and the textures

Returns
a DetectFaceResult object which holds the face geometry and the textures
void Face3D::Detection::doFaceExtraction ( )
private

extracts face (skin) region

void Face3D::Detection::doFaceExtractionGUI ( )
private
void Face3D::Detection::doFacialComponentsExtraction ( )
private

extract facial components (eyes, nose, ...)

void Face3D::Detection::doFacialComponentsExtractionFront ( FaceGeometry faceGeometry,
const std::vector< ContourInfo > &  componentContourInfo,
const std::vector< ContourInfo > &  faceContourInfo 
)
private

extract facial components in front image

void Face3D::Detection::doFacialComponentsExtractionSide ( FaceGeometry faceGeometry,
const std::vector< ContourInfo > &  componentContourInfo,
const std::vector< ContourInfo > &  faceContourInfo 
)
private

extract facial components in side image

void Face3D::Detection::doMatchCoordinates ( )
private

match the 2d coordinates of the facial components in the two images to get the 3d information

void Face3D::Detection::doPreprocessing ( )
private

preprocessing: smooth image

std::vector< Detection::ContourInfo > Face3D::Detection::extractContourInfo ( const std::vector< std::vector< cv::Point > > &  contours,
const std::vector< size_t >  indices 
)
private

calculate informations about the contours, e.g. the area

std::vector< size_t > Face3D::Detection::findRegions ( const std::vector< std::vector< cv::Point > > &  contours,
const std::vector< cv::Vec4i > &  hierarchy,
RegionType  regionType 
)
private

fget list of regions with specified type

cv::Rect Face3D::Detection::getBoundingBox ( const cv::Mat &  color)
private

get the bounding box of the color image. background must be black, everything else will be regared as foreground.

cv::Mat Face3D::Detection::getCopyOfOriginal ( int  imgNr)
inlineprivate

helper function to get original image to draw on for debug output

Friends And Related Function Documentation

void onColorThresholdsTrackbar ( int  ,
void *   
)
friend
void onTextureAdjustmentTrackbarBottom ( int  val,
void *  ptr 
)
friend
void onTextureAdjustmentTrackbarTop ( int  val,
void *  ptr 
)
friend

Member Data Documentation

const size_t Face3D::Detection::frontImgNr = 0
private

index of the front image when both images are stored in an array

images (originals and processed)

const size_t Face3D::Detection::imgSize = 320
private

size of the images we are working with. 320x320 seems good as its fast but has still enough details

double Face3D::Detection::m_AddTextureBottom = 0
private
double Face3D::Detection::m_AddTextureTop = 0
private
int Face3D::Detection::m_ColorThresValue = 10
private

gui interaction

std::vector<cv::Mat> Face3D::Detection::m_FaceExtracted
private

binary image with skin as foreground

FaceGeometry Face3D::Detection::m_FaceGeometry
private
FaceGeometry Face3D::Detection::m_FaceGeometryBackup
private

the geometry of the face, i.e. the coordinates of the facial components

std::vector<cv::Mat> Face3D::Detection::m_FaceMask
private

mask of the face regions. foreground regions which are not the face are already removed

cv::Mat Face3D::Detection::m_FacialPointsGUI
private

resulting images to show in the gui

int Face3D::Detection::m_OffsetCB =0
private
int Face3D::Detection::m_OffsetCR =0
private
std::vector<cv::Mat> Face3D::Detection::m_Originals
private

original images (scaled down)

std::vector<cv::Mat> Face3D::Detection::m_Preprocessed
private

preprocessed images (smooth)

std::vector<cv::Mat> Face3D::Detection::m_Textures
private

the textures, already in a format that can be used in OpenGL

cv::Mat Face3D::Detection::m_TexturesGUI
private
const size_t Face3D::Detection::sideImgNr = 1
private

index of the side image when both images are stored in an array


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