派生自 development/c++

pansen
2019-03-07 d3b7bbe7102cd089680a828f5d8f6402c8cf6342
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef PERSTATICELEMENT
#define PERSTATICELEMENT
#include <basic/pipe/PipeElement.h>
#include <opencv2/opencv.hpp>
#include <Ice/Ice.h>
#include <YoloServer.h>
#include <QtGui/qpolygon.h>
#include "TrackingTrigger.h"
#include <QJsonArray>
#include <RapidStructureApp/TriggerElement.h>
#include <basic/util/fastdfs/FastFds.hpp>
#include "DBStruct.h"
#include <basic/db/Elasticsearch/EsDBTool.h>
class PerStaticElement : public basic::PipeElement
{
public:
    PerStaticElement(){}
    PerStaticElement(const SdkRule& rule);
public:
    ~PerStaticElement();
 
    //是否有矩形
    bool hasRects();
    //设置ROI区域
 
 
 
 
    void setYoloObjects(std::vector<ScoredRect> value);
 
    //将检测结果放到此单元中
    //void setVptResults(const vector<VPT_ObjInfo> &value);
    void setObjsResults(const ::YoloDetect::ObjInfos &value);
 
    //设置置信度
    void setSensitivity(float value);
 
    //获取矩形框
    std::vector<cv::Rect2f> getRects() const;
 
    //获取YOLO检测的结果
    std::vector<ScoredRect> getLastScoreRects() const;
 
 
    bool getTriggerState() const;
 
    void setFdfs(FastFdsWithLock *p_fdfsClient) {
        fdfsClient = p_fdfsClient;
    }
    void setImage(const cv::Mat &value);
 
private:
 
 
    virtual void threadInitial()override;
 
    virtual void threadFunc()override;
 
    QJsonArray getJsonArrayFromQString(const QString& strJson);
 
    std::string uploadImgToFdfs(cv::Mat& image);
 
    bool saveInfoToEs(const std::string& imgUrl,const ScoredRect& obj);
    void setMask(std::string mask);
    bool isInWeek(const std::vector<LActRuleWeekRecord>& ruleWeek);
 
private:
    cv::Mat image;
    //cv::Mat mask;
    //vector<VPT_ObjInfo> vptResults;
    ::YoloDetect::ObjInfos m_objs;
    QPolygon mPolygon;
    TrackingTrigger *trackingTrigger;
    ::YoloDetect::stringData cocoData;
    std::vector<ScoredRect> mObjs;
    TriggerElement m_triggerElement;
    FastFdsWithLock* fdfsClient;
    SdkRule m_sdkRule;
    std::vector<ScoredRect> m_lastScoreRect;
    unsigned long long m_lTime;
    EsDBTool* pManagerEsDB;
    bool m_bIsMask;
    bool m_bSetWH;
     cv::Point2i* pointArray;
     int npts;
};
 
#endif // PAELEMENT_H