| | |
| | | #include "tools.h" |
| | | |
| | | tools::tools() { |
| | | tools::tools() |
| | | { |
| | | my_db mydb={"root","Basic@2017","localhost","demo",3306}; |
| | | |
| | | dbu = DBuntil(mydb); |
| | |
| | | |
| | | int tools::search(cv::Mat image,person *p) |
| | | { |
| | | idx = f_api.do_reasch(image); |
| | | if(idx<0) |
| | | p={}; |
| | | p->f_id = f_api.do_reasch(image); |
| | | if(p->f_id < 0) |
| | | { |
| | | p = dbu.db_rearch(idx); |
| | | if(p != NULL) |
| | | if(do_search(p) == 0) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | |
| | | int tools::search(char* s_feature,person *p) |
| | | { |
| | | idx = f_api.do_reasch(s_feature); |
| | | if(idx<0) |
| | | p={}; |
| | | p->f_id = f_api.do_reasch(s_feature); |
| | | if(p->f_id < 0) |
| | | { |
| | | p = dbu.db_rearch(idx); |
| | | if(p != NULL) |
| | | if(do_search(p) == 0) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | |
| | | int tools::reg(cv::Mat image,person *p) |
| | | { |
| | | if(do_register(image,p) == 0){ |
| | | if(do_register(image,p) == 0) |
| | | { |
| | | return 0; |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | person tools::do_search(int idx) |
| | | int tools::do_search(person *p) |
| | | { |
| | | person p; |
| | | p = dbu.db_rearch(idx); |
| | | return p; |
| | | dbu.db_search(p); |
| | | if(p->p_id != NULL) |
| | | { |
| | | return 0; |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | int tools::do_register(cv::Mat image,person *p) |
| | | { |
| | | idx = f_api.do_register(image); |
| | | if(idx<0) |
| | | p={}; |
| | | p->f_id = f_api.do_register(image); |
| | | if(p->f_id < 0) |
| | | { |
| | | p->f_id = idx; |
| | | if(dbu.db_register(idx,p)) |
| | | if(dbu.db_register(p)) |
| | | { |
| | | return 0; |
| | | } |