sequence_face_landmarks
Utility for sequence face landmarks
|
Sequence face landmarks utility functions. More...
#include "sequence_face_landmarks.h"
Go to the source code of this file.
Classes | |
struct | sfl::FaceStat |
Represents a face statistics in the sequence. More... | |
Functions | |
void | sfl::render (cv::Mat &img, const std::vector< cv::Point > &landmarks, bool drawLabels=false, const cv::Scalar &color=cv::Scalar(0, 255, 0), int thickness=1) |
Render landmarks. More... | |
void | sfl::render (cv::Mat &img, const cv::Rect &bbox, const cv::Scalar &color=cv::Scalar(0, 255, 0), int thickness=1) |
Render bounding box. More... | |
void | sfl::render (cv::Mat &img, const Face &face, bool drawIDs=true, bool drawLabels=false, const cv::Scalar &bbox_color=cv::Scalar(0, 0, 255), const cv::Scalar &landmarks_color=cv::Scalar(0, 255, 0), int thickness=1, double fontScale=1.0) |
Render face's bounding box and landmarks. More... | |
void | sfl::render (cv::Mat &img, const Frame &frame, bool drawIDs=true, bool drawLabels=false, const cv::Scalar &bbox_color=cv::Scalar(0, 0, 255), const cv::Scalar &landmarks_color=cv::Scalar(0, 255, 0), int thickness=1, double fontScale=1.0) |
Render all frame faces including bounding boxs and landmarks. More... | |
void | sfl::renderFaceID (cv::Mat &img, const Face &face, const cv::Scalar &color, int thickness=1, double fontScale=1.0) |
void | sfl::getSequenceStats (const std::list< std::unique_ptr< Frame >> &sequence, std::vector< FaceStat > &stats) |
Get the face statistics of the sequence. More... | |
int | sfl::getMainFaceID (const std::list< std::unique_ptr< Frame >> &sequence) |
Get the main face in a sequence. | |
int | sfl::getMainFaceID (const std::vector< FaceStat > &stats) |
Get the main face from face statistics. | |
cv::Point2f | sfl::getFaceLeftEye (const std::vector< cv::Point > &landmarks) |
Get the face's left eye center position (right eye in the image). More... | |
cv::Point2f | sfl::getFaceRightEye (const std::vector< cv::Point > &landmarks) |
Get the face's right eye center position (left eye in the image). More... | |
float | sfl::getFaceApproxVertAngle (const std::vector< cv::Point > &landmarks) |
Get the face's vertical angle [radians]. More... | |
float | sfl::getFaceApproxHorAngle (const std::vector< cv::Point > &landmarks) |
Get the face's horizontal angle [radians]. More... | |
float | sfl::getFaceApproxTiltAngle (const std::vector< cv::Point > &landmarks) |
Get the face's tilt angle [radians]. More... | |
cv::Point3f | sfl::getFaceApproxEulerAngles (const std::vector< cv::Point > &landmarks) |
Get the face's euler angles [radians]. More... | |
cv::Rect | sfl::getFaceBBoxFromLandmarks (const std::vector< cv::Point > &landmarks, const cv::Size &frameSize, bool square) |
Get face bounding box from landmarks. More... | |
void | sfl::createFullFace (const std::vector< cv::Point > &landmarks, std::vector< cv::Point > &full_face) |
Create full face points from landmarks. More... | |
Sequence face landmarks utility functions.
void sfl::createFullFace | ( | const std::vector< cv::Point > & | landmarks, |
std::vector< cv::Point > & | full_face | ||
) |
Create full face points from landmarks.
This will add the forehead part of the face.
landmarks | Face points. |
full_face | The full face points. |
cv::Point3f sfl::getFaceApproxEulerAngles | ( | const std::vector< cv::Point > & | landmarks | ) |
Get the face's euler angles [radians].
The angles are in the range [-75/180*pi, 75/180*pi].
landmarks | 68 face points. |
float sfl::getFaceApproxHorAngle | ( | const std::vector< cv::Point > & | landmarks | ) |
Get the face's horizontal angle [radians].
The angles are in the range [-75/180*pi, 75/180*pi]. When the face is looking right (left in the image) the angle will be positive and when it is looking left (right in the image) it will be negative.
landmarks | 68 face points. |
float sfl::getFaceApproxTiltAngle | ( | const std::vector< cv::Point > & | landmarks | ) |
Get the face's tilt angle [radians].
The angles are in the range [-75/180*pi, 75/180*pi]. When the face is tilting left (right in the image) the angle will be positive and when it is tilting right (left in the image) it will be negative.
landmarks | 68 face points. |
float sfl::getFaceApproxVertAngle | ( | const std::vector< cv::Point > & | landmarks | ) |
Get the face's vertical angle [radians].
The angles are in the range [-75/180*pi, 75/180*pi]. When the face is looking up the angle will be positive and when it is looking down it will be negative.
landmarks | 68 face points. |
cv::Rect sfl::getFaceBBoxFromLandmarks | ( | const std::vector< cv::Point > & | landmarks, |
const cv::Size & | frameSize, | ||
bool | square | ||
) |
Get face bounding box from landmarks.
landmarks | Face points. |
frameSize | The size of the image. |
square | Make the bounding box square (limited to frame boundaries). |
cv::Point2f sfl::getFaceLeftEye | ( | const std::vector< cv::Point > & | landmarks | ) |
Get the face's left eye center position (right eye in the image).
landmarks | 68 face points. |
cv::Point2f sfl::getFaceRightEye | ( | const std::vector< cv::Point > & | landmarks | ) |
Get the face's right eye center position (left eye in the image).
landmarks | 68 face points. |
void sfl::getSequenceStats | ( | const std::list< std::unique_ptr< Frame >> & | sequence, |
std::vector< FaceStat > & | stats | ||
) |
Get the face statistics of the sequence.
sequence | The sequence of frames to calculate the statistics for. |
stats | Output vector of statistics for each face in the sequence. |
void sfl::render | ( | cv::Mat & | img, |
const std::vector< cv::Point > & | landmarks, | ||
bool | drawLabels = false , |
||
const cv::Scalar & | color = cv::Scalar(0, 255, 0) , |
||
int | thickness = 1 |
||
) |
Render landmarks.
img | The image that the landmarks will be rendered on. |
landmarks | The landmark points to render. |
drawLabels | if true, for each landmark, it's 0 based index will be rendererd as a label. |
color | Line/point and label color. |
thickness | Line/point thickness. |
void sfl::render | ( | cv::Mat & | img, |
const cv::Rect & | bbox, | ||
const cv::Scalar & | color = cv::Scalar(0, 255, 0) , |
||
int | thickness = 1 |
||
) |
Render bounding box.
img | The image that the bounding box will be rendered on. |
bbox | The bounding box rectangle to render. |
color | Line color. |
thickness | Line thickness. |
void sfl::render | ( | cv::Mat & | img, |
const Face & | face, | ||
bool | drawIDs = true , |
||
bool | drawLabels = false , |
||
const cv::Scalar & | bbox_color = cv::Scalar(0, 0, 255) , |
||
const cv::Scalar & | landmarks_color = cv::Scalar(0, 255, 0) , |
||
int | thickness = 1 , |
||
double | fontScale = 1.0 |
||
) |
Render face's bounding box and landmarks.
img | The image that the face will be rendered on. |
face | The face to render. |
drawIDs | if true, the 0 based id will be rendererd as a label. |
drawLabels | if true, for each landmark, it's 0 based index will be rendererd as a label. |
bbox_color | Bounding box line color. |
landmarks_color | Landmarks line/point and label color. |
thickness | Line/point thickness. |
fontScale | The size of the font for the labels. |
void sfl::render | ( | cv::Mat & | img, |
const Frame & | frame, | ||
bool | drawIDs = true , |
||
bool | drawLabels = false , |
||
const cv::Scalar & | bbox_color = cv::Scalar(0, 0, 255) , |
||
const cv::Scalar & | landmarks_color = cv::Scalar(0, 255, 0) , |
||
int | thickness = 1 , |
||
double | fontScale = 1.0 |
||
) |
Render all frame faces including bounding boxs and landmarks.
img | The image that the faces will be rendered on. |
frame | The frame to render. |
drawIDs | if true, the 0 based id will be rendererd as a label. |
drawLabels | if true, for each landmark, it's 0 based index will be rendererd as a label. |
bbox_color | Bounding box line color. |
landmarks_color | Landmarks line/point and label color. |
thickness | Line/point thickness. |
fontScale | The size of the font for the labels. |