zhuanglj
2025-04-29 c402412da9e89c4927ac12b82ca2d8b7a4e0296b
PreProcessFn.cpp
@@ -255,7 +255,7 @@
   //cout << current_time << endl;
   // 如果录制时间超过 10 秒,则停止录制
   if (seconds >= _recordtime) {
      cout << "已录制 10 秒视频,停止录制" << endl;
      std::cout << "已录制 10 秒视频,停止录制" << endl;
      video_writer.release();
   }
   else
@@ -284,7 +284,7 @@
      if (mysql_query(mysql, query.c_str()))
      {
         string err_string = mysql_error(mysql);
         cout << err_string << endl;
         std::cout << err_string << endl;
      }      
   }
}
@@ -321,7 +321,7 @@
      if (mysql_query(mysql, query.c_str()))
      {
         string err_string = mysql_error(mysql);
         cout << err_string << endl;
         std::cout << err_string << endl;
      }
   }
}
@@ -524,6 +524,7 @@
   return true;
}
//json转换字符串
std::string jsontostr(Json::Value& json)
{
   string return_str;
@@ -758,8 +759,6 @@
      std::string modelAnalysis ="";
      color_result = modelNode["color_result"].asString();//颜色反正值
      // std::string area = modelNode["threshold"].asString();//区域一
      // std::string area2 = modelNode.get("area2", "").asString();//区域二
      Json::Value rects = modelNode["point_rects"];////模型分析类型编码  
      for (auto k = 0; k < rects.size(); ++k) 
         {
@@ -795,11 +794,6 @@
               {
                  beltarea.push_back(cv::Point(croodx, croody));
               }
               if (point_type=="workarea")
               {
                  workarea.push_back(cv::Point(croodx, croody));
               }
            }   
         }
@@ -823,7 +817,7 @@
            wfBelt.setCameraName(ipcname);
            wfBelt.setRtspUrl(ipcrtsppath);
            wfBelt.setAnalyse(modelType);
            //wfBelt.setAnalyseResult(modelAnalysis);
         wfBelt.setAnalyseResult(modelAnalysis);
      }
      if(modelCode=="2") //提升机运行检测模型
      {
@@ -906,7 +900,8 @@
      }
      if(modelCode=="6") //堆煤检测模型
      {
         if (!dm.initConfig(modelPath.c_str(), arr)) {
         if (!dm.initConfig(modelPath.c_str(), arr))
         {
               printf("堆煤模型初始化失败\n");
            }
            else
@@ -1038,10 +1033,6 @@
         wfFire.setRtspUrl(ipcrtsppath);
         wfFire.setAnalyse(modelType);
         wfFire.setAnalyseResult(modelAnalysis);
      }
      if (modelCode == "12")//人员跌倒
      {
      }
   }   
@@ -2029,7 +2020,7 @@
/// @brief 推流到流媒体服务器
/// @param queJC2 处理完的视频流帧队列
/// @param ipccode 摄像机编号
void PreProcessFn::fnPushVideoToUrl(queue<Mat>& queJC2,string toRtsp, string fps, string ipccode)
void PreProcessFn::fnPushVideoToUrl(queue<Mat>& queJC2,string toRtsp, string fps, string video_size,string ipccode)
{   
   //定义接受帧
   Mat frame;
@@ -2042,7 +2033,7 @@
      "-f", "rawvideo",
      "-vcodec", "rawvideo",
      "-pix_fmt", "bgr24",
      "-s",  "1280x720",
      "-s",  video_size,
      "-r", fps,         
      "-i", "-",   
      "-pix_fmt", "yuv420p",