admin
2025-04-14 c9de25e292060cab6d7c817027b42d8b6b7d2ad0
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#pragma once
#include <iostream>
#include <opencv2/opencv.hpp>
#include <ctime>
#include <thread>
#include <stdio.h>
#include "deploy/yolov5.hpp"//目标识别
#include "deploy/run.h"
#include "deploy/belt.hpp"
#include <assert.h>
#include <fstream>
#include <string>
#include <json/json.h>
#include <locale>
#include <codecvt>
 
using namespace cv;
using namespace std;
using namespace Json;
 
struct MatData {
    cv::Mat iMat;    // Mat 对象
    string codec;
    bool flag;        // 是否处理标志位
};
 
class PreProcessFn
{
 
public:
    PreProcessFn();//构造函数
 
    ~PreProcessFn(void);//析构函数
 
    string warningFilePath = "/home/zzj/video";//报警录像保存位置
    string coalCode = "123456789";//煤矿编号
    string redispath = "127.0.0.1";//redis链接
    string redisport = "6379";//redis端口
    string redispass = "";//redis密码
 
    string mysqlpath = "127.0.0.1";//mysql链接
    string mysqlport = "3306";//mysql端口
    string mysqluser = "root";//mysql账号    
    string mysqlpass = "!zkyc13579";//mysql密码
    string mysqldatabase = "db";//mysql连接的数据库
 
    string rabbitpath = "";//rabblitMQ地址
    string rabbitport = "";//rabblitMQ端口
    string rabbituser = "";//rabblitMQ用户名
    string rabbitpass = "";//rabblitMQ密码
 
    bool asyncStop = false;
 
    long deley = 50;//取帧延迟    
    int recordtime = 20;//报警录制时长
    int RecIntervalime = 100;//录像间隔时间
 
    /// @brief 视频流拉取处理
    /// @param _rtspUrl 视频流源地址
    /// @param queJC 未处理的视频流帧队列
    void fnGetVideoMatToQueue(string _rtspUrl, queue<Mat>& queJC);
 
    /// @brief 视频帧处理函数
    /// @param ipcsNode 摄像机节点
    /// @param modelArray 模型列表
    /// @param queJC 未处理的视频流帧队列
    /// @param queJC2 处理完的视频流帧队列
    void fnImRecognitionPro(const Json::Value& ipcsNode,Json::Value modelArray, queue<Mat>& queJC, queue<Mat>& queJC2);
 
    /// @brief 推流到rabbitmq
    /// @param queJC2 处理完的视频流帧队列
    /// @param ipccode 摄像机编号
    void fnPushVideoInRabbitMQ(queue<Mat>& queJC2, string ipccode);
 
    void fnPushVideo(queue<Mat>& queJC2, string ipccode);
 
};