Merge remote-tracking branch 'origin/ywv1.2' into ywv1.2
| | |
| | | add_subdirectory(RapidStructureApp) |
| | | add_subdirectory(RecordVideo) |
| | | add_subdirectory(DataManagerServer) |
| | | add_subdirectory(EncodeServer) |
| | | |
| | | |
| | | #add_subdirectory(FaceSearchDbWithImg) |
| | |
| | | std::string out = value.size() > 0 ? value.toStyledString() : "[]"; |
| | | return out; |
| | | } |
| | | |
| | | #define ADD_CAMERA 0 |
| | | #define EDIT_CAMERA 1 |
| | | //ç¼è¾æåæº |
| | | std::string devHttpServer_c::cam_edit(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | DBG("ip:" << ip << "; port:" << port); |
| | |
| | | Record_Cam_Dev rec; |
| | | Record_Cam_Sdk rec_sdk_old; |
| | | Record_Cam_Sdk rec_sdk; |
| | | |
| | | int type=-1; |
| | | int dev_type = db_c.searchDevTypeFromConfigTable(); |
| | | if (DEV_STORAGE == dev_type) { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | if (reader.parse(content, value)) { |
| | | |
| | | unsigned char serialnumber[SERIALNO_LEN] = {0}; |
| | | ret = getDevSerialNumber(value["str_ip"].asCString(), value["n_port"].asInt(), |
| | | value["str_username"].asCString(), \ |
| | |
| | | rec.str_username = QString::fromStdString(value["str_username"].asString()); |
| | | rec.str_password = QString::fromStdString(value["str_password"].asString()); |
| | | rec.str_brand = QString::fromStdString(value["str_brand"].asString()); |
| | | |
| | | type=value["n_type"].asInt(); |
| | | // rec_sdk_old = db_c.searchCamSdkTableByCamId(rec.str_cam_dev_id); |
| | | |
| | | // rec_sdk.str_cam_dev_id = rec.str_cam_dev_id; |
| | | // rec_sdk.str_sdks = QString::fromStdString(value["str_sdks"].asString()); |
| | | // rec_sdk.str_det_thr = QString::fromStdString(value["str_det_thr"].asString()); |
| | | // rec_sdk.str_cmp_thr = QString::fromStdString(value["str_cmp_thr"].asString()); |
| | | |
| | | ret = db_c.updateCamAndSdkTable(rec, rec_sdk); |
| | | if (!ret) { |
| | | return "err_db_content"; |
| | | bool is_exist=db_c.searchCamDevByCamId(rec.str_cam_dev_id); |
| | | if(ADD_CAMERA == type ) |
| | | { |
| | | if(is_exist) |
| | | { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | else |
| | | { |
| | | ret =db_c.insertCamDevTable(rec); |
| | | if (!ret) { |
| | | return "err_db_content"; |
| | | } |
| | | } |
| | | } |
| | | else if(EDIT_CAMERA == type ) |
| | | { |
| | | if(is_exist) |
| | | { |
| | | ret = db_c.updateCamDevTable(rec); |
| | | if (!ret) { |
| | | return "err_db_content"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return "{\"ret_status\": \"å
容æè¯¯ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | | |
| | | |
| | | } else { |
| | | return "{\"ret_status\": \"ä¼ è¾é误ï¼è¯·æ£æ¥ï¼\"}"; |
| | | } |
| | |
| | | //"str_sdks": "1,2,4", |
| | | //"str_det_thr": "90,80,95", |
| | | //"str_cmp_thr": "80,85,90", |
| | | "str_reserved": "" |
| | | "str_reserved": "",//å¯ä¼ å¯ä¸ä¼ |
| | | "n_type" : 0 //0æ·»å 1ç¼è¾ |
| | | } |
| | | è¿åï¼ |
| | | { |
New file |
| | |
| | | #cmake_minimum_required(VERSION 2.8) |
| | | |
| | | #project(VideoAnalysFromHC) |
| | | #add_executable(${PROJECT_NAME} "main.cpp") |
| | | cmake_minimum_required(VERSION 3.5) |
| | | project(EncodeServer) |
| | | set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../build) |
| | | set(CMAKE_CXX_STANDARD 11) |
| | | set(CMAKE_BUILD_TYPE debug) |
| | | add_compile_options(-fPIC) |
| | | add_definitions(-DGLOG) |
| | | add_definitions(-DDEBUG_ERR -DDEBUG_INFO -fpermissive) |
| | | |
| | | SET(LIBS |
| | | glog |
| | | #Ice |
| | | |
| | | crypto |
| | | |
| | | |
| | | #ffmpeg |
| | | avformat |
| | | avcodec |
| | | swresample |
| | | swscale |
| | | avutil |
| | | bz2 dl z |
| | | |
| | | #QT5 |
| | | Qt5Core |
| | | Qt5Sql |
| | | Qt5Gui |
| | | |
| | | |
| | | cuda jsoncpp |
| | | # cudart |
| | | # cublas |
| | | opencv_world |
| | | jsoncpp |
| | | pthread |
| | | hiredis |
| | | ) |
| | | include_directories( |
| | | |
| | | #glog |
| | | ../../../BasicPlatForm/libs/glog/include |
| | | ./ |
| | | ../VideoServer |
| | | |
| | | ../VideoServer/QiaoJia/DB |
| | | ../VideoServer/QiaoJia/dispatchTool |
| | | ../StructureApp/ |
| | | |
| | | ../../../BasicPlatForm/ |
| | | |
| | | ../../../BasicPlatForm/basic/pipe/ |
| | | |
| | | |
| | | |
| | | ../../../BasicPlatForm/libs/opencv/include |
| | | |
| | | ../../../BasicPlatForm/libs/ffmpeg/include |
| | | ../../../BasicPlatForm/libs/jsoncpp/include |
| | | |
| | | |
| | | |
| | | /usr/include/x86_64-linux-gnu/qt5 |
| | | /usr/include/x86_64-linux-gnu/qt5/QtCore/ |
| | | /usr/include/x86_64-linux-gnu/qt5/QtSql/ |
| | | |
| | | ../../BasicPlatForm/libs/hiredis-master/include |
| | | ) |
| | | |
| | | link_directories( |
| | | #glog |
| | | ../../../BasicPlatForm/libs/glog/lib |
| | | ../../../BasicPlatForm/libs/openssl/lib |
| | | ../../../BasicPlatForm/libs/opencv/lib |
| | | ../../../BasicPlatForm/libs/ffmpeg/lib |
| | | # ../../../BasicPlatForm/libs/jsoncpp/lib |
| | | |
| | | # ../../../BasicPlatForm/libs/libuuid/lib |
| | | |
| | | |
| | | ../../BasicPlatForm/libs/hiredis-master/lib |
| | | ) |
| | | |
| | | add_executable(${PROJECT_NAME} |
| | | ../../../BasicPlatForm/basic/pipe_element/ffmpeg/VideoChangeScore.cpp |
| | | ../../../BasicPlatForm/basic/pipe_element/ffmpeg/FfmpegElement.cpp |
| | | ../StructureApp/NewRecordVideoElement.cpp |
| | | EncodeVideoManager.cpp |
| | | EncodeVideo.cpp |
| | | ../StructureApp/HiredisTool.cpp |
| | | main.cpp |
| | | ) |
| | | target_link_libraries(${PROJECT_NAME} |
| | | ${LIBS} |
| | | ) |
New file |
| | |
| | | #include "EncodeVideo.h" |
| | | |
| | | EncodeVideo::EncodeVideo(): |
| | | videoEncoderElement(cv::Size(1920, 1080), 8, 0) |
| | | { |
| | | |
| | | } |
| | | EncodeVideo::~EncodeVideo() |
| | | { |
| | | |
| | | } |
| | | |
| | | void EncodeVideo::threadFunc() |
| | | { |
| | | |
| | | |
| | | std::string src_path=getProperty("src_path"); |
| | | if(src_path.empty()) |
| | | { |
| | | DBG("src_path.empty()"); |
| | | return ; |
| | | } |
| | | int size=m_hiredisTool.getSize(src_path); |
| | | |
| | | bool fileCreate = false; |
| | | for(int i=0;i<size;++i) |
| | | { |
| | | |
| | | cv::Mat img; |
| | | m_hiredisTool.getImage(src_path,img); |
| | | if(img.empty()){ |
| | | DBG("img.empty()"); |
| | | continue; |
| | | } |
| | | |
| | | if(!fileCreate) |
| | | { |
| | | fileCreate = true; |
| | | DBG("fileCreate buf_size="<<size<<" file_name="<<src_path); |
| | | videoEncoderElement.threadInitial(getProperty("src_path"),img); |
| | | |
| | | } |
| | | else |
| | | { |
| | | |
| | | videoEncoderElement.doFunc(img); |
| | | } |
| | | usleep(2*1000); |
| | | } |
| | | |
| | | videoEncoderElement.threadClosing(); |
| | | m_hiredisTool.delKey(src_path); |
| | | m_hiredisTool.hashDel(file_list,src_path); |
| | | } |
New file |
| | |
| | | #ifndef ENCODEVIDEO_H |
| | | #define ENCODEVIDEO_H |
| | | #include "../StructureApp/HiredisTool.h" |
| | | #include <basic/pipe/PipeElement.h> |
| | | #include <basic/pipe_element/ffmpeg/FfmpegElement.h> |
| | | class EncodeVideo: public basic::PipeElement |
| | | { |
| | | public: |
| | | EncodeVideo(); |
| | | ~EncodeVideo(); |
| | | |
| | | void setImageQue(std::queue<cv::Mat>& imgQue); |
| | | |
| | | private: |
| | | virtual void threadFunc()override; |
| | | private: |
| | | |
| | | std::queue<cv::Mat> m_imgQue; |
| | | HiredisTool m_hiredisTool; |
| | | ffmpeg::VideoEncodeElement videoEncoderElement; |
| | | }; |
| | | |
| | | #endif // NEWENCODEVIDEO_H |
New file |
| | |
| | | #include "EncodeVideoManager.h" |
| | | #include "NewRecordVideoElement.h" |
| | | #include <basic/util/app/AppConfig.h> |
| | | EncodeVideoManager::EncodeVideoManager(): |
| | | TimerElement(1000) |
| | | { |
| | | // m_hiredisTool.delKey("") |
| | | int thread_num=appConfig.getIntProperty("encode_thread_num"); |
| | | |
| | | for(int i=0;i<thread_num;++i) |
| | | { |
| | | EncodeVideo* newEncodeViedo=new EncodeVideo(); |
| | | if(newEncodeViedo) |
| | | { |
| | | |
| | | m_newEncodeVideoVec.push_back(newEncodeViedo); |
| | | newEncodeViedo->start(); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | EncodeVideoManager::~EncodeVideoManager() |
| | | { |
| | | for(int i=0;i<m_newEncodeVideoVec.size();++i) |
| | | { |
| | | if(m_newEncodeVideoVec[i]) |
| | | { |
| | | m_newEncodeVideoVec[i]->stop(); |
| | | delete m_newEncodeVideoVec[i]; |
| | | } |
| | | } |
| | | |
| | | } |
| | | void EncodeVideoManager::timerFunc() |
| | | { |
| | | std::map<std::string,int> fileMap=m_hiredisTool.findAllFileStatus(); |
| | | // auto it=fileMap.begin(); |
| | | for(auto it=fileMap.begin();it!=fileMap.end();it++) |
| | | { |
| | | if(it->second == RECORD_ENDING) |
| | | { |
| | | |
| | | for(int i=0;i<m_newEncodeVideoVec.size();++i) |
| | | { |
| | | if(m_newEncodeVideoVec[i] && !m_newEncodeVideoVec[i]->isBusy()) |
| | | { |
| | | m_hiredisTool.hashSet(file_list,it->first,RECORD_STOP); |
| | | m_newEncodeVideoVec[i]->setProperty("src_path",it->first); |
| | | m_newEncodeVideoVec[i]->submit(); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | #ifndef ENCODEVIDEOMANAGER_H |
| | | #define ENCODEVIDEOMANAGER_H |
| | | #include <basic/pipe/TimerElement.h> |
| | | #include "EncodeVideo.h" |
| | | |
| | | class EncodeVideoManager: public TimerElement |
| | | { |
| | | public: |
| | | EncodeVideoManager(); |
| | | ~EncodeVideoManager(); |
| | | private: |
| | | virtual void timerFunc(); |
| | | |
| | | private: |
| | | HiredisTool m_hiredisTool; |
| | | std::vector<EncodeVideo*> m_newEncodeVideoVec; |
| | | |
| | | }; |
| | | |
| | | #endif // NEWENCODEVIDEOMANAGER_H |
New file |
| | |
| | | #include "NewEncodeVideoManager.h" |
| | | #include "NewRecordVideoElement.h" |
| | | #include <basic/util/app/AppConfig.h> |
| | | NewEncodeVideoManager::NewEncodeVideoManager(): |
| | | TimerElement(1000) |
| | | { |
| | | // m_hiredisTool.delKey("") |
| | | int thread_num=appConfig.getIntProperty("encode_thread_num"); |
| | | for(int i=0;i<thread_num;++i) |
| | | { |
| | | NewEncodeVideo* newEncodeViedo=new NewEncodeVideo; |
| | | if(newEncodeViedo) |
| | | { |
| | | m_newEncodeVideoVec.push_back(newEncodeViedo); |
| | | newEncodeViedo->start(); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | NewEncodeVideoManager::~NewEncodeVideoManager() |
| | | { |
| | | for(int i=0;i<m_newEncodeVideoVec.size();++i) |
| | | { |
| | | if(m_newEncodeVideoVec[i]) |
| | | { |
| | | m_newEncodeVideoVec[i]->stop(); |
| | | delete m_newEncodeVideoVec[i]; |
| | | } |
| | | } |
| | | |
| | | } |
| | | void NewEncodeVideoManager::timerFunc() |
| | | { |
| | | std::map<std::string,int> fileMap=m_hiredisTool.findAllFileStatus(); |
| | | // auto it=fileMap.begin(); |
| | | for(auto it=fileMap.begin();it!=fileMap.end();it++) |
| | | { |
| | | if(it->second == RECORD_ENDING) |
| | | { |
| | | |
| | | |
| | | |
| | | |
| | | for(int i=0;i<m_newEncodeVideoVec.size();++i) |
| | | { |
| | | if(m_newEncodeVideoVec[i] && !m_newEncodeVideoVec[i]->isBusy()) |
| | | { |
| | | m_hiredisTool.hashSet(file_list,it->first,RECORD_STOP); |
| | | m_newEncodeVideoVec[i]->setProperty("src_path",it->first); |
| | | m_newEncodeVideoVec[i]->submit(); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | #ifndef NEWENCODEVIDEOMANAGER_H |
| | | #define NEWENCODEVIDEOMANAGER_H |
| | | #include <basic/pipe/TimerElement.h> |
| | | #include "NewEncodeVideo.h" |
| | | |
| | | class NewEncodeVideoManager: public TimerElement |
| | | { |
| | | public: |
| | | NewEncodeVideoManager(); |
| | | ~NewEncodeVideoManager(); |
| | | private: |
| | | virtual void timerFunc(); |
| | | |
| | | private: |
| | | HiredisTool m_hiredisTool; |
| | | std::vector<NewEncodeVideo*> m_newEncodeVideoVec; |
| | | |
| | | }; |
| | | |
| | | #endif // NEWENCODEVIDEOMANAGER_H |
New file |
| | |
| | | #include <stdio.h> |
| | | #include <iostream> |
| | | #include <unistd.h> |
| | | #include <cstring> |
| | | #include <basic/debug/Debug.h> |
| | | #include "EncodeVideoManager.h" |
| | | #include <thread> |
| | | |
| | | using namespace std; |
| | | |
| | | #include <basic/util/file/FileUtil.h> |
| | | #include <basic/util/app/AppPreference.hpp> |
| | | #include <basic/util/app/AppConfig.h> |
| | | |
| | | |
| | | |
| | | |
| | | //static void startEncodeVideoManager(int i) |
| | | //{ |
| | | // EncodeVideoManager encodeVideoManager; |
| | | // encodeVideoManager.start(); |
| | | // while (1) { |
| | | // sleep(1 * 60 * 60 * 12); |
| | | // } |
| | | //} |
| | | |
| | | |
| | | int main(int argc, char **argv) { |
| | | SAVE_APP_ARGS |
| | | ENABLEGLOG(GET_STR_CONFIG("logPath").c_str()); |
| | | |
| | | EncodeVideoManager encodeVideoManager; |
| | | encodeVideoManager.start(); |
| | | |
| | | while (1) { |
| | | sleep(1000000); |
| | | } |
| | | return 0; |
| | | |
| | | } |
| | |
| | | perHubElement.getTriggerState() || |
| | | perStaticElement.getTriggerState() |
| | | ); |
| | | if (!newRecordVideoElement.isBusy()) { |
| | | newRecordVideoElement.submit(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | registerElement(imageDrawElement); |
| | | registerElement(newRecordVideoElement); |
| | | videoCaptureElement.setOutPutInterval(5); |
| | | videoCaptureElement.setOutPutInterval(3); |
| | | faceExtractElement.setProperty("index", to_string(m_index)); |
| | | registerElement(yoloRpcElement); |
| | | //#todo setProperty |
| | |
| | | CvUtil::cvMat2Buffer(faceExtractQueueTmp[i].faceImages[j], buffer); |
| | | std::string strImgUrlTmp = ""; |
| | | fdfsClient->fastFds->uploadFile(buffer, strImgUrlTmp, "jpg"); |
| | | strImgUrl.append(fdfsClient->fastFds->getIp() + "/" + strImgUrlTmp); |
| | | // strImgUrl.append(fdfsClient->fastFds->getIp() + "/" + strImgUrlTmp); |
| | | DBG("strImgUrlTmp="<<strImgUrlTmp); |
| | | strImgUrl.clear(); |
| | | strImgUrl = strImgUrlTmp; |
| | | // strImgUrl.append("/").append(strImgUrlTmp); |
| | |
| | | |
| | | t_json["personPicUrl"] = "wait todo";//人åå¾ç store |
| | | t_json["picAddress"] = getProperty("str_addr");//ææå°å |
| | | DBG("picAddress="<< t_json["picAddress"] ); |
| | | t_json["picMaxUrl"] = "wait todo";//大å¾è·¯å¾ |
| | | t_json["picLocalUrl"] = "wait todo";//æ¬å°è·¯å¾ |
| | | t_json["picSmUrl"] = strImgUrl;//人åæå°å¾ |
| | |
| | | t_json["personIsHub"] = "4";//1: æ¥è¦ 2: å¯ç 3: å®å
¨ 4: æªç¥ |
| | | |
| | | |
| | | t_json["cluster_id"] = appPref.getStringData("clusterID"); |
| | | t_json["ack_alarm"] = "0"; |
| | | |
| | | //faceExtractElement.setProperty("dev_id", str_device_id); |
| | | //faceExtractElement.setProperty("cg_id", str_ch_id); |
| | | t_json["videoNum"] = getProperty("dev_id");//Video设å¤ç¼å·//getProperty("path");//Videç¼å· å¤é® |
| | |
| | | std::string content; |
| | | cv::Mat imgTep; |
| | | |
| | | |
| | | listRpop(file_name,content); |
| | | |
| | | |
| | | Json::Reader reader; |
| | | Json::Value value; |
| | | |
| | | if(!reader.parse(content,value)) |
| | | { |
| | | return ; |
| | |
| | | std::vector<uchar> data; |
| | | |
| | | data.resize(str.size()); |
| | | |
| | | data.assign(str.begin(),str.end()); |
| | | |
| | | CvUtil::buffer2CvMat(data,imgTep); |
| | | imgTep.copyTo(img); |
| | | |
| | | imgTep.copyTo(img); |
| | | // return img; |
| | | |
| | | } |
| | |
| | | |
| | | JudgmentRetrogradeTool::JudgmentRetrogradeTool(const SdkRule &rule) : |
| | | TimerElement(1000), |
| | | m_triggerElement(0, rule.nTriggerDelay * 1000 * 1000), |
| | | m_triggerElement(rule.nTriggerDelay * 8, 0), |
| | | m_sdkRule(rule), |
| | | pManagerEsDB(nullptr) { |
| | | pManagerEsDB = new EsDBTool(appPref.getStringData("ipAdd"), appPref.getIntData("ipPort")); |
| | |
| | | m_mapPerRet[scoredRect.id] = true; |
| | | |
| | | m_triggerElement.setState(true); |
| | | auto t_image = image( |
| | | CvUtil::zoomRectEqual(scoredRect.rect, 1.2, 1.2) & cv::Rect(0, 0, image.cols, image.rows)).clone(); |
| | | // auto t_image = image(scoredRect.rect& cv::Rect(0, 0, image.cols, image.rows)).clone(); |
| | | std::string imgUrl = uploadImgToFdfs(t_image); |
| | | saveInfoToEs(imgUrl, scoredRect); |
| | | |
| | | |
| | | break; |
| | | } else { |
| | | m_triggerElement.setState(false); |
| | | |
| | | } |
| | | m_triggerElement.triggerOnce(); |
| | | if(m_triggerElement.getTriggerState()) |
| | | { |
| | | auto t_image = image( |
| | | CvUtil::zoomRectEqual(scoredRect.rect, 1.2, 1.2) & cv::Rect(0, 0, image.cols, image.rows)).clone(); |
| | | // auto t_image = image(scoredRect.rect& cv::Rect(0, 0, image.cols, image.rows)).clone(); |
| | | std::string imgUrl = uploadImgToFdfs(t_image); |
| | | saveInfoToEs(imgUrl, scoredRect); |
| | | } |
| | | } |
| | | m_triggerElement.triggerOnce(); |
| | | |
| | | } |
| | | |
| | | std::string JudgmentRetrogradeTool::uploadImgToFdfs(cv::Mat &image) { |
| | |
| | | t_json["personPicUrl"] = "";// 人å å°åºå¾ç |
| | | t_json["ChannlId"] = getProperty("ch_id"); // ééid |
| | | t_json["likeDate"] = AppUtil::getTimeSecString(); // æ¯å¯¹æ¶é´ |
| | | t_json["picAddress"] = getProperty("str_addr");// ææå°å |
| | | t_json["picAddress"] = m_sdkRule.strAddr.toStdString();// ææå°å |
| | | DBG("picAddress="<<m_sdkRule.strAddr.toStdString()); |
| | | t_json["picMaxUrl"] = "wait todo"; // 大å¾è·¯å¾ |
| | | |
| | | |
| | |
| | | t_json["personIsHub"] = m_triggerElement.getTriggerState() ? "1" : "4"; //1: æ¥è¦ 2: å¯ç 3: å®å
¨ 4: æªç¥ |
| | | t_json["videoIp"] = getProperty("local_ip");//å½åæå¡å¨IPå°å |
| | | t_json["ack_alarm"] = m_triggerElement.getTriggerState() ? "0" : ""; // que ren shi fou bao jing |
| | | t_json["cluster_id"] = "wait todo"; // ji qun id |
| | | t_json["cluster_id"] = appPref.getStringData("clusterID");; // ji qun id |
| | | |
| | | bool retface = false; |
| | | if (pManagerEsDB) |
| | |
| | | |
| | | // basicPath(); |
| | | m_cutPath= appPref.getStringData("user.loop.absolute.path"); |
| | | recordInit(60,360); |
| | | |
| | | recordInit(appPref.getIntData("n_cut_min_duration"),appPref.getIntData("n_cut_max_duration")); |
| | | } |
| | | |
| | | NewRecordVideoElement::~NewRecordVideoElement() { |
| | |
| | | getImg(info); |
| | | std::string srcPath= getFileName(info.time); |
| | | m_filename=srcPath; |
| | | DBG("m_filename: " << m_filename); |
| | | // DBG("m_filename: " << m_filename); |
| | | |
| | | m_hiredisTool.pushImageBuf(m_filename,info.img); |
| | | m_hiredisTool.addFileInfo(m_filename,RECORD_DOING); |
| | |
| | | QDateTime dt = QDateTime::fromString(QString::fromStdString(timeStamp), "yyyy-MM-dd hh:mm:ss:zzz"); |
| | | |
| | | std::string t_strTime=dt.toString("yyyyMMddhh").toStdString(); |
| | | DBG("t_strTime="<<t_strTime); |
| | | // DBG("t_strTime="<<t_strTime); |
| | | t_FilePath.append(camID + "/" + t_strTime.substr(0, 6)+ "/" +t_strTime.substr(6, 2) + "/"); |
| | | //YYYYMMDDHH |
| | | t_FilePath.append(t_strTime.substr(0,10)+ "/"); |
| | |
| | | void NewRecordVideoElement::recordInit(int videoMin, int videoMax) { |
| | | |
| | | sdkTrigger = false; |
| | | fileMin = videoMin; |
| | | fileMax = videoMax; |
| | | fileMin = videoMin*8;//fps=8 |
| | | fileMax = videoMax*8; |
| | | triggerDelay = fileMin/2; |
| | | |
| | | recordStatus = RECORD_STOP; |
| | |
| | | t_json["personPicUrl"] = "";// 人å å°åºå¾ç |
| | | t_json["ChannlId"] = getProperty("ch_id"); // ééid |
| | | t_json["likeDate"] =AppUtil::getTimeSecString(); // æ¯å¯¹æ¶é´ |
| | | t_json["picAddress"] =getProperty("str_addr");// ææå°å |
| | | t_json["picAddress"] =m_sdkRule.strAddr.toStdString();// ææå°å |
| | | t_json["picMaxUrl"] = "wait todo"; // 大å¾è·¯å¾ |
| | | |
| | | |
| | |
| | | t_json["personIsHub"] = m_triggerElement.getTriggerState()?"1":"4"; //1: æ¥è¦ 2: å¯ç 3: å®å
¨ 4: æªç¥ |
| | | t_json["videoIp"] = m_sdkRule.strAddr.toStdString(); // 设å¤ip |
| | | t_json["ack_alarm"]=m_triggerElement.getTriggerState()?"0":""; // que ren shi fou bao jing |
| | | t_json["cluster_id"]="wait todo"; // ji qun id |
| | | t_json["cluster_id"]=appPref.getStringData("clusterID");; // ji qun id |
| | | |
| | | bool retface = false; |
| | | if(pManagerEsDB) |
| | |
| | | PipeElement(true), |
| | | trackingTrigger(nullptr), |
| | | mRealNum(0), |
| | | m_triggerElement(0, rule.nTriggerDelay * 1000 * 1000), |
| | | m_triggerElement(rule.nTriggerDelay*8,0), |
| | | pManagerEsDB(nullptr), |
| | | npts(0) { |
| | | |
| | |
| | | |
| | | void PerimeterElement::threadFunc() { |
| | | |
| | | // ClockTimer ct("PerimeterElement::threadFunc"); |
| | | if (!isInWeek(m_sdkRule.weekRuleVec)) |
| | | return; |
| | | int num = 0; |
| | |
| | | |
| | | switch (m_sdkRule.nSdkType) { |
| | | case PerimeterSdk: |
| | | state = num > 0 && num != mRealNum; |
| | | state = num > 0 ; |
| | | |
| | | |
| | | break; |
| | | case CrowdSdk: |
| | | state = num > m_sdkRule.nAlarmNumLowerLimit && num != mRealNum; |
| | | state = num > m_sdkRule.nAlarmNumLowerLimit ; |
| | | |
| | | break; |
| | | case PerHubSdk: |
| | | state = num > m_sdkRule.nAlarmNumLowerLimit && num < m_sdkRule.nAlarmNumUpperLimit && num != mRealNum; |
| | | state = num > m_sdkRule.nAlarmNumLowerLimit && num < m_sdkRule.nAlarmNumUpperLimit ; |
| | | // if(m_sdkRule.nAlarmNumLowerLimit>0) |
| | | // { |
| | | // if( m_sdkRule.nAlarmNumUpperLimit>m_sdkRule.nAlarmNumLowerLimit+1) |
| | |
| | | default: |
| | | break; |
| | | } |
| | | m_triggerElement.setState(state); |
| | | |
| | | m_triggerElement.setState(state); |
| | | m_triggerElement.triggerOnce(); |
| | | // DBG("imgUrl="<<imgUrl); |
| | | if (state) { |
| | | if (m_triggerElement.getTriggerState() && num!=mRealNum) |
| | | { |
| | | auto t_image = image(CutMask()).clone(); |
| | | std::string imgUrl = uploadImgToFdfs(t_image); |
| | | saveInfoToEs(imgUrl, picDate); |
| | | DBG("num=" << num << " lastnum=" << mRealNum); |
| | | |
| | | } |
| | | //if(state) |
| | | // DBG("num=" << num <<"m_triggerElement.getTriggerState()="<<m_triggerElement.getTriggerState()); |
| | | |
| | | |
| | | m_triggerElement.triggerOnce(); |
| | | mRealNum = num; |
| | | |
| | | mRealNum = num; |
| | | |
| | | // DBG("m_sdkRule.nSdkType="<<m_sdkRule.nSdkType<<" num="<<num); |
| | | fireConnectors(); |
| | | } |
| | |
| | | CvUtil::cvMat2Buffer(image, buffer); |
| | | std::string strImgUrlTmp = ""; |
| | | fdfsClient->fastFds->uploadFile(buffer, strImgUrlTmp, "jpg"); |
| | | strImgUrl.append(fdfsClient->fastFds->getIp() + "/" + strImgUrlTmp); |
| | | // strImgUrl.append(fdfsClient->fastFds->getIp() + "/" + strImgUrlTmp); |
| | | strImgUrl.clear(); |
| | | strImgUrl = strImgUrlTmp; |
| | | // strImgUrl.append("/").append(strImgUrlTmp); |
| | |
| | | t_json["personPicUrl"] = "";// 人å å°åºå¾ç |
| | | t_json["ChannlId"] = getProperty("ch_id"); // ééid |
| | | t_json["likeDate"] = AppUtil::getTimeSecString(); // æ¯å¯¹æ¶é´ |
| | | t_json["picAddress"] = getProperty("str_addr");// ææå°å |
| | | t_json["picAddress"] = m_sdkRule.strAddr.toStdString();// ææå°å |
| | | DBG("picAddress="<<m_sdkRule.strAddr.toStdString()); |
| | | t_json["picMaxUrl"] = "wait todo"; // 大å¾è·¯å¾ |
| | | |
| | | |
| | | // t_json["Age"] ="wait todo"; |
| | | t_json["picDate"] = time; // æææ¶é´ï¼å¿
é¡»æ |
| | | // DBG("picDate="<<time); |
| | | DBG("picDate="<<time); |
| | | t_json["picLocalUrl"] = "wait todo"; // æ¬å°è·¯å¾ |
| | | t_json["isDelete"] = "1";//é»è®¤1 ,0æ æ 1ææ |
| | | |
| | |
| | | t_json["personIsHub"] = m_triggerElement.getTriggerState() ? "1" : "4"; //1: æ¥è¦ 2: å¯ç 3: å®å
¨ 4: æªç¥ |
| | | t_json["videoIp"] = m_sdkRule.strAddr.toStdString(); // 设å¤ip |
| | | t_json["ack_alarm"] = m_triggerElement.getTriggerState() ? "0" : ""; // que ren shi fou bao jing |
| | | t_json["cluster_id"] = "wait todo"; // ji qun id |
| | | t_json["cluster_id"] = appPref.getStringData("clusterID");; // ji qun id |
| | | |
| | | bool retface = false; |
| | | if (pManagerEsDB) |
| | |
| | | if (lastRect.id >= 0 && (rect.rect & lastRect.rect).area() > lastRect.rect.area() * 0.4) { |
| | | found = true; |
| | | rect.id = lastRect.id; |
| | | lastRect.properties["time"]=rect.properties["time"]; |
| | | rect.properties = lastRect.properties; |
| | | tempScoreRects.push_back(rect); |
| | | break; |
| | |
| | | |
| | | |
| | | std::vector<ScoredRect> YoloRpcElement::getLastScoreRects() const { |
| | | return triggerScoredRects; |
| | | return trackingTrigger->getLastScoreRects(); |
| | | } |
| | | |
| | | cv::Mat YoloRpcElement::getImage() const |
| | |
| | | |
| | | void YoloRpcElement::threadFunc() |
| | | { |
| | | // ClockTimer ct("YoloRpcElement::threadFunc"); |
| | | triggerScoredRects.clear(); |
| | | try { |
| | | auto server = rpcClient.getServer(); |
| | |
| | | int h = (obj.rcObj.bottom - obj.rcObj.top) * image.rows; |
| | | scoredRect.rect = cv::Rect(x, y, w, h); |
| | | scoredRect.score = scoredRect.rect.area() > 0 ? obj.prob : 0; |
| | | scoredRect.properties["time"] = getProperty("time"); |
| | | if (trackingTrigger->triggerOnce(scoredRect)) |
| | | { |
| | | trackingTrigger->getLastRect().properties["id"] = to_string(scoredRect.id); |
| | | trackingTrigger->getLastRect().properties["type"] = cocoData[obj.type]; |
| | | trackingTrigger->getLastRect().properties["time"] = getProperty("time"); |
| | | // DBG("time)"<<getProperty("time")); |
| | | triggerScoredRects.push_back(trackingTrigger->getLastRect()); |
| | | } |
| | | } |
| | | trackingTrigger->triggerLine(); |
| | | if(trackingTrigger->getLastScoreRects().size()>20) |
| | | { |
| | | DBG(""); |
| | | } |
| | | // if(trackingTrigger->getLastScoreRects().size()>20) |
| | | // { |
| | | // DBG(""); |
| | | // } |
| | | fireConnectors(); |
| | | } |
| | | |
| | |
| | | item.str_password.toStdString(), item.str_brand.toStdString()); |
| | | SdkRuleMap ruleMap = m_lDBTool->searchSdkRuleByCamId(item.str_cam_dev_id); |
| | | for (auto &rule:ruleMap) { |
| | | if (rule.second.nThreshold < 5 || rule.second.nThreshold > 95) { |
| | | rule.second.nThreshold = 75; |
| | | } |
| | | rule.second.fSensitivity = (float) (rule.second.nThreshold) / 100; |
| | | DBG("fSensitivity" << rule.second.fSensitivity); |
| | | |
| | | rule.second.strAddr = item.str_addr; |
| | | rule.second.weekRuleVec = m_lDBTool->searchCameraWeekRuleByCamId(item.str_cam_dev_id, rule.first); |
| | | |
| | | if(rule.second.nSdkType == FaceSdk) continue; |
| | | |
| | | if (rule.second.nThreshold < 5 ) |
| | | { |
| | | rule.second.fSensitivity=0.95; |
| | | } |
| | | else if(rule.second.nThreshold > 95) |
| | | { |
| | | rule.second.fSensitivity=0.05; |
| | | } |
| | | else |
| | | { |
| | | rule.second.fSensitivity = 1-(float) (rule.second.nThreshold) / 100; |
| | | } |
| | | |
| | | DBG("fSensitivity" << rule.second.fSensitivity); |
| | | } |
| | | appPref.setStringData(t_camIdex + "rtsp", rtsp_url); |
| | | // appPref.setStringData(t_camIdex+"addr", item.str_addr.toStdString()); |
| | |
| | | |
| | | static void startRtspAnalysElement(LDBTool *_dbTool) { |
| | | RtspAnalysElement rtspAnalysElement(_dbTool); |
| | | NewEncodeVideoManager newEncodeVideoManager; |
| | | newEncodeVideoManager.start(); |
| | | // NewEncodeVideoManager newEncodeVideoManager; |
| | | // newEncodeVideoManager.start(); |
| | | while (1) { |
| | | sleep(1 * 60 * 60 * 12); |
| | | } |
| | |
| | | appPref.setStringData("fxDevID", rec.dev_id.toStdString()); |
| | | appPref.setStringData("fxDevNAME", rec.dev_name.toStdString()); |
| | | appPref.setStringData("user.loop.absolute.path", appConfig.getStringProperty("cutPath")); |
| | | |
| | | appPref.setStringData("clusterID", appConfig.getStringProperty("clusterID")); |
| | | |
| | | bool loopRet = true; |
| | | while (loopRet) { |
| | |
| | | |
| | | return lst; |
| | | } |
| | | bool LDBTool::searchCamDevByCamId(QString strCamId) |
| | | { |
| | | QMutexLocker mutexLocker(&m_mutexVisit);//TODO |
| | | std::list<Record_Cam_Dev> lst; |
| | | QSqlTableModel pModel(NULL, m_db); |
| | | pModel.setTable("cam_dev"); |
| | | pModel.setFilter(QObject::tr("cam_dev_id ='%1' and cam_dev_id != '' and cam_dev_id is not null").arg(strCamId)); |
| | | pModel.setEditStrategy(QSqlTableModel::OnManualSubmit);//OnManualSubmit OnFieldChange |
| | | pModel.select(); |
| | | |
| | | int rowCount = pModel.rowCount(); |
| | | |
| | | return rowCount > 0; |
| | | } |
| | | |
| | | //chn========================== |
| | | /// |
| | |
| | | bool updateCamDevTable(Record_Cam_Dev camRec); |
| | | std::list<Record_Cam_Dev> searchCamDevTableAll(void); |
| | | int searchCamDevNumber(void); |
| | | bool searchCamDevByCamId(QString strCamId); |
| | | |
| | | //load_file_info |
| | | bool insertLoadFileTable(Record_Load_File_info loadfileRec); |
| | |
| | | |
| | | IceRpcServer<YoloDetectServerI> server("yoloServer", portNum, "tcp"); |
| | | server.setMessageSizeMax(1024 * 1024 * 50); |
| | | server.setPoolInitSize(poolNum); |
| | | server.setPoolMaxSize(poolNum); |
| | | server.setPoolInitSize(1); |
| | | server.setPoolMaxSize(1); |
| | | server.runWaitShutDown(); |
| | | return 0; |
| | | } |
old mode 100644
new mode 100755
Binary files differ
| | |
| | | { |
| | | "mainServerIp": "192.168.1.182", |
| | | "mainServerPort": "3697", |
| | | "logPath": "/home/dell/work/log/", |
| | | "logPath": "/home/basic/work/log/", |
| | | "DEV_ID": "DSVAD010120181119", |
| | | "ES_IP": "192.168.1.122", |
| | | "ES_PORT": 9200, |
| | | "FaceSeachSleepTime": 60, |
| | | "TotalLoadSize": "500", |
| | | "buildAddr": "/home/dell/Apps/QiaoJiaSystem/build/", |
| | | "cutPath": "/home/dell/work/qiaojia/cut", |
| | | "buildAddr": "/home/basic/Apps/QiaoJiaSystem/build/", |
| | | "cutPath": "/home/basic/work/qiaojia/cut", |
| | | "erlCookie": "", |
| | | "erlFatherNode": "", |
| | | "erlNode": "", |
| | | "erlPath": "", |
| | | "loadPath": "/home/dell/work/qiaojia/load", |
| | | "loadPath": "/home/basic/work/qiaojia/load", |
| | | "localPasswd": "123456", |
| | | "netIfName": "enp3s0", |
| | | "srsAddr": "rtmp://192.168.1.122:1934/live/", |
| | |
| | | "redis_ip": "127.0.0.1", |
| | | "redis_buf_len": 750, |
| | | "encode_thread_num": 3, |
| | | "FaceDetectionSampleSize": 720 |
| | | "FaceDetectionSampleSize": 720, |
| | | "clusterID" : "sssss" |
| | | } |
| | |
| | | echo $1 |
| | | des_pass=123 |
| | | expect -c " |
| | | # spawn scp -P44100 ${CUR_PATH}"/"$1 dell@58.118.225.79:/home/dell/Apps/QiaoJiaSystem/build |
| | | spawn scp ${CUR_PATH}"/"$1 basic@192.168.1.203:/home/basic/Apps/QiaoJiaSystem/build |
| | | # spawn scp -P44100 ${CUR_PATH}"/"$1 dell@58.118.225.79:/home/dell/Apps/QiaoJiaSystem/build |
| | | spawn scp ${CUR_PATH}"/"$1 basic@192.168.1.182:/home/basic/Apps/QiaoJiaSystem/build |
| | | expect \"password:\" |
| | | send \"${des_pass}\r\" |
| | | expect eof |
| | |
| | | sendFile RecordVideo |
| | | sendFile VideoAnalysFromHC |
| | | sendFile YoloServer |
| | | sendFile EncodeServer |
| | | sendFile killAll.sh |
| | | #sendFile runAll.sh |
| | | #sendFile runWebSer.sh |