38 lines
928 B
C++
38 lines
928 B
C++
#ifndef _MOBILEFACEFEATURE_MNN_H
|
|
#define _MOBILEFACEFEATURE_MNN_H
|
|
#include <opencv2/opencv.hpp>
|
|
#include <vector>
|
|
#include <memory>
|
|
#include <mutex>
|
|
#include <MNN/Interpreter.hpp>
|
|
#include <MNN/MNNDefine.h>
|
|
#include <MNN/ImageProcess.hpp>
|
|
#include <MNN/Tensor.hpp>
|
|
|
|
|
|
class MobileFaceFeatureMnn
|
|
{
|
|
public:
|
|
static MobileFaceFeatureMnn* GetInstance();
|
|
|
|
int GetFaceFeature(const cv::Mat& img, const float* landmarks, float* feature);
|
|
|
|
private:
|
|
MobileFaceFeatureMnn();
|
|
~MobileFaceFeatureMnn();
|
|
|
|
cv::Mat estimateTrans(std::vector<cv::Point2f>& srcLmks, std::vector<cv::Point2f>& dstLmks);
|
|
cv::Mat FaceAlign(const cv::Mat& inputImage, const float* landmarks);
|
|
|
|
private:
|
|
static MobileFaceFeatureMnn* m_hInstance;
|
|
std::mutex m_mt;
|
|
|
|
std::shared_ptr<MNN::Interpreter> m_detector;
|
|
MNN::CV::ImageProcess::Config m_img_config;
|
|
MNN::Session* m_sess_mobileface;
|
|
MNN::Tensor* m_input_tensor;
|
|
MNN::Tensor* m_feature_tensor;
|
|
};
|
|
|
|
#endif |