From 0bad0e6b94c566f63bb97661850899f679fd1d12 Mon Sep 17 00:00:00 2001
From: pans <pans@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期三, 04 一月 2017 16:06:48 +0800
Subject: [PATCH] 

---
 RtspFace/demo/src/tools.h        |    7 ++-
 RtspFace/demo/src/db/DBuntil.cpp |    4 +-
 RtspFace/demo/src/tools.cpp      |   61 ++++++++++++++++++++++++++++++
 RtspFace/demo/src/db/DBuntil.h   |    6 +-
 4 files changed, 70 insertions(+), 8 deletions(-)

diff --git a/RtspFace/demo/src/db/DBuntil.cpp b/RtspFace/demo/src/db/DBuntil.cpp
index ee9102f..8f9f108 100644
--- a/RtspFace/demo/src/db/DBuntil.cpp
+++ b/RtspFace/demo/src/db/DBuntil.cpp
@@ -71,7 +71,7 @@
 	return true;
 }
 
-int DBuntil::db_add(int f_id,person *per)
+bool DBuntil::db_add(int f_id,person *per)
 {
 	//
 	sprintf( sql, "INSERT INTO user_info(NAME, img) VALUES('%s', NULL)" , per->name );
@@ -88,7 +88,7 @@
 	return false;
 }
 
-int DBuntil::db_register(int f_id,person *per)
+bool DBuntil::db_register(int f_id,person *per)
 {
 	if(db_add(f_id,per)){
 		return true;
diff --git a/RtspFace/demo/src/db/DBuntil.h b/RtspFace/demo/src/db/DBuntil.h
index e642b02..337b371 100644
--- a/RtspFace/demo/src/db/DBuntil.h
+++ b/RtspFace/demo/src/db/DBuntil.h
@@ -25,13 +25,13 @@
 	~DBuntil();
 	person db_rearch(int f_id);
 
-	int db_register(int f_id,person *p);
+	bool db_register(int f_id,person *p);
 
 private:
 
-	int db_add(int f_id,person *per);
+	bool db_add(int f_id,person *per);
 	int db_update();
-	int db_select(int f_id,person *per);
+	bool db_select(int f_id,person *per);
 
 	char sql[1024];
 	int res;
diff --git a/RtspFace/demo/src/tools.cpp b/RtspFace/demo/src/tools.cpp
index ff644cc..b64f807 100644
--- a/RtspFace/demo/src/tools.cpp
+++ b/RtspFace/demo/src/tools.cpp
@@ -1 +1,60 @@
-#include "tools.h"
\ No newline at end of file
+#include "tools.h"
+
+tools::tools() {}
+
+tools::~tools() {}
+
+int tools::search(cv::Mat image,person *p)
+{
+	idx = f_api->do_reasch(image);
+	if(idx<0)
+	{
+		p = f_db->db_rearch(int);
+		if(p != NULL)
+		{
+			return 0;
+		}
+	}
+	return -1;
+}
+
+int tools::search(char* s_feature,person *p)
+{
+	idx = f_api->do_reasch(s_feature);
+	if(idx<0)
+	{
+		p = db_rearch(int);
+		if(p != NULL)
+		{
+			return 0;
+		}
+	}
+	return -1;
+}
+
+int tools::register(cv::Mat image,person *p)
+{
+	do_register(image,p);
+}
+
+person tools::do_search(int idx)
+{
+	person p;
+	p = f_db->db_rearch(int);
+	return p;
+}
+
+int tools::do_register(cv::Mat image,person *p)
+{
+	idx = f_api->do_register(image);
+	if(idx<0)
+	{
+		idx = f_db->do_register(idx,p);
+		if(idx)
+		{
+			return 0;
+		}
+	}
+	return -1;
+
+}
\ No newline at end of file
diff --git a/RtspFace/demo/src/tools.h b/RtspFace/demo/src/tools.h
index 74b2353..a4bc5db 100644
--- a/RtspFace/demo/src/tools.h
+++ b/RtspFace/demo/src/tools.h
@@ -4,8 +4,8 @@
 #include "DBuntil.h"
 #include "faceAPI.h"
 
-class faceAPI;
-class DButil;
+class faceAPI f_api;
+class DButil f_db;
 
 class tools
 {
@@ -14,8 +14,11 @@
 	~tools();
 	int search(cv::Mat image,person *p);
 	int search(char* s_feature,person *p);
+	int register(cv::Mat image,person *p);
 private:
+	int do_register(cv::Mat image,person *p);
 	person do_search(int idx);
+	int idx;
 }
 
 #endif
\ No newline at end of file

--
Gitblit v1.8.0