| Face Engine SDK 5.34.0 A face detection, recognition and tracking engine.

Landmarks.h
1 #pragma once
2
3 #include <fsdk/Def.h>
4
5 #include <fsdk/Types/Vector2.h>
6
7 #include <algorithm>
8 #include <cstdint>
9 #include <iterator>
10
11 namespace fsdk {
13 typedef Vector2<float> Landmark;
14
22 template <size_t numOfLandmarks>
23 struct Landmarks {
24
25 // FSDK_DEPRECATED("landmarkCount deprecated. Use size() method to get length")
26 static constexpr uint64_t landmarkCount = numOfLandmarks;
27
29 Landmark landmarks[numOfLandmarks];
30
31 Landmarks() = default;
32 ~Landmarks() = default;
33
34 Landmarks(const Landmarks& cp) {
35 *this = cp;
36 }
37
38 Landmarks(Landmarks&& mv) {
39 *this = std::move(mv);
40 }
41
42 Landmarks& operator=(const Landmarks& cp) {
43 std::copy(std::begin(cp.landmarks), std::end(cp.landmarks), std::begin(landmarks));
44
45 return *this;
46 }
47
48 Landmarks& operator=(Landmarks&& mv) {
49 std::move(std::begin(mv.landmarks), std::end(mv.landmarks), std::begin(landmarks));
50
51 return *this;
52 }
53
54 constexpr size_t size() const noexcept {
55 return numOfLandmarks;
56 }
57
58 bool isValid() const noexcept {
59 const bool invalid = std::all_of(std::begin(landmarks), std::end(landmarks), [](const Landmark& l) {
60 return l.x == 0.f && l.y == 0.f;
61 });
62 return !invalid;
63 }
64 };
65
67 using Landmarks5 = Landmarks<5>;
69 using Landmarks68 = Landmarks<68>;
70
74 struct Landmarks5Indexes {
75 enum {
76 LandmarkLeftEye = 0,
77 LandmarkRightEye,
78 LandmarkNose,
79 LandmarkMouthLeftCorner,
80 LandmarkMouthRightCorner,
81 LandmarkCount
82 };
83 };
84
90 Landmarks5 FSDK_API convert(const Landmarks68& landmarks);
91 } // namespace fsdk
fsdk::Landmarks5Indexes
Enumerates detected landmarks. Only valid for template with 5 landmarks.
Definition: Landmarks.h:74
FSDK_API
#define FSDK_API
Dummy.
Definition: Def.h:27
fsdk
SDK namespace.
Definition: IAGSEstimator.h:8
fsdk::Landmarks
Face landmarks template structure.
Definition: Landmarks.h:23
fsdk::Landmarks5Indexes::LandmarkCount
Not a landmark; counts number of detected landmarks.
Definition: Landmarks.h:81
Def.h
Common SDK definitions.
fsdk::Landmarks5Indexes::LandmarkMouthRightCorner
Mouth right corner. Same as FL_MOUTH_RIGHT_CORENR.
Definition: Landmarks.h:80
fsdk::Landmarks5Indexes::LandmarkLeftEye
Left eye center.
Definition: Landmarks.h:76
fsdk::convert
Landmarks5 FSDK_API convert(const Landmarks68 &landmarks)
convert landmarks68 into landmarks5
fsdk::Landmarks5Indexes::LandmarkRightEye
Right eye center.
Definition: Landmarks.h:77
fsdk::Landmarks68
Landmarks< 68 > Landmarks68
alias for structure with 68 landmarks
Definition: Landmarks.h:69
fsdk::Landmarks::landmarks
Landmark landmarks[numOfLandmarks]
Detected landmarks.
Definition: Landmarks.h:29
fsdk::Landmarks5
Landmarks< 5 > Landmarks5
alias for structure with 5 landmarks
Definition: Landmarks.h:67
fsdk::Landmarks5Indexes::LandmarkNose
Nose tip. Same as FL_NOSE_TIP.
Definition: Landmarks.h:78
fsdk::Landmarks5Indexes::LandmarkMouthLeftCorner
Mouth left corner. Same as FL_MOUTH_LEFT_CORNER.
Definition: Landmarks.h:79
fsdk::Vector2< float >
fsdk::Landmark
Vector2< float > Landmark
Landmark floating point coordinates type.
Definition: Landmarks.h:13