liuxiaolong
2019-05-06 573d1e33a32da5c55c638df2ee622d972976c1d0
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
35
36
#include "RgbDetect.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
 
#include "FiStdDefEx.h"
#include <memory>
#include "THFeature_i.h"
//#include "THFaceLive_i.h"
#include "LogUtil.h"
 
shared_ptr<vector<unsigned char>> RgbDetect::rgb_image_buffer = nullptr;
shared_ptr<vector<THFI_FacePos>> RgbDetect::facePos = nullptr;
const char* RgbDetect::rgbFileName = nullptr;
int RgbDetect::width = 0;
int RgbDetect::height = 0;
long int RgbDetect::fileSize = 0;
int RgbDetect::face_nums = 0;
 
bool RgbDetect::detect(int detectFaceCount) {
    bool success = false;
    try {
        if (rgb_image_buffer != nullptr && rgb_image_buffer.get() != nullptr &&  fileSize > 0) {
            face_nums = THFI_DetectFace(0, rgb_image_buffer.get()->data(), 24, width, height, &(RgbDetect::facePos.get()->at(0)), 20,360);
            if (face_nums > 0) {
                success = true;
            }
 
        }
    }catch (exception & e) {
        LogUtil::log(e.what());
    }
    return success;
}