1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
| #include "tools.h"
|
| tools::tools()
| {
| }
|
| tools::~tools() {}
|
| bool tools::init(my_db mydb,char* db_path_t)
| {
|
| //my_db mydb= {"root","Basic@2017","localhost","demo",3306};
| if(dbu.db_init(mydb))
| {
| db_path = db_path_t;
| return true;
| }
| else
| return false;
| }
|
| int tools::search(cv::Mat image,person *p)
| {
| //p={};
| int temp = f_api.do_reasch(image);
| p->f_id = temp;
|
| if(p->f_id > 0)
| {
| if(do_search(p) == 0)
| {
| return 0;
| }
| }
| return -1;
| }
|
| int tools::search(char* s_feature,person *p)
| {
| p= {};
| p->f_id = f_api.do_reasch(s_feature);
| if(p->f_id > 0)
| {
| if(do_search(p) == 0)
| {
| return 0;
| }
| }
| return -1;
| }
|
| int tools::reg(cv::Mat image,person *p)
| {
| if(do_register(image,p) == 0)
| {
| return 0;
| }
| return -1;
| }
|
| int tools::do_search(person *p)
| {
| dbu.db_search(p);
| if(p->p_id != NULL)
| {
| return 0;
| }
| return -1;
| }
|
| int tools::do_register(cv::Mat image,person *p)
| {
| p= {};
| p->f_id = f_api.do_register(image);
| if(p->f_id > 0)
| {
| if(dbu.db_register(p))
| {
| return 0;
| }
| }
| return -1;
|
| }
|
|