#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;
|
shared_ptr<vector<unsigned char>> RgbDetect::rgb_image_buffer4 = nullptr;
|
shared_ptr<vector<THFI_FacePos>> RgbDetect::facePos4 = nullptr;
|
const char* RgbDetect::rgbFileName = nullptr;
|
int RgbDetect::width = 0;
|
int RgbDetect::height = 0;
|
long int RgbDetect::fileSize = 0;
|
int RgbDetect::face_nums = 0;
|
int RgbDetect::face_nums4 = 0;
|
|
bool RgbDetect::detect(int channel, int detectFaceCount) {
|
bool success = false;
|
try {
|
if (rgb_image_buffer != nullptr && rgb_image_buffer.get() != nullptr && fileSize > 0) {
|
face_nums = THFI_DetectFace(channel, rgb_image_buffer.get()->data(), 24, width, height, &(RgbDetect::facePos.get()->at(0)), 20,360);
|
//face_nums = THFI_DetectFace(channel, rgb_image_buffer.get()->data(), 24, width, height, &(RgbDetect::facePos.get()->at(0)), 1,0);
|
if (face_nums > 0) {
|
success = true;
|
}
|
|
}
|
}catch (exception & e) {
|
LogUtil::log(e.what());
|
}
|
return success;
|
}
|
|
bool RgbDetect::detect4(int channel, int detectFaceCount) {
|
bool success = false;
|
try {
|
if (rgb_image_buffer4 != nullptr && rgb_image_buffer4.get() != nullptr && fileSize > 0) {
|
face_nums4 = THFI_DetectFace(channel, rgb_image_buffer4.get()->data(), 24, width, height, &(RgbDetect::facePos4.get()->at(0)), 20,360);
|
if (face_nums4 > 0) {
|
success = true;
|
}
|
|
}
|
}catch (exception & e) {
|
LogUtil::log(e.what());
|
}
|
return success;
|
}
|
|
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;
|
}
|