#ifndef FACEID2_0_RGBDETECT_H
|
#define FACEID2_0_RGBDETECT_H
|
|
#include <memory>
|
#include "THFeature_i.h"
|
#include <memory>
|
|
#include "BaseDetect.h"
|
#include "FileUtil.h"
|
|
#include "FiStdDefEx.h"
|
//#include "THFaceLive_i.h"
|
#include <vector>
|
#include <stdio.h>
|
using namespace std;
|
|
class RgbDetect : public BaseDetect {
|
public:
|
RgbDetect(const char* rgbFileName, int width, int height) {
|
if (rgbFileName != nullptr) {
|
RgbDetect::rgbFileName = rgbFileName;
|
RgbDetect::width = width;
|
RgbDetect::height = height;
|
size_t fileSize = FileUtil::getFileSize(rgbFileName);
|
if (RgbDetect::fileSize != fileSize) {
|
RgbDetect::rgb_image_buffer = make_shared<vector<unsigned char>>(fileSize);
|
RgbDetect::fileSize = fileSize;
|
}
|
if (RgbDetect::rgb_image_buffer == nullptr) {
|
RgbDetect::rgb_image_buffer = make_shared<vector<unsigned char>>(fileSize);
|
}
|
if (RgbDetect::facePos == nullptr) {
|
RgbDetect::facePos = make_shared<vector<THFI_FacePos>>(5);
|
}
|
|
FILE *file = fopen(rgbFileName, "r+");
|
int bytes_read = fread(rgb_image_buffer.get()->data(), sizeof(unsigned char), fileSize, file);
|
fclose(file);
|
//FileUtil::readFile(rgbFileName, RgbDetect::rgb_image_buffer,fileSize);
|
}
|
}
|
bool detect(int detectFaceCount) ;
|
bool detect(int channel, int detectFaceCount) ;
|
bool detect4(int channel, int detectFaceCount) ;
|
static shared_ptr<vector<unsigned char>> rgb_image_buffer;
|
static shared_ptr<vector<THFI_FacePos>> facePos;
|
static shared_ptr<vector<unsigned char>> rgb_image_buffer4;
|
static shared_ptr<vector<THFI_FacePos>> facePos4;
|
static const char* rgbFileName;
|
static int width;
|
static int height;
|
static long int fileSize;
|
static int face_nums;
|
static int face_nums4;
|
|
};
|
|
|
#endif //FACEID2_0_RGBDETECT_H
|