modify proto
git-svn-id: http://192.168.1.226/svn/proxy@666 454eff88-639b-444f-9e54-f578c98de674
| | |
| | | #include "sample_face_search.h" |
| | | #include <cv_face.h> |
| | | |
| | | #define FDP_FDR_INVALID FDP_FaceDetectResult(0, 0) |
| | | #define FDP_FDR_INVALID FDP_FaceDetectResult(0, 0, 0) |
| | | #define ENABLE_AUTO_CREATE_STFACEDB |
| | | #define ENABLE_SEARCH_IN_NEGATIVE_DBID |
| | | #define ENABLE_SEARCH_IN_NEGATIVE_DBID |
| | |
| | | return detect_neg(img); |
| | | } |
| | | |
| | | return FDP_FaceDetectResult(img.db_id, result[0].idx); |
| | | return FDP_FaceDetectResult(img.db_id, result[0].idx, result[0].score); |
| | | } |
| | | |
| | | return FDP_FDR_INVALID; |
| | |
| | | if (idx <= 1) |
| | | return FDP_FDR_INVALID; |
| | | else |
| | | return FDP_FaceDetectResult(img.db_id, idx); |
| | | return FDP_FaceDetectResult(img.db_id, idx, 0); |
| | | } |
| | |
| | | void close_dbs(); |
| | | FDP_FaceDetectResult detect(const STFaceImage& img); |
| | | FDP_FaceDetectResult add(const STFaceImage& img); |
| | | fdr_vec_t search(const STFaceImage& img); |
| | | FDP_FaceDetectResult compare(const STFaceImage& img); |
| | | |
| | | //#todo need a delete img, if business not linked faceid and its personid |
| | | // they can delete it and save/find again! |
| | |
| | | int32_t st_id; // sensetime id
|
| | | int16_t confidence; // 1000 times of float confidence
|
| | |
|
| | | FDP_FaceDetectResult(int32_t _db_id, int32_t _st_id) : db_id(_db_id), st_id(_st_id), confidence(0)
|
| | | FDP_FaceDetectResult(int32_t _db_id, int32_t _st_id, int _confidence) : db_id(_db_id), st_id(_st_id), confidence(_confidence)
|
| | | {}
|
| | |
|
| | | void hton();
|
| | |
| | |
|
| | | 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.img", 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;
|
| | |
|
| | | sprintf(imgfn, "IMG_%d_%d_w%d_h%d.img", stfaceImg2.db_id, ++i, stfaceImg2.width, stfaceImg2.height);
|
| | | pFile = fopen(imgfn, "wb");
|
| | | fwrite(stfaceImg2.buff, sizeof(char), stfaceImg2.size, pFile);
|
| | | fclose(pFile);
|
| | | pFile = nullptr;
|
| | | //char imgfn[100 * 1024];
|
| | | //static int i = 0;
|
| | | //sprintf(imgfn, "IMG_%d_%d_w%d_h%d.img", 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;
|
| | | //
|
| | | //sprintf(imgfn, "IMG_%d_%d_w%d_h%d.img", stfaceImg2.db_id, ++i, stfaceImg2.width, stfaceImg2.height);
|
| | | //pFile = fopen(imgfn, "wb");
|
| | | //fwrite(stfaceImg2.buff, sizeof(char), stfaceImg2.size, pFile);
|
| | | //fclose(pFile);
|
| | | //pFile = nullptr;
|
| | | |
| | | //fdr_vec_t result;
|
| | | //FDP_FaceDetectResult fdrResult = g_STFaceCache.add(stfaceImg);
|
| | | //result.push_back(fdrResult);
|
| | | //
|
| | | //int ret = (fdrResult.db_id == 0 ? -1 : 0);
|
| | | //return send_SensetimeFaceDetectResultJson(client, result, ret);
|
| | | }
|
| | |
|
| | | bool ev_dispatcher_proto_pb(EVClientStub& client)
|
| | |
| | | {
|
| | | db_id = htonl(db_id);
|
| | | st_id = htonl(st_id);
|
| | | confidence = htons(confidence);
|
| | | }
|
| | |
|
| | | void FDP_FaceDetectResult::ntoh()
|
| | | {
|
| | | db_id = ntohl(db_id);
|
| | | st_id = ntohl(st_id);
|
| | | confidence = ntohs(confidence);
|
| | | }
|