xcd
2020-03-29 95d9d4a9d26323c51087a056c25f88180f1e3c45
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
using System;
using System.Collections;
 
 
 
namespace HalconTools
{
    public delegate void StatisticsDelegate(int val);
    
    /// <summary>
    /// This class and its derived classes MatchingOptSpeed and 
    /// MatchingOptStatistics implement the optimization process for the 
    /// matching parameters in terms of the recognition speed and the 
    /// recognition rate. Similar to the processing in HDevelop, a timer 
    /// is used to be able to abort the processing during a run.
    /// </summary>
    public class MatchingOpt
    {
       
        /// <summary>
        /// Delegate to notify about the state of  the optimization process
        /// </summary>
        public    StatisticsDelegate NotifyStatisticsObserver;
        /// <summary>
        /// Information about the optimization process 
        /// (e.g. Success or Failure) to be displayed in the GUI
        /// </summary>
        public    string  statusString;        
        /// <summary>
        /// Statistics for the parameter optimization
        /// </summary>
        public string [] recogTabOptimizationData = new string[8];
        /// <summary>
        /// Statistics for the recognition rate
        /// </summary>
        public string [] inspectTabRecogRateData  = new string[5];
        /// <summary>
        /// Statistics of detection results for the optimal 
        /// recognition rate
        /// </summary>
        public string [] inspectTabStatisticsData = new string[21];
 
        /// <summary>
        /// Reference to instance of MatchingAssistant, 
        /// which triggers the optimization performance.
        /// </summary>
        public MatchingAssistant    mAssistant;
        /// <summary>
        /// Result of detection 
        /// </summary>
        public MatchingResult        mResults;
        /// <summary>
        /// Set of matching parameters
        /// </summary>
        public MatchingParam        mParams;
        /// <summary>
        /// Number of all test images to be inspected
        /// </summary>
        public int                    tImageCount;
        /// <summary>
        /// Index of test image, being inspected currently
        /// </summary>
        public int                     mCurrentIndex;
        /// <summary>
        /// Flag, indicating success or failure of optimization process
        /// </summary>
        public bool                    mOptSuccess;
 
        public IEnumerator iterator;
        
        /// <summary>
        /// Constant describing a change in the status line
        /// </summary>
        public    const int UPDATE_RECOG_STATISTICS_STATUS= 21;
        /// <summary>
        /// Constant describing a change in the statistics of 
        /// the last recognition run
        /// </summary>
        public    const int UPDATE_RECOG_UPDATE_VALS        = 22;
        /// <summary>
        /// Constant describing a change in the statistics of 
        /// the optimal recognition run
        /// </summary>
        public  const int UPDATE_RECOG_OPTIMUM_VALS        = 23;
        /// <summary>
        /// Constant describing an error during the optimization 
        /// run, concerning the test image data or matching model
        /// </summary>
        public    const int UPDATE_TEST_ERR                = 24;
        /// <summary>
        /// Constant describing an error, which says that there is 
        /// no possible combination of matching parameters to obtain
        /// a detection result
        /// </summary>
        public    const int UPDATE_RECOG_ERR                = 25;
 
        /// <summary>
        /// Constant describing a change in the statistics of
        /// the recognition rate
        /// </summary>
        public    const int UPDATE_INSP_RECOGRATE            = 26;
        /// <summary>
        /// Constant describing a change in the statics of
        /// the average recognition results 
        /// </summary>
        public    const int UPDATE_INSP_STATISTICS        = 27;
        /// <summary>
        /// Constant describing an update of the 
        /// detection results
        /// </summary>
        public    const int UPDATE_TESTVIEW                = 28;
        /// <summary>
        /// Constant describing the success of the optimization 
        /// process and triggering the adjustment of the GUI
        /// components to the optimal parameter setting
        /// </summary>
        public  const int RUN_SUCCESSFUL                = 29;
        /// <summary>
        /// Constant describing the failure of the optimization
        /// process and reseting the matching parameters to the 
        /// initial setup
        /// </summary>
        public  const int RUN_FAILED                    = 30;
 
        /// <summary> 
        /// Constructor 
        /// </summary>
        public MatchingOpt(){}
 
        /// <summary>  
        /// Performs an optimization step.
        /// </summary>
        public virtual bool ExecuteStep(){ return true;    }
 
        /// <summary>  
        /// Resets all parameters for evaluating the performance to their initial values.
        /// </summary>
        public virtual void reset(){}
 
        /// <summary>
        /// 
        /// </summary>
        public virtual void stop(){}
        
        public void dummy(int val) { }
    }//class
}//end of namespace