| | |
| | | #include "ev_server.h"
|
| | | #include "ev_proto.h"
|
| | | #include "face_daemon_proto.h"
|
| | |
|
| | | #include "STFaceCache.h"
|
| | | #include <PbFaceList.pb.h>
|
| | |
|
| | | #include <signal.h>
|
| | |
| | | #include <sstream>
|
| | | #include <iostream>
|
| | |
|
| | | #define WRAPPER_TEXT(x) "\"" << x << "\""
|
| | |
|
| | | Logger g_logger(std::cout);
|
| | | STFaceCache g_STFaceCache("/opt/FaceServer/stfacedb");
|
| | |
|
| | | evclient_proc_t evclient_proc;
|
| | |
|
| | |
| | | {
|
| | | std::stringstream ss;
|
| | | ss << "{" << std::endl;
|
| | | ss << "\"ret\":" << 0 << "," << std::endl;
|
| | | ss << "\"count\":" << result.size() << "," << std::endl;
|
| | | ss << "\"ret\":" << WRAPPER_TEXT(0) << "," << std::endl;
|
| | | ss << "\"count\":" << WRAPPER_TEXT(result.size()) << "," << std::endl;
|
| | | ss << "\"result\":[";
|
| | | for(fdr_vec_t::const_iterator iter = result.begin(); iter != result.end(); ++iter)
|
| | | {
|
| | | ss << "[" << iter->db_id << "," << iter->st_id << "]";
|
| | | ss << "[" << WRAPPER_TEXT(iter->db_id) << "," << WRAPPER_TEXT(iter->st_id) << "]";
|
| | | if (iter != std::prev(result.end()))
|
| | | ss << ",";
|
| | | }
|
| | |
| | | LOGP(DEBUG, "pbFaceList: magic=%u, image_count=%u, src_width=%u, src_height=%u",
|
| | | pbFaceList.magic(), pbFaceList.image_count(), pbFaceList.src_width(), pbFaceList.src_height());
|
| | |
|
| | | fdr_vec_t result;
|
| | | |
| | | for(int i = 0; i < pbFaceList.image_count(); i++)
|
| | | {
|
| | | const PbFaceList_FaceListImage& pbFaceListImage = pbFaceList.images(i);
|
| | | LOGP(DEBUG, "\tpbFaceList %d: idx=%u, size=%u, type=%u, width=%u, height=%u, top_left_x=%u, top_left_y=%u",
|
| | | i, pbFaceListImage.idx(), pbFaceListImage.size(), pbFaceListImage.type(), pbFaceListImage.width(), pbFaceListImage.height(), pbFaceListImage.top_left_x(), pbFaceListImage.top_left_y());
|
| | | |
| | | char imgfn[100 * 1024];
|
| | | sprintf(imgfn, "PB_%d_%d.yuv", 0, i);
|
| | |
|
| | | FILE * pFile = fopen(imgfn, "wb");
|
| | | fwrite(*(pbFaceListImage.img().data()), sizeof(char), pbFaceListImage.size(), pFile);
|
| | | fclose(pFile);
|
| | | pFile = nullptr;
|
| | | |
| | | //#test
|
| | | //char imgfn[100 * 1024];
|
| | | //sprintf(imgfn, "PB_%d_%d.yuv", 0, i);
|
| | | //
|
| | | //FILE * pFile = fopen(imgfn, "wb");
|
| | | const std::string* img(*pbFaceListImage.img().data());
|
| | | //fwrite(img->data(), sizeof(char), img->size(), pFile);
|
| | | //fclose(pFile);
|
| | | //pFile = nullptr;
|
| | | |
| | | STFaceImage stimg;
|
| | | stimg.db_id = fdpFaceDetectPB->db_id;
|
| | | stimg.mb_type = pbFaceListImage.type();
|
| | | stimg.width = pbFaceListImage.width();
|
| | | stimg.height = pbFaceListImage.height();
|
| | | stimg.size = img->size();
|
| | | stimg.buff = (const uint8_t*)img->data();
|
| | | result.push_back(g_STFaceCache.detect(stimg));
|
| | | }
|
| | | |
| | | |
| | | fdr_vec_t result;
|
| | | |
| | | //do detect(client)
|
| | | result.push_back(FDP_FaceDetectResult(-1,123));
|
| | | result.push_back(FDP_FaceDetectResult(2,456));
|
| | | result.push_back(FDP_FaceDetectResult(0,0));
|
| | |
|
| | | //#test
|
| | | //result.push_back(FDP_FaceDetectResult(-1,123));
|
| | | //result.push_back(FDP_FaceDetectResult(2,456));
|
| | | //result.push_back(FDP_FaceDetectResult(0,0));
|
| | |
|
| | | return send_SensetimeFaceDetectResultJson(client, result);
|
| | | }
|