// // Created by Scheaven on 2020/4/23. // #include "draw_util.h" #include "log_util.h" #ifdef OPENCV #include // C++ #pragma comment(lib, "opencv_core249.lib") #pragma comment(lib, "opencv_imgproc249.lib") #pragma comment(lib, "opencv_highgui249.lib") #endif // OPENCV using namespace cv; //int myFourCC = VideoWriter::fourcc('m','p','4','v'); //cv::VideoWriter writer; //#ifdef S_DEBUG // draw_frame(cam_name, frame); //原始画面保留 //#endif #ifdef S_SERVER cv::VideoWriter writer("/data3/Scheaven/yolo_sresult.avi", CV_FOURCC('M','J','P','G'), 24, cv::Size(800,500), true); #else cv::VideoWriter writer("./yolo_sresult.avi", CV_FOURCC('M','J','P','G'), 24, cv::Size(800,500), true); #endif void draw_SDK_result(const int cam_id, cv::Mat mat_img, TResult& t_result) { cv::Rect tmp_rect; for (int i = 0; i < t_result.count; ++i) { auto &result = t_result.targets[i]; tmp_rect = cv::Rect(result.rect.left,result.rect.top,result.rect.right-result.rect.left,result.rect.bottom-result.rect.top); cv::rectangle(mat_img, tmp_rect , cv::Scalar(50, 200, 50), 2); // cv::putText(mat_img, std::to_string(result.id), Point((result.rect.left+result.rect.right)/2,result.rect.top+150), CV_FONT_HERSHEY_SIMPLEX, 0.8, Scalar(255,255,0), 2); } // delete tmp_rect; cv::resize(mat_img, mat_img, cv::Size(800,500)); // cv::imwrite("1111.jpg", mat_img); // cv::imshow("RESULT", mat_img); writer<< mat_img; // cv::waitKey(1); }