a
554325746@qq.com
2020-01-02 e52632329ef8342a2f692bf58184fc54db3d2b4c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "LivenessDetect.h"
 
#include "FiStdDefEx.h"
//#include "THFaceLive_i.h"
#include "RgbDetect.h"
#include "GrayDetect.h"
#include "LogUtil.h"
 
bool LivenessDetect::detect(int faceIndex) {
    bool success = false;
    try {
        if (GrayDetect::grayImageBuff != nullptr && GrayDetect::grayImageBuff.get() != nullptr && GrayDetect::grayImageBuff.get()->data() !=
                                                                                                          nullptr) {
            unsigned char* pBuf_color = RgbDetect::rgb_image_buffer.get()->data();
            unsigned char* pBuf_bw = GrayDetect::grayImageBuff.get()->data();
            THFI_FacePos*  ptfp_color = &RgbDetect::facePos.get()->at(faceIndex);
            THFI_FacePos* ptfp_bw  = &GrayDetect::facePos.get()->at(faceIndex);
            int    liveness = 0;
//            THFL_Detect(0,  RgbDetect::rgb_image_buffer.get()->data(),
//                                          GrayDetect::grayImageBuff.get()->data(),
//                                          RgbDetect::width, RgbDetect::height,
//                                          &RgbDetect::facePos.get()->at(faceIndex), &GrayDetect::facePos.get()->at(faceIndex),20);
            this->liveness = liveness;
            if(liveness == 1) {
                success = true;
            }
        }
 
 
    }catch (exception & e) {
        LogUtil::log(e.what());
    }
    return success;
}