| | |
| | | faceSearchRpcClient(appPref.getStringData("faceSear.proxy"), appPref.getStringData("faceSear.ip"), |
| | | appPref.getIntData("faceSear.port"), "tcp"), |
| | | // faceSearchRpcClient("faceCmServer", "", 10004, "tcp") |
| | | m_sdkRule(rule) |
| | | { |
| | | m_sdkRule(rule), |
| | | m_rpcClient("RtspAnalysServer", "127.0.0.1", appPref.getIntData("RpcServerPort"), "tcp") { |
| | | sharedMemory = new QSharedMemory(QString(shareMemoryName.c_str())); |
| | | if (!sharedMemory->create(4608 * 2592 * 4)) { |
| | | sharedMemory->attach(); |
| | | } |
| | | } |
| | | |
| | | FaceExtractElement::FaceExtractElement(std::string shareMemoryName, const SdkRule &rule, |
| | | SaveVideoRpcClient_t &rpcClient):FaceExtractElement(shareMemoryName,rule) |
| | | { |
| | | m_rpcClient=rpcClient; |
| | | } |
| | | FaceExtractElement::~FaceExtractElement() { |
| | | if (sharedMemory) { |
| | | delete sharedMemory; |
| | |
| | | } |
| | | |
| | | void FaceExtractElement::timerFunc() { |
| | | INFO("MYH Run Here"); |
| | | std::vector<FaceToExtract> faceExtractQueueTmp; |
| | | { |
| | | std::lock_guard<std::mutex> lg(imageQueueMutex); |
| | | if (faceExtractQueue.empty())return; |
| | | if (faceExtractQueue.empty()) { |
| | | ERR("faceExtractQueue.empty "); |
| | | return; |
| | | } |
| | | faceExtractQueueTmp.swap(faceExtractQueue); |
| | | faceExtractQueue.clear(); |
| | | } |
| | |
| | | // cv::imwrite(string1, image); |
| | | // } |
| | | if (feature.empty()) { |
| | | ERR("feature is empty"); |
| | | INFO("No Face Find: " << getProperty("imgKey")); |
| | | continue; |
| | | } |
| | | features.clear(); |
| | |
| | | CvUtil::cvMat2Buffer(faceExtractQueueTmp[i].faceImages[j], buffer); |
| | | std::string strImgUrlTmp = ""; |
| | | fdfsClient->fastFds->uploadFile(buffer, strImgUrlTmp, "jpg"); |
| | | // strImgUrl.append(fdfsClient->fastFds->getIp() + "/" + strImgUrlTmp); |
| | | DBG("strImgUrlTmp="<<strImgUrlTmp); |
| | | // strImgUrl.append(fdfsClient->fastFds->getIp() + "/" + strImgUrlTmp); |
| | | DBG("strImgUrlTmp=" << strImgUrlTmp); |
| | | strImgUrl.clear(); |
| | | strImgUrl = strImgUrlTmp; |
| | | // strImgUrl.append("/").append(strImgUrlTmp); |
| | | fdfsClient->rwLock.unlock(); |
| | | } else { |
| | | strImgUrl = ""; |
| | | ERR("fdfsClient is nullptr ???"); |
| | | } |
| | | |
| | | //拼接json |
| | |
| | | |
| | | t_json["personPicUrl"] = "";//人员图片 store |
| | | t_json["picAddress"] = getProperty("str_addr");//抓拍地址 |
| | | DBG("picAddress="<< t_json["picAddress"] ); |
| | | DBG("picAddress=" << t_json["picAddress"]); |
| | | t_json["picMaxUrl"] = "";//大图路径 |
| | | t_json["picLocalUrl"] = "";//本地路径 |
| | | t_json["picSmUrl"] = strImgUrl;//人员抓小图 |
| | |
| | | |
| | | t_json["content"] = ""; |
| | | //t_json["viType"] = "2";//只有4种类型 1:personface 2:personbody 3:car 4:bicycle 5:none 未知类型 |
| | | t_json["sdkType"] = std::to_string(m_sdkRule.nSdkType);//只有4种类型 1:personface 2:personbody 3:car 4:bicycle 5:none 未知类型 |
| | | t_json["sdkType"] = std::to_string( |
| | | m_sdkRule.nSdkType);//只有4种类型 1:personface 2:personbody 3:car 4:bicycle 5:none 未知类型 |
| | | t_json["personIsHub"] = "4";//1: 报警 2: 可疑 3: 安全 4: 未知 |
| | | |
| | | |
| | |
| | | t_json["indevicename"] = appPref.getStringData("fxDevNAME"); |
| | | |
| | | std::string strImageKey = faceExtractQueueTmp[i].scoredRects[j].properties["imgKey"]; |
| | | INFO("SaveImageKey To ES: "<<strImageKey); |
| | | INFO("SaveImageKey To ES: " << strImageKey); |
| | | t_json["imgKey"] = strImageKey; |
| | | |
| | | try { |
| | | auto server = m_rpcClient.getServer(); |
| | | if (!server) |
| | | { |
| | | if (!server) { |
| | | ERR("server is null"); |
| | | return; |
| | | //return; |
| | | } |
| | | INFO("Record Video "<<strImageKey); |
| | | INFO("Record Video " << strImageKey); |
| | | server->recordVideo(strImageKey); |
| | | } |
| | | catch (std::exception &e) |
| | | { |
| | | ERR("Record Video Err: "<<strImageKey <<" Message: "<<e.what()); |
| | | return; |
| | | } catch (std::exception &e) { |
| | | ERR("Record Video Err: " << strImageKey << " Message: " << e.what()); |
| | | //return; |
| | | } |
| | | auto faceSearchServer = faceSearchRpcClient.getServer(); |
| | | if (!faceSearchServer) { |