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
#ifndef HOLE_DOT_PROCESS
#define HOLE_DOT_PROCESS
 
class CHoleDotProcess
{
public:
    CHoleDotProcess();
    CHoleDotProcess(DimensionDir eDir, int id);
    ~CHoleDotProcess();
 
public:
    //1. »ñÈ¡ID
    int GetID() { return m_id; }
 
    //2. »ñȡͼÏñ
    HalconCpp::HObject& GetImage() { return m_hImage; }
    void SetImage(HalconCpp::HObject& image) { m_hImage = image;  CreateMatchModel(); }
 
    //3. ÉèÖÃλÖÃ
    void SetPose(int x, int y) { m_nPoseX = x; m_nPoseY = y; }
    void GetPose(int& x, int& y) { x = m_nPoseX; y = m_nPoseY; };
 
    //4. ±£´æÊý¾Ý
    Json::Value WriteToJson(std::string& strDir);
    void DecodeJson(std::string& strDir, Json::Value& jsValue);
 
    //7. Ö´ÐÐ
    int Execute(DimensionDir eDir, Point2I offset);
 
public:
    DimensionDir m_eDir;                 //Side
    CString m_strName;                   //Name
    int m_nUse;                          //Use
 
    int m_nPoseType;                  //PoseType
    int m_nShapeType;                 //ShapeType
    int m_nBrightType;                //BrightType
    int m_nSmoothSize;                //SmoothSize
    int m_nThres;                     //Thres
    int m_nDefectSize;              //DefectSize
 
    Point2D m_ptLocResult;              //¶¨Î»½á¹û
    std::vector<NgDotInfo> m_nNgInfo;
 
private:
    HalconCpp::HObject m_hImage;   //HoleͼÏñ
    HalconCpp::HObject m_hImageResult;   //½ØÈ¡Í¼Ïñ
    int m_id;  //Hole±àºÅ
    double m_score; //HoleµÃ·Ö
 
    int m_nPoseX; //HoleÖÐÐĵãX
    int m_nPoseY; //HoleÖÐÐĵãY
 
    HalconCpp::HTuple m_idModel;   //Ä£°åID
    double m_xScale; //Ä£°åXËõ·Å
    double m_yScale; //Ä£°åYËõ·Å
    bool m_isScale;     //ÊÇ·ñËõ·Å
 
private:
    //1. ´´½¨Ä£°æ
    int CreateMatchModel(void);
 
    //2. ²éÕÒÄ¿±êλÖÃ
    bool FindTargetPos(DimensionDir eDir, Point2I offset);
 
    //3. »ñȡȱÏÝÐÅÏ¢
    bool FindDefectInfo(void);
};
 
#endif // !HOLE_DOT_PROCESS