From 821b1bea4a77497506c3e22529ba76b2f84cceb7 Mon Sep 17 00:00:00 2001
From: xuxiuxi <xuxiuxi@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期三, 03 五月 2017 11:57:01 +0800
Subject: [PATCH]
---
RtspFace/SensetimeFaceAPIWrapper/src/faceAPI.cpp | 28 ++++++++++++++++++++++++++--
1 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/RtspFace/SensetimeFaceAPIWrapper/src/faceAPI.cpp b/RtspFace/SensetimeFaceAPIWrapper/src/faceAPI.cpp
index bd26a51..23e5868 100644
--- a/RtspFace/SensetimeFaceAPIWrapper/src/faceAPI.cpp
+++ b/RtspFace/SensetimeFaceAPIWrapper/src/faceAPI.cpp
@@ -1,7 +1,7 @@
锘�#include "faceAPI.h"
#include <iostream>
-FaceDB *fdb;
+
FaceAPI::FaceAPI()
{
//鍒涘缓闈欐�佷汉鑴歌瘑鍒彞鏌勶紝鍚屾椂鍒涘缓鐘舵�佹爣閲�
@@ -14,6 +14,11 @@
FaceAPI::~FaceAPI()
{
+}
+
+int FaceAPI::do_init(char* db_path)
+{
+ return fdb->init(db_path);
}
//@brief 鎼滅储鍔熻兘
@@ -55,7 +60,11 @@
p_f = fdb->extract_feature(image);
int indx = fdb->db_add(p_f);
if(fdb->finally())
+ {
+ fprintf(stderr, "fdb->finally()%d\n",indx);
return indx;
+ }
+
return -2;
}
@@ -137,6 +146,7 @@
{
if(db_save())
{
+
return true;
}
@@ -175,7 +185,9 @@
{
fprintf(stderr, "save done!\n");
}
+
cv_verify_destroy_db(handle_db);
+ fprintf(stderr, "db_save end!\n");
return true;
}
@@ -236,7 +248,7 @@
fprintf(stderr, "cv_verify_search_face failed, error code %d\n", cv_result);
}
std::cout<<"this is hits"<<std::endl;
- if (top_scores[0] != 0)
+ if (top_scores[0] >= 0.7)
{
indx=top_idxs[0];
std::cout<<"indx="<<indx<<std::endl;
@@ -274,15 +286,27 @@
cv_face_t *p_face = NULL;
int face_count = 0;
cv_result_t st_result = CV_OK;
+ fprintf(stderr, "cv_face_detect start!\n");
+ if (handle_detect != NULL)
+ {
+ fprintf(stderr, "handle_detect is not null!\n");
+ }
+ else
+ {
+ fprintf(stderr, "handle_detect is null!\n");
+ }
st_result = cv_face_detect(handle_detect, image_color.data, CV_PIX_FMT_BGR888,
image_color.cols, image_color.rows, image_color.step,
CV_FACE_UP, &p_face, &face_count);
+ fprintf(stderr, "cv_face_detect end!\n");
if (face_count >= 1)
{
+ fprintf(stderr, "cv_verify_get_feature end!\n");
st_result = cv_verify_get_feature(handle_verify,
(unsigned char *)image_color.data, CV_PIX_FMT_BGR888,
image_color.cols, image_color.rows, image_color.step,
p_face, &p_feature, NULL);
+ fprintf(stderr, "cv_verify_get_feature end!\n");
if (st_result != CV_OK)
{
fprintf(stderr, "cv_verify_get_feature failed, error code %d\n", st_result);
--
Gitblit v1.8.0