| | |
| | | using namespace std; |
| | | using namespace cv; |
| | | void* handle; |
| | | bool do_frame(Mat frame, TImage *img, void *sr, void* handle, int cam_id) |
| | | { |
| | | if(!frame.empty()) |
| | | { |
| | | img->width = frame.cols; |
| | | img->height = frame.rows; |
| | | img->channel = frame.channels(); |
| | | img->data = frame.data; |
| | | const char * img_time = fa_getSysTime(); |
| | | const char* mode = "video"; |
| | | // printf("===%s\n",img_time); |
| | | std::cout<< "===%s:" << img_time << std::endl; |
| | | |
| | | sr = get_result2(handle, img, cam_id, img_time, mode); |
| | | TResult * t_result = (TResult*) sr; |
| | | cout << "=======t_result->count==" << t_result->count << endl; |
| | | for (int i=0; i<t_result->count; i++) |
| | | { |
| | | cout << "====1111111111===confidence:" << t_result->targets[i].confidence << endl; |
| | | cout << "====1111111111===attri:" << t_result->targets[i].attribute << endl; |
| | | } |
| | | |
| | | return true; |
| | | }else{ |
| | | cout << "-----------------------over--" << endl; |
| | | release(handle); |
| | | release_result(sr); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | int main(int argc, char *argv[]) |
| | | { |
| | |
| | | cap >> frame; |
| | | if(!frame.empty()) |
| | | { |
| | | img->width = frame.cols; |
| | | img->height = frame.rows; |
| | | img->channel = frame.channels(); |
| | | img->data = frame.data; |
| | | sr = get_result(handle, img, 0); |
| | | TResult * t_result = (TResult*) sr; |
| | | cout << "t_result->count==" << t_result->count << endl; |
| | | for (int i=0; i<t_result->count; i++) |
| | | { |
| | | cout << "confidence:" << t_result->targets[i].confidence << endl; |
| | | // draw_SDK_result(frame, t_result->targets[i]); |
| | | } |
| | | // std::clock_t t_strat2 = std::clock(); |
| | | if(!do_frame(frame, img, sr, handle, i)) |
| | | return 0; |
| | | cout << "-------------" << endl; |
| | | }else{ |
| | | cout << "------------over--" << endl; |
| | | release(handle); |