| | |
| | | #include "tools.h" |
| | | #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) |
| | | { |
| | | p={}; |
| | | p->f_id = f_api.do_reasch(image); |
| | | 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; |
| | | |
| | | } |