| | |
| | | //cout << current_time << endl; |
| | | // 如果录制时间超过 10 秒,则停止录制 |
| | | if (seconds >= _recordtime) { |
| | | cout << "已录制 10 秒视频,停止录制" << endl; |
| | | std::cout << "已录制 10 秒视频,停止录制" << endl; |
| | | video_writer.release(); |
| | | } |
| | | else |
| | |
| | | if (mysql_query(mysql, query.c_str())) |
| | | { |
| | | string err_string = mysql_error(mysql); |
| | | cout << err_string << endl; |
| | | std::cout << err_string << endl; |
| | | } |
| | | } |
| | | } |
| | |
| | | if (mysql_query(mysql, query.c_str())) |
| | | { |
| | | string err_string = mysql_error(mysql); |
| | | cout << err_string << endl; |
| | | std::cout << err_string << endl; |
| | | } |
| | | } |
| | | } |
| | |
| | | return true; |
| | | } |
| | | |
| | | //json转换字符串 |
| | | std::string jsontostr(Json::Value& json) |
| | | { |
| | | string return_str; |
| | |
| | | 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) |
| | | { |
| | |
| | | { |
| | | beltarea.push_back(cv::Point(croodx, croody)); |
| | | } |
| | | if (point_type=="workarea") |
| | | { |
| | | workarea.push_back(cv::Point(croodx, croody)); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | wfBelt.setCameraName(ipcname); |
| | | wfBelt.setRtspUrl(ipcrtsppath); |
| | | wfBelt.setAnalyse(modelType); |
| | | //wfBelt.setAnalyseResult(modelAnalysis); |
| | | wfBelt.setAnalyseResult(modelAnalysis); |
| | | } |
| | | if(modelCode=="2") //提升机运行检测模型 |
| | | { |
| | |
| | | } |
| | | if(modelCode=="6") //堆煤检测模型 |
| | | { |
| | | if (!dm.initConfig(modelPath.c_str(), arr)) { |
| | | if (!dm.initConfig(modelPath.c_str(), arr)) |
| | | { |
| | | printf("堆煤模型初始化失败\n"); |
| | | } |
| | | else |
| | |
| | | wfFire.setRtspUrl(ipcrtsppath); |
| | | wfFire.setAnalyse(modelType); |
| | | wfFire.setAnalyseResult(modelAnalysis); |
| | | } |
| | | if (modelCode == "12")//人员跌倒 |
| | | { |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | /// @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; |
| | |
| | | "-f", "rawvideo", |
| | | "-vcodec", "rawvideo", |
| | | "-pix_fmt", "bgr24", |
| | | "-s", "1280x720", |
| | | "-s", video_size, |
| | | "-r", fps, |
| | | "-i", "-", |
| | | "-pix_fmt", "yuv420p", |