git-svn-id: http://192.168.1.226/svn/proxy@77 454eff88-639b-444f-9e54-f578c98de674
| | |
| | | bool DBuntil::db_select(person* per)
|
| | | {
|
| | | std::cout<<"db_select start"<<std::endl;
|
| | | sprintf( sql, "select a.p_id,b.`name`,b.img from face_person a,user_info b where a.face_id = %d AND a.p_id = b.pid " ,per->f_id );
|
| | |
|
| | | sprintf( sql, "select a.p_id,b.name,b.img from face_person a,user_info b where a.face_id = %d AND a.p_id = b.pid " ,per->f_id );
|
| | | std::cout<<"==========start============"<<std::endl;
|
| | | std::cout<<"per->f_id="<<per->f_id<<std::endl;
|
| | | std::cout<<sql<<std::endl;
|
| | | std::cout<<"==========end=============="<<std::endl;
|
| | | mysql_query(&myCont, "SET NAMES utf8"); //设置编码格式
|
| | | res = mysql_query(&myCont,sql);//查询
|
| | | if (!res)
|
| | | {
|
| | | result = mysql_store_result(&myCont);
|
| | | if (result)
|
| | | if (result != NULL)
|
| | | {
|
| | | while (sql_row = mysql_fetch_row(result))
|
| | | {
|
| | | //获取具体的数据
|
| | | per->p_id = atoi( sql_row[0]);
|
| | | per->name = sql_row[1];
|
| | |
|
| | | std::cout<<"per->p_id="<<per->p_id<<std::endl;
|
| | | std::cout<<"per->name="<<per->name<<std::endl;
|
| | | std::cout<<"per->f_id="<<per->f_id<<std::endl;
|
| | | }
|
| | | }
|
| | | }else
|
| | | std::cout<<"result is null?"<<std::endl;
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | } else {
|
| | | fprintf(stderr, "cv_verify_search_face failed, error code %d\n", cv_result);
|
| | | }
|
| | | std::cout<<"this is hits"<<std::endl;
|
| | | if (top_scores[0] != 0) {
|
| | | indx=top_idxs[0];
|
| | | std::cout<<"indx="<<indx<<std::endl;
|
| | | }
|
| | | if (top_idxs) {
|
| | | delete[]top_idxs;
|
| | |
| | | delete[]top_scores;
|
| | | }
|
| | | cv_verify_release_feature(p_feature);
|
| | | std::cout<<"return indx"<<std::endl;
|
| | | return indx;
|
| | | }
|
| | |
|
| | |
| | | char *image_list = "../test_image/imglist";
|
| | |
|
| | |
|
| | | person p={0,"axsdcc"};
|
| | | person *p={0,"axsdcc"};
|
| | |
|
| | | cv::Mat bgr_image = cv::imread(image_path);
|
| | | if(bgr_image.data != NULL) {
|
| | |
| | | int idx = -11;
|
| | | tools tool=tools();
|
| | | //idx=tool.reg(bgr_image,&p);
|
| | | tool.search(bgr_image,&p);
|
| | | tool.search(bgr_image,p);
|
| | | cout<<"============================================"<<endl;
|
| | | cout<<"p_id="<<p.p_id<<endl;
|
| | | cout<<"name="<<p.name<<endl;
|
| | | cout<<"f_id="<<p.f_id<<endl;
|
| | |
| | | |
| | | int tools::search(cv::Mat image,person *p) |
| | | { |
| | | p={}; |
| | | p->f_id = f_api.do_reasch(image); |
| | | if(p->f_id < 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) |
| | | { |
| | | if(do_search(p) == 0) |
| | | { |
| | |
| | | { |
| | | p={}; |
| | | p->f_id = f_api.do_reasch(s_feature); |
| | | if(p->f_id < 0) |
| | | if(p->f_id > 0) |
| | | { |
| | | if(do_search(p) == 0) |
| | | { |
| | |
| | | { |
| | | p={}; |
| | | p->f_id = f_api.do_register(image); |
| | | if(p->f_id < 0) |
| | | if(p->f_id > 0) |
| | | { |
| | | if(dbu.db_register(p)) |
| | | { |