chenshijun
2019-04-08 a2dee087defb9e36165bedb5e4b895704d624e6f
QiaoJiaSystem/FaceDetectServer/FaceExtractServerI.cpp
@@ -4,6 +4,7 @@
#include <QtCore/QSharedMemory>
#include <basic/timer_counter/Clocktimer.h>
#include <THFeature_i.h>
//#include <basic/util/opencv/CvUtil.h>
FaceExtractServerI::FaceExtractServerI() {
    long threadMax = appPref.getIntData("thread.max");
@@ -41,6 +42,23 @@
        memcpy(&facesPos, &pos, sizeof(facesPos) - sizeof(facesPos.pFacialData));
        memcpy(facesPos.pFacialData, pos.pFacialData.data(), sizeof(facesPos.pFacialData));
        feature.resize(EF_Size());
//        INFO("faceExtract channel:" << channel << " width:" << width << " height:"  << height);
//        {
//            //#todo
//            std::string string1(AppUtil::getTimeString() +".jpg");
//            DBG("save Image fe:" << string1);
//            cv::Mat image(height, width, CV_8UC3, (u_char *)data);
//            cv::imwrite(string1, image);
//
//            cv::Rect area(facesPos.rcFace.left, facesPos.rcFace.top, \
//            facesPos.rcFace.right - facesPos.rcFace.left, facesPos.rcFace.bottom-facesPos.rcFace.top);
//            cv::Mat img_region = image(area);
//            std::string string2("face_" + string1);
//            cv::imwrite(string2, img_region);
//        }
        INFO("facesPos:nQuality:"  << facesPos.nQuality << "; rect[left:" << facesPos.rcFace.left << " top:" << \
        facesPos.rcFace.top << " right:" << facesPos.rcFace.right << " bottom:" << facesPos.rcFace.bottom << "]");
        int ret = EF_Extract(channel, (BYTE *) data, width, height, 3, &facesPos, feature.data());
        if (ret != 1) {
            ERR("THFP_Execute_V2 faild, returns " << ret)
@@ -50,5 +68,6 @@
        ERR("shareMemory attach faild");
//        throw std::runtime_error("shareMemory attach faild");
    }
    return feature;
}