| | |
| | | #include "tools.h" |
| | | |
| | | tools::tools() { |
| | | my_db mydb={"root","Basic@2017","localhost","demo",3306}; |
| | | |
| | | dbu = DBuntil(mydb); |
| | | tools::tools() |
| | | { |
| | | } |
| | | |
| | | tools::~tools() {} |
| | | |
| | | bool tools::init(){ |
| | | my_db mydb= {"root","Basic@2017","localhost","demo",3306}; |
| | | //DBuntil dbu =DBuntil(); |
| | | return dbu.db_init(mydb); |
| | | } |
| | | |
| | | int tools::search(cv::Mat image,person *p) |
| | | { |
| | | idx = f_api.do_reasch(image); |
| | | if(idx<0) |
| | | //p={}; |
| | | int temp = f_api.do_reasch(image); |
| | | std::cout<<"temp="<<temp<<std::endl; |
| | | p->f_id = temp; |
| | | std::cout<<"p->f_id"<<p->f_id<<std::endl; |
| | | 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; |
| | | //if(dbu.myCont == NULL){ |
| | | // std::cout<<"myCont is null"<<std::endl; |
| | | //} |
| | | |
| | | 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; |
| | | } |