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

---
 RtspFace/demo/src/tools.cpp |   69 ++++++++++++++++++++++++++++++++++
 1 files changed, 68 insertions(+), 1 deletions(-)

diff --git a/RtspFace/demo/src/tools.cpp b/RtspFace/demo/src/tools.cpp
index ff644cc..42c1515 100644
--- a/RtspFace/demo/src/tools.cpp
+++ b/RtspFace/demo/src/tools.cpp
@@ -1 +1,68 @@
-#include "tools.h"
\ No newline at end of file
+#include "tools.h"
+
+tools::tools() {
+	my_db mydb={"root","Basic@2017","localhost","demo",3306};
+	
+	dbu = DBuntil(mydb);
+}
+
+tools::~tools() {}
+
+int tools::search(cv::Mat image,person *p)
+{
+	idx = f_api->do_reasch(image);
+	if(idx<0)
+	{
+		p = dbu->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)
+{
+	if(do_register(image,p) == 0){
+		return 0;
+	}
+	return -1;
+}
+
+person tools::do_search(int idx)
+{
+	person p;
+	p = dbu->db_rearch(int);
+	return p;
+}
+
+int tools::do_register(cv::Mat image,person *p)
+{
+	idx = f_api->do_register(image);
+	if(idx<0)
+	{
+		p->f_id = idx;
+		idx = dbu->do_register(idx,p);
+		if(idx)
+		{
+			return 0;
+		}
+	}
+	return -1;
+
+}
\ No newline at end of file

--
Gitblit v1.8.0