#include "RgbDetect.h" #include #include #include #include #include #include "FiStdDefEx.h" #include #include "THFeature_i.h" //#include "THFaceLive_i.h" #include "LogUtil.h" shared_ptr> RgbDetect::rgb_image_buffer = nullptr; shared_ptr> RgbDetect::facePos = nullptr; shared_ptr> RgbDetect::rgb_image_buffer4 = nullptr; shared_ptr> 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; }