houxiao
2017-06-28 58a24b1c56d0d9db2aff1eedfb3ab79ea95718cb
modify proto

git-svn-id: http://192.168.1.226/svn/proxy@666 454eff88-639b-444f-9e54-f578c98de674
5个文件已修改
46 ■■■■■ 已修改文件
FaceServer/STFaceCache.cpp 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FaceServer/STFaceCache.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FaceServer/face_daemon_proto.h 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
FaceServer/main_face_daemon.cpp 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FaceServer/proto_hton_ntoh.cpp 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
FaceServer/STFaceCache.cpp
@@ -9,7 +9,7 @@
#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
@@ -254,7 +254,7 @@
            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;
@@ -318,5 +318,5 @@
    if (idx <= 1)
        return FDP_FDR_INVALID;
    else
        return FDP_FaceDetectResult(img.db_id, idx);
        return FDP_FaceDetectResult(img.db_id, idx, 0);
}
FaceServer/STFaceCache.h
@@ -19,6 +19,8 @@
    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!
FaceServer/face_daemon_proto.h
@@ -55,7 +55,7 @@
    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();
FaceServer/main_face_daemon.cpp
@@ -168,21 +168,27 @@
    
    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)
FaceServer/proto_hton_ntoh.cpp
@@ -66,10 +66,12 @@
{
    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);
}