59 lines
1.6 KiB
C++
59 lines
1.6 KiB
C++
/*************************************************************************
|
|
*
|
|
* DeepCam CONFIDENTIAL
|
|
* FILE: CenterFaceMnn.h
|
|
*
|
|
* [2019] - [2020] DeepCam, LLC and DeepCam
|
|
NOTICE:
|
|
* All information contained herein is, and remains the property of DeepCam LLC.
|
|
* The intellectual and technical concepts contained herein are proprietary to DeepCam
|
|
* and may be covered by U.S. and Foreign Patents,patents in process, and are protected by
|
|
* trade secret or copyright law.
|
|
* Dissemination of this information or reproduction of this material
|
|
* is strictly forbidden unless prior written permission is obtained
|
|
* DeepCam, LLC.
|
|
*
|
|
*
|
|
* Written: DongPo Wang
|
|
* Date: 11/23/2020
|
|
* Mail: dongpo.wang@deepcam.com
|
|
*/
|
|
|
|
|
|
#ifndef LIVENESS_RGB_H
|
|
#define LIVENESS_RGB_H
|
|
#include <string>
|
|
#include <memory>
|
|
#include <mutex>
|
|
#include <MNN/Interpreter.hpp>
|
|
#include <MNN/MNNDefine.h>
|
|
#include <MNN/ImageProcess.hpp>
|
|
#include <MNN/Tensor.hpp>
|
|
#include <opencv2/opencv.hpp>
|
|
|
|
#include "CenterFaceMnn.h"
|
|
|
|
class LivenessRGB
|
|
{
|
|
public:
|
|
static LivenessRGB* GetInstance();
|
|
float LivenessDetect(const cv::Mat& img, const float* landmark);
|
|
private:
|
|
LivenessRGB();
|
|
~LivenessRGB();
|
|
|
|
cv::Mat GetFace(const cv::Mat &src, const float* landmark);
|
|
cv::Mat FaceAlign(const cv::Mat& frame, const float* landmark, float face_rate = 1.25f);
|
|
|
|
private:
|
|
static LivenessRGB* m_instance;
|
|
std::mutex m_mt;
|
|
std::shared_ptr<MNN::Interpreter> m_detector;
|
|
MNN::Session* m_session;
|
|
MNN::CV::ImageProcess::Config m_img_config;
|
|
MNN::Tensor* m_input_tensor;
|
|
MNN::Tensor* m_score_tensor;
|
|
std::shared_ptr<MNN::CV::ImageProcess> m_pretreat;
|
|
};
|
|
|
|
#endif |