face_video_segment  0.8
Adaptation of The Video Segmentation Project for face segmentation.
face_regions.h
1 // Copyright (c) 2010-2014, The Video Segmentation Project
2 // All rights reserved.
3 
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name of the The Video Segmentation Project nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 //
27 // ---
28 
29 #ifndef FVS_FACE_REGIONS_H__
30 #define FVS_FACE_REGIONS_H__
31 
32 
33 #include "face_video_segment.pb.h"
34 
35 // std
36 #include <memory>
37 
38 // sfl
39 #include <sfl/sequence_face_landmarks.h>
40 
41 // segmentation
42 #include <segment_util/segmentation.pb.h>
43 
44 // OpenCV
45 #include <opencv2/core.hpp>
46 
47 namespace fvs {
48 
57  {
58  public:
61  FaceRegions();
62 
68  void addFrame(const segmentation::SegmentationDesc& seg_desc,
69  const sfl::Frame& sfl_frame, Frame& fvs_frame);
70 
71  private:
76  void addFace(const segmentation::SegmentationDesc& seg_desc,
77  const sfl::Face& sfl_face, Frame& fvs_frame);
78 
81  cv::Mat createFaceMap(const cv::Size& size, const std::vector<cv::Point>& landmarks);
82 
83  // Holds the segmentation for the current chunk.
84  std::unique_ptr<segmentation::SegmentationDesc> m_seg_hier;
85  };
86 
87 } // namespace fvs
88 
89 #endif // FVS_FACE_REGIONS_H__
void addFrame(const segmentation::SegmentationDesc &seg_desc, const sfl::Frame &sfl_frame, Frame &fvs_frame)
Add a new frame.
Definition: face_regions.cpp:49
FaceRegions()
Constructor.
Definition: face_regions.cpp:45
Classifies segmented regions into face region types.
Definition: face_regions.h:56
Definition: face_regions.cpp:43