// // Created by Scheaven on 2019/11/18. // #include "src/h_interface.h" #include "src/std_target.h" #include // C++ #include "src/utils/draw_util.h" 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; icount; 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[]) { // //视频流信息 VideoCapture cap; VideoCapture cap2; int cam_id = 0; int cam_id2 = 1; Mat frame, blob; Mat frame2, blob2; const char *conf = "../config.json"; int *max_chan; int x = 5; max_chan=&x; handle = create(conf, max_chan); void *sr; void *sr2; TImage *img = new TImage(); TImage *img2 = new TImage(); int i = 0; cap = VideoCapture("/data/disk2/01_dataset/03_human/34983128.mp4"); while(1){ /* code */ cap >> frame; if(!frame.empty()) { // 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); release_result(sr); break; } } return 0; }