#pragma once #include #include #include #include #include #include #include class FaceRecognizer { public: struct Detection { int person; float confidence; cv::Rect rect; }; class LoadException : public std::exception { private: std::string message; public: LoadException(const std::string& msg): std::exception(), message(msg) {} virtual const char* what() const throw() override { return message.c_str(); } }; private: std::vector referanceFeatures; std::shared_ptr recognizer; std::shared_ptr detector; double threshold = 0.363; public: FaceRecognizer(std::filesystem::path recognizerPath = "", const std::filesystem::path& detectorPath = "", const std::vector& referances = std::vector()); cv::Mat detectFaces(const cv::Mat& input); Detection isMatch(const cv::Mat& input, bool alone = false); bool addReferances(const std::vector& referances); void setThreshold(double threashold); double getThreshold(); void clearReferances(); };