1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
| //
| // Created by Scheaven on 2020/4/23.
| //
|
| #include "draw_util.h"
| #include "log_util.h"
| #ifdef OPENCV
| #include <opencv2/opencv.hpp> // 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/base_sresult.avi", cv::VideoWriter::fourcc('M','J','P','G'), 24, cv::Size(800,500), true);
| #else
| cv::VideoWriter writer("./base_sresult.avi", cv::VideoWriter::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(10000000);
| }
|
|