xcd
2020-03-28 18a29824a66de5bdd26bb8d16f4b6b4380740120
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
using System;
using HalconDotNet;
 
namespace HalconTools
{
    public class FitLineResult
    {
        /// <summary>
        /// Model contour applied for model detection
        /// </summary>
        public HXLDCont  mContours;
 
        public HXLDCont mContLine;
 
        public HXLDCont mContPoints;
 
        /// <summary>
        /// All model contours detected
        /// </summary>
        public HXLDCont  mFitLineResult;
 
        /// <summary>
        /// Row coordinate of the found instances of the model
        /// </summary>
        public HTuple mRow;
        /// <summary>
        /// Column coordinate of the found instances of the model
        /// </summary>
        public HTuple mCol;
 
        //Fit result
        public HTuple mRowStart;
 
        public HTuple mColumnStart;
 
        public HTuple mRowEnd;
 
        public HTuple mColumnEnd;
 
        public HTuple mVector;
 
        public HTuple mNC;
 
        public HTuple mDist;
 
        /// <summary>
        /// Rotation angle of the found instances of the model
        /// </summary>
        public HTuple mAngle;
 
        public HTuple hv_Rows;
 
        public HTuple hv_Columns;
 
        /// <summary>
        /// Image Width
        /// </summary>
        public int mWidth;
 
        /// <summary>
        /// Image Height
        /// </summary>
        public int mHeight;
 
        /// <summary>
        /// Time needed to detect <c>count</c> numbers of model instances
        /// </summary>
        public double mTime;
        /// <summary>
        /// Number of model instances found
        /// </summary>
        public int      count;
        /// <summary>
        /// 2D homogeneous transformation matrix that can be used to transform
        /// data from the model into the test image.
        /// </summary>
        public HHomMat2D hmat;
        
        /// <summary>Constructor</summary>
        public FitLineResult()
        {
            hmat = new HHomMat2D();
            mFitLineResult = new HXLDCont();
            mContLine = new HXLDCont();
            mContPoints = new HXLDCont();
        }
 
 
        /// <summary>
        /// Gets the detected contour.
        /// </summary>
        /// <returns>Detected contour</returns>
        public HXLDCont getDetectionResults()
        {
            HXLDCont rContours = new HXLDCont();
            hmat.HomMat2dIdentity();
            mFitLineResult.GenEmptyObj();
 
            //for (int i = 0; i < count; i++)
            //{
            //    hmat.VectorAngleToRigid(0, 0, 0, mRow[i].D, mCol[i].D, mAngle[i].D);
            //    rContours = hmat.AffineTransContourXld(mContour);
            //    mFitLineResult = mFitLineResult.ConcatObj(rContours);
            //}
            return mFitLineResult;
        }
 
 
        /// <summary>
        /// Resets the detection results and sets count to 0.
        /// </summary>
        public void reset()
        {
            count = 0;
        }
    }
}