face_video_segment  0.8
Adaptation of The Video Segmentation Project for face segmentation.
utilities.h File Reference

Sequence face landmarks utility functions. More...

#include <segment_util/segmentation_util.h>
#include <face_video_segment.pb.h>

Go to the source code of this file.

Functions

void fvs::createContours (const segmentation::VectorMesh &mesh, const segmentation::SegmentationDesc_Polygon &poly, std::vector< std::vector< cv::Point >> &contours)
 
cv::Mat fvs::calcSegmentation (cv::Size size, const google::protobuf::Map< google::protobuf::uint32, Region > &regions, const segmentation::SegmentationDesc &seg_desc)
 
cv::Mat fvs::calcSegmentation (const cv::Mat &face_map, const google::protobuf::Map< google::protobuf::uint32, Region > &regions, const segmentation::SegmentationDesc &seg_desc)
 
void fvs::postprocessSegmentation (cv::Mat &seg, bool disconnected, bool holes, bool smooth, int smooth_iterations, int smooth_kernel_radius)
 
void fvs::renderBoundaries (cv::Mat &img, int hierarchy_level, const segmentation::SegmentationDesc &desc, const segmentation::Hierarchy *seg_hier, const cv::Scalar &color=cv::Scalar(255, 255, 255))
 Render the boundaries of the segmentation regions. More...
 
void fvs::renderSegmentation (cv::Mat &img, const cv::Mat &seg, uchar color)
 
void fvs::renderSegmentationBlend (cv::Mat &img, const cv::Mat &seg, float alpha=0.5f, const cv::Scalar &full_color=cv::Scalar(0, 0, 255), const cv::Scalar &intersection_color=cv::Scalar(255, 0, 0))
 Render segmentation blended with image. More...
 
float fvs::getFaceDominantSide (const std::vector< cv::Point > &landmarks)
 
cv::Rect fvs::getFaceBBoxFromSegmentation (const cv::Mat &seg, bool square)
 Get face bounding box from segmentation. More...
 

Detailed Description

Sequence face landmarks utility functions.

Function Documentation

cv::Rect fvs::getFaceBBoxFromSegmentation ( const cv::Mat &  seg,
bool  square 
)

Get face bounding box from segmentation.

Parameters
segThe segmentation.
squareMake the bounding box square (limited to segmentation boundaries).
void fvs::renderBoundaries ( cv::Mat &  img,
int  hierarchy_level,
const segmentation::SegmentationDesc &  desc,
const segmentation::Hierarchy *  seg_hier,
const cv::Scalar &  color = cv::Scalar(255, 255, 255) 
)

Render the boundaries of the segmentation regions.

Parameters
imgThe image that boundaries will be rendered on. The level of the hierarchy. 0 denotes the over-segmentation. >= 1 : denotes a hierarchical level. The segmentation descriptor which contains the segmentations data. The hierarchy information. Boundaries color.
void fvs::renderSegmentationBlend ( cv::Mat &  img,
const cv::Mat &  seg,
float  alpha = 0.5f,
const cv::Scalar &  full_color = cv::Scalar(0, 0, 255),
const cv::Scalar &  intersection_color = cv::Scalar(255, 0, 0) 
)

Render segmentation blended with image.

Parameters
imgThe image that the segmentation will be blended with. The segmentation as an 8-bit image. Values of 255 denote full regions and values of 128 denote intersection regions. Blending weight [0, 1]. 0 means completely transparent and 1 means completely opaque. The color to be used for full regions. The color to be used for intersection regions.