| | |
| | | #include "MaterialBuffer.h"
|
| | | #include "logger.h"
|
| | |
|
| | | #include "SensetimeFaceAPIWrapper/src/FaceDBPool.h"
|
| | | //#include "SensetimeFaceAPIWrapper/src/FaceDBPool.h"
|
| | | //#include "SensetimeFaceAPIWrapper/src/faceAPI.h"
|
| | | #include <opencv2/opencv.hpp>
|
| | | #include <cv_face.h>
|
| | |
|
| | |
| | |
|
| | | if (pm.type != PipeMaterial::PMT_FRAME || !(in->config.payWithDbFrame))
|
| | | {
|
| | | LOG_ERROR << "Only support PMT_FRAME (SensetimeFaceDetectDbFrame)";
|
| | | LOG_ERROR << "Only support PMT_FRAME (SensetimeFaceDetectDbFrame)" << std::endl;
|
| | | return false;
|
| | | }
|
| | |
|
| | |
| | | SensetimeFaceDetectDbFrame* frame = (SensetimeFaceDetectDbFrame*)pm.buffer;
|
| | | if (frame->type != MB_Frame::MBFT_YUV420)
|
| | | {
|
| | | LOG_ERROR << "Only support MBFT_YUV420";
|
| | | LOG_ERROR << "Only support MBFT_YUV420" << std::endl;
|
| | | return false;
|
| | | }
|
| | |
|
| | | faceDB* _faceDB = (faceDB*)frame->_faceDB;
|
| | | if (_faceDB == nullptr)
|
| | | {
|
| | | LOG_ERROR << "faceDB is null";
|
| | | return false;
|
| | | }
|
| | | //FaceDB* _faceDB = (FaceDB*)frame->_faceDB;
|
| | | //if (_faceDB == nullptr)
|
| | | //{
|
| | | // LOG_ERROR << "FaceDB is null" << std::endl;
|
| | | // return false;
|
| | | //}
|
| | |
|
| | | const size_t expectedYUVSize = frame->width * frame->height * 1.5;
|
| | | if (frame->buffSize < expectedYUVSize)
|
| | | {
|
| | | LOG_WARN << "image size not ok";
|
| | | LOG_WARN << "image size not ok" << std::endl;
|
| | | return false;
|
| | | }
|
| | |
|
| | | cv::Mat yuvMat(cv::Size(frame->width,frame->height), CV_8UC3, frame->buffer);
|
| | | cv_feature_t* feature = _faceDB->extract_feature(yuvMat);
|
| | | in->lastResult.st_id = _faceDB->search_db(feature);
|
| | | //cv_feature_t* feature = _faceDB->extract_feature(yuvMat);
|
| | | //in->lastResult.st_id = _faceDB->search_db(feature);
|
| | | |
| | | //in->lastResult.st_id = _faceDB->do_reasch(yuvMat);
|
| | | //#todo release feature
|
| | |
|
| | | in->lastResult.school_id = frame->school_id;
|
| | |
| | |
|
| | | if (! in->config.resultStructOnly)
|
| | | {
|
| | | LOG_ERROR << "Only support resultStructOnly";
|
| | | LOG_ERROR << "Only support resultStructOnly" << std::endl;
|
| | | return false;
|
| | | }
|
| | |
|