派生自 development/c++

zhangjixing
2019-01-24 f676f7af18163b4532b6b982bbe1dc57b32e96dd
QiaoJiaSystem/StructureApp/JudgmentRetrogradeTool.cpp
@@ -12,7 +12,9 @@
JudgmentRetrogradeTool::JudgmentRetrogradeTool(const SdkRule &rule) :
    m_triggerElement(0, 0),
    m_sdkRule(rule),
    pManagerEsDB(nullptr)
    pManagerEsDB(nullptr),
    pointArray(nullptr),
    npts(0)
{
    pManagerEsDB = new EsDBTool(appPref.getStringData("ipAdd"), appPref.getIntData("ipPort"));
}
@@ -22,6 +24,12 @@
        delete pManagerEsDB;
        pManagerEsDB = nullptr;
    }
    if(pointArray)
    {
        delete pointArray;
        pointArray=nullptr;
    }
}
bool JudgmentRetrogradeTool::init(QString area, QString line) {
@@ -31,12 +39,15 @@
    if (arrayAreas.isEmpty()) {
        return false;
    }
    int size=arrayAreas.size();
    QVector<QPoint> vec;
    for (int i = 0; i < arrayAreas.size(); ++i) {
    pointArray=new cv::Point2i[size];
    for (int i = 0; i < size; ++i) {
        QJsonValue jsonValue = arrayAreas[i];
        QJsonObject obj = jsonValue.toObject();
        int x = obj.value("x").toDouble() * 4;
        int y = obj.value("y").toDouble() * 4;
        pointArray[i]={x,y};
        vec.push_back(QPoint(x, y));
    }
@@ -146,12 +157,23 @@
        if (getPerRet(scoredRect.id))//judgment.bool
        {
            DBG("scoredRect.id" << scoredRect.id << " val=" << m_mapPerRet[scoredRect.id]);
            m_mapPerRet[scoredRect.id] -=2400;
            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(
//                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);
            if(pointArray==nullptr)  return;
            const cv::Point2i* ppt[1] = { pointArray };
            int npt[]={npts};
            cv::polylines(image, ppt,npt, 1, true,cv::Scalar(255,255,0));
            cv::arrowedLine(image,m_UpBaseLine.start_Point,m_UpBaseLine.end_Point,cv::Scalar(0,0,255));
            cv::rectangle(image, scoredRect.rect,  cv::Scalar(0, 0, 255), 2);
            std::string imgUrl = uploadImgToFdfs(image);
            saveInfoToEs(imgUrl, scoredRect);
            state=true;
@@ -243,30 +265,30 @@
    t_json["sdkType"] = to_string(m_sdkRule.nSdkType);
//        t_json["Gender"] = obj.score;
    t_json["picName"] = "wait todo";// 抓拍照片名称
    t_json["content"] = "wait todo";// 内容描述
    t_json["picName"] = "";// 抓拍照片名称
    t_json["content"] = "";// 内容描述
    t_json["personPicUrl"] = "";// 人员 地库图片
    t_json["ChannlId"] = getProperty("ch_id"); // 通道id
    t_json["likeDate"] = AppUtil::getTimeSecString(); // 比对时间
    t_json["picAddress"] = m_sdkRule.strAddr.toStdString();// 抓拍地址
    DBG("picAddress="<<m_sdkRule.strAddr.toStdString());
    t_json["picMaxUrl"] = "wait todo"; // 大图路径
    t_json["picMaxUrl"] = ""; // 大图路径
    //   t_json["Age"] ="wait todo";
    //   t_json["Age"] ="";
    t_json["picDate"] = obj.properties["time"]; // 抓拍时间,必须有
    t_json["picLocalUrl"] = "wait todo";  // 本地路径
    t_json["picLocalUrl"] = "";  // 本地路径
    t_json["isDelete"] = "1";//默认1 ,0无效 1有效
    t_json["likePer"] = obj.score; // 相似值
    t_json["likePer"] = 1.0; // 相似值
    t_json["BaseName"] = "wait todo";// 地库名称
    t_json["BaseName"] = "";// 地库名称
    t_json["videoNum"] = m_sdkRule.strCamId.toStdString();//Video设备编号
    t_json["picSmUrl"] = imgUrl; // 抓拍图片
    t_json["indeviceid"] = appPref.getStringData("fxDevID");;// 设备id
    t_json["idcard"] = "wait todo";
    t_json["personId"] = "wait todo";
    t_json["idcard"] = "";
    t_json["personId"] = "";
    t_json["indevicename"] = appPref.getStringData("fxDevNAME");// 设备名称
    t_json["FaceFeature"] = "base64";
    t_json["personIsHub"] = m_triggerElement.getTriggerState() ? "1" : "4"; //1: 报警  2: 可疑  3: 安全  4: 未知