| | |
| | | ss << "\"result\":[";
|
| | | for(fdr_vec_t::const_iterator iter = result.begin(); iter != result.end(); ++iter)
|
| | | {
|
| | | ss << "[" << WRAPPER_TEXT(iter->db_id) << "," << WRAPPER_TEXT(iter->st_id) << "]";
|
| | | ss << "[" << WRAPPER_TEXT(iter->db_id) << "," << WRAPPER_TEXT(iter->st_id) << "," << WRAPPER_TEXT(iter->confidence) << "]";
|
| | | if (iter != std::prev(result.end()))
|
| | | ss << ",";
|
| | | }
|
| | |
| | | return send_SensetimeFaceDetectResultJson(client, result, ret);
|
| | | }
|
| | |
|
| | | bool ev_proc_SensetimeFaceDetectCompare(EVClientStub& client)
|
| | | {
|
| | | EVPHeader* evpHeader = (EVPHeader*)client.recvBuff;
|
| | | FDP_Image* fdpImage1 = (FDP_Image*)(client.recvBuff + sizeof(EVPHeader));
|
| | | fdpImage1->ntoh();
|
| | | |
| | | STFaceImage stfaceImg1;
|
| | | stfaceImg1.db_id = fdpImage1->db_id;
|
| | | stfaceImg1.mb_type = fdpImage1->mb_type;
|
| | | stfaceImg1.width = fdpImage1->width;
|
| | | stfaceImg1.height = fdpImage1->height;
|
| | | stfaceImg1.size = fdpImage1->size;
|
| | | stfaceImg1.buff = fdpImage1->buff;
|
| | | |
| | | FDP_Image* fdpImage2 = (FDP_Image*)(client.recvBuff + sizeof(EVPHeader) + sizeof(FDP_Image) + fdpImage1->size);
|
| | | fdpImage2->ntoh();
|
| | | |
| | | STFaceImage stfaceImg2;
|
| | | stfaceImg2.db_id = fdpImage2->db_id;
|
| | | stfaceImg2.mb_type = fdpImage2->mb_type;
|
| | | stfaceImg2.width = fdpImage2->width;
|
| | | stfaceImg2.height = fdpImage2->height;
|
| | | stfaceImg2.size = fdpImage2->size;
|
| | | stfaceImg2.buff = fdpImage2->buff;
|
| | | |
| | | LOGP(DEBUG, "stfaceImg2 db_id=%d, mb_type=%d, width=%d, height=%d, size=%d", |
| | | (int)stfaceImg2.db_id, (int)stfaceImg2.mb_type, (int)stfaceImg2.width, (int)stfaceImg2.height, (int)stfaceImg2.size);
|
| | | |
| | | char imgfn[100 * 1024];
|
| | | static int i = 0;
|
| | | sprintf(imgfn, "IMG_%d_%d_w%d_h%d.rgb565", stfaceImg1.db_id, ++i, stfaceImg1.width, stfaceImg1.height);
|
| | | FILE * pFile = fopen(imgfn, "wb");
|
| | | fwrite(stfaceImg1.buff, sizeof(char), stfaceImg1.size, pFile);
|
| | | fclose(pFile);
|
| | | pFile = nullptr;
|
| | | }
|
| | |
|
| | | bool ev_dispatcher_proto_pb(EVClientStub& client)
|
| | | {
|
| | | LOG_DEBUG << "ev_dispatcher_proto_pb" << LOG_ENDL;
|
| | |
| | | case FaceDaemonCommand::FDC_SENSETIMEFACEDETECT_SAVE:
|
| | | return ev_proc_SensetimeFaceDetectSave(client);
|
| | | break;
|
| | | case FaceDaemonCommand::FDC_SENSETIMEFACEDETECT_COMPARE:
|
| | | return ev_proc_SensetimeFaceDetectCompare(client);
|
| | | break;
|
| | | default:
|
| | | LOG_WARN << "Unknown command" << LOG_ENDL;
|
| | | ev_send_status_packet(client, EVPStatus::EVPS_COMMAND_ERROR);
|