Face Engine SDK  5.23.1
A face detection, recognition and tracking engine.
include/fsdk/Types/Landmarks.h
00001 #pragma once
00002 
00003 #include <fsdk/Def.h>
00004 
00005 #include <fsdk/Types/Vector2.h>
00006 
00007 #include <algorithm>
00008 #include <cstdint>
00009 #include <iterator>
00010 
00011 namespace fsdk {
00013     typedef Vector2<float> Landmark;
00014 
00022     template <size_t numOfLandmarks>
00023     struct Landmarks {
00024 
00025         // FSDK_DEPRECATED("landmarkCount deprecated. Use size() method to get length")
00026         static constexpr uint64_t landmarkCount = numOfLandmarks;
00027 
00029         Landmark landmarks[numOfLandmarks];
00030 
00031         Landmarks() = default;
00032         ~Landmarks() = default;
00033 
00034         Landmarks(const Landmarks& cp) {
00035             *this = cp;
00036         }
00037 
00038         Landmarks(Landmarks&& mv) {
00039             *this = std::move(mv);
00040         }
00041 
00042         Landmarks& operator=(const Landmarks& cp) {
00043             std::copy(std::begin(cp.landmarks), std::end(cp.landmarks), std::begin(landmarks));
00044 
00045             return *this;
00046         }
00047 
00048         Landmarks& operator=(Landmarks&& mv) {
00049             std::move(std::begin(mv.landmarks), std::end(mv.landmarks), std::begin(landmarks));
00050 
00051             return *this;
00052         }
00053 
00054         constexpr size_t size() const noexcept {
00055             return numOfLandmarks;
00056         }
00057 
00058         bool isValid() const noexcept {
00059             const bool invalid = std::all_of(std::begin(landmarks), std::end(landmarks), [](const Landmark& l) {
00060                 return l.x == 0.f && l.y == 0.f;
00061             });
00062             return !invalid;
00063         }
00064     };
00065 
00067     using Landmarks5 = Landmarks<5>;
00069     using Landmarks68 = Landmarks<68>;
00070 
00074     struct Landmarks5Indexes {
00075         enum {
00076             LandmarkLeftEye = 0,      
00077             LandmarkRightEye,         
00078             LandmarkNose,             
00079             LandmarkMouthLeftCorner,  
00080             LandmarkMouthRightCorner, 
00081             LandmarkCount             
00082         };
00083     };
00084 
00090     Landmarks5 FSDK_API convert(const Landmarks68& landmarks);
00091 } // namespace fsdk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines