face_video_segment  0.8
Adaptation of The Video Segmentation Project for face segmentation.
utilities.h
Go to the documentation of this file.
1 
5 #ifndef __FVG_UTILITIES__
6 #define __FVG_UTILITIES__
7 
8 #include <segment_util/segmentation_util.h>
9 #include <face_video_segment.pb.h>
10 
11 namespace fvs
12 {
13  void createContours(const segmentation::VectorMesh& mesh,
14  const segmentation::SegmentationDesc_Polygon& poly,
15  std::vector<std::vector<cv::Point>>& contours);
16 
17  cv::Mat calcSegmentation(cv::Size size,
18  const google::protobuf::Map<google::protobuf::uint32, Region>& regions,
19  const segmentation::SegmentationDesc& seg_desc);
20 
21  cv::Mat calcSegmentation(const cv::Mat& face_map,
22  const google::protobuf::Map<google::protobuf::uint32, Region>& regions,
23  const segmentation::SegmentationDesc& seg_desc);
24 
25  void postprocessSegmentation(cv::Mat& seg, bool disconnected = true,
26  bool holes = true, bool smooth = true, int smooth_iterations = 1,
27  int smooth_kernel_radius = 2);
28 
29 // void createFullFace(const std::vector<cv::Point>& landmarks,
30 // std::vector<cv::Point>& full_face);
31 
40  void renderBoundaries(cv::Mat& img, int hierarchy_level,
41  const segmentation::SegmentationDesc& desc,
42  const segmentation::Hierarchy* seg_hier,
43  const cv::Scalar& color = cv::Scalar(255, 255, 255));
44 
45  void renderSegmentation(cv::Mat& img, const cv::Mat& seg, uchar color);
46 
56  void renderSegmentationBlend(cv::Mat& img, const cv::Mat& seg, float alpha = 0.5f,
57  const cv::Scalar& full_color = cv::Scalar(0, 0, 255),
58  const cv::Scalar& intersection_color = cv::Scalar(255, 0, 0));
59 
60  float getFaceDominantSide(const std::vector<cv::Point>& landmarks);
61 
66  cv::Rect getFaceBBoxFromSegmentation(const cv::Mat& seg, bool square);
67 
68 } // namespace fvs
69 
70 #endif // __FVG_UTILITIES__
Definition: face_regions.cpp:43