sequence_face_landmarks
Utility for sequence face landmarks
sequence_face_landmarks.h
1 #ifndef __SFL_SEQUENCE_FACE_LANDMARKS__
2 #define __SFL_SEQUENCE_FACE_LANDMARKS__
3 
4 // std
5 #include <string>
6 #include <list>
7 #include <memory>
8 
9 // OpenCV
10 #include <opencv2/core.hpp>
11 
12 namespace sfl
13 {
16  struct Face
17  {
18  int id;
19  cv::Rect bbox;
20  std::vector<cv::Point> landmarks;
21  };
22 
25  struct Frame
26  {
27  int id;
28  int width;
29  int height;
30  std::list<std::unique_ptr<Face>> faces;
31 
35  const Face* getFace(int id) const;
36  };
37 
40  enum FaceTrackingType
41  {
42  TRACKING_NONE = 0,
43  TRACKING_BRISK = 1,
44  TRACKING_LBP = 2
45  };
46 
52  {
53  public:
54 
59  virtual const Frame& addFrame(const cv::Mat& frame, int id = -1) = 0;
60 
64  virtual const std::list<std::unique_ptr<Frame>>& getSequence() const = 0;
65 
69  virtual std::list<std::unique_ptr<Frame>>& getSequenceMutable() = 0;
70 
73  virtual void clear() = 0;
74 
78  virtual std::shared_ptr<SequenceFaceLandmarks> clone() = 0;
79 
82  virtual const std::string& getModel() const = 0;
83 
86  virtual float getFrameScale() const = 0;
87 
91  virtual const std::string& getInputPath() const = 0;
92 
95  virtual FaceTrackingType getTracking() const = 0;
96 
99  virtual void load(const std::string& filePath) = 0;
100 
103  virtual void save(const std::string& filePath) const = 0;
104 
107  virtual void setFrameScale(float frame_scale) = 0;
108 
111  virtual void setModel(const std::string& modelPath) = 0;
112 
116  virtual void setInputPath(const std::string& inputPath) = 0;
117 
121  virtual void setTracking(FaceTrackingType tracking) = 0;
122 
125  virtual size_t size() const = 0;
126 
133  static std::shared_ptr<SequenceFaceLandmarks> create(
134  const std::string& landmarks_path, float frame_scale = 1.0f,
135  FaceTrackingType tracking = TRACKING_NONE);
136 
142  static std::shared_ptr<SequenceFaceLandmarks> create(
143  float frame_scale = 1.0f, FaceTrackingType tracking = TRACKING_NONE);
144  };
145 
146 } // namespace sfl
147 
148 #endif // __SFL_SEQUENCE_FACE_LANDMARKS__
Represents a face detected in a frame.
Definition: sequence_face_landmarks.h:16
int width
Frame width [pixels].
Definition: sequence_face_landmarks.h:28
cv::Rect bbox
Bounding box.
Definition: sequence_face_landmarks.h:19
Interface for sequence face landmarks functionality.
Definition: sequence_face_landmarks.h:51
Represents a frame that might include faces.
Definition: sequence_face_landmarks.h:25
std::list< std::unique_ptr< Face > > faces
Detected faces in the frame.
Definition: sequence_face_landmarks.h:30
std::vector< cv::Point > landmarks
Face landmarks.
Definition: sequence_face_landmarks.h:20
Definition: face_tracker.h:10
int id
Face id.
Definition: sequence_face_landmarks.h:18
int height
Frame height [pixels].
Definition: sequence_face_landmarks.h:29
int id
Frame id.
Definition: sequence_face_landmarks.h:27