mrDarker
2025-07-16 1dbe46cd9d0f181d08d5a69f72d8548628a13b9d
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#pragma once
#include "Global_Define.h"
 
// 弥措 橇饭烙 160, 1橇饭烙 1024, 256栏肺 唱床辑 八荤窍搁 1橇饭烙俊 4 = 640俺 沥档
#define MAX_INSPECT_AREA_LIST    1024
 
class CSide_Data
{
public:
    CSide_Data(void);
    ~CSide_Data(void);
 
    void Reset();
 
    void SetFrameProc(int nFrameIdx);
    BOOL GetFrameProc(int nFrameIdx);
 
public:
    // Pixel Size..
    double                m_dPixelSizeX;
    double                m_dPixelSizeY;
 
    BOOL                m_bInspection_Complete;                    // 八荤 肯丰 犬牢
 
    // Start Line
    BOOL                m_bFindGlassStartLine;
    int                    m_nGlassStartLine;                        
    int                    m_nGlassStartFrame;
 
    // Pre End Line
    int                    m_nPreGlassEndLine;                        // 抗惑登绰 End Line
    int                    m_nPreGlassEndFrame;
 
    // End Line
    BOOL                m_bFindGlassEndLine;
    int                    m_nGlassEndLine;                        // Find End Line
    int                    m_nGlassEndFrame;
 
    // Judge Line
    int                    m_nCenterJudgeArea_Start;
    int                    m_nCenterJudgeArea_End;
 
 
    // Top / Bottom Corner Area
    BOOL                m_bTopCorner_Find;
    CRect                m_rtTopCornerArea;
    CRect                m_rtTopCornerArea_Offset;
    CRect                m_rtTopCornerArea_Ins;
    int                    m_nTopCornerShape;                        // 0 : None, 1 : CCut, 2 : RCut
    BOOL                m_bTopCorner_Measure;
 
    BOOL                m_bBotCorner_Find;
    CRect                m_rtBotCornerArea;
    CRect                m_rtBotCornerArea_Offset;
    CRect                m_rtBotCornerArea_Ins;
    int                    m_nBotCornerShape;
    BOOL                m_bBotCorner_Measure;
 
    // Top Mark Info
    BOOL                m_bTopMark_Find;
    CRect                m_rtTopMark_SearchArea;
    CPoint                m_ptTopMark_FindResult;
    CRect                m_rtTopMark_FindResult;
 
    int                    m_nTopMarkToEdge_X_pxl;
    int                    m_nTopMarkToEdge_Y_pxl;
 
    // Bottom Mark Info
    BOOL                m_bBotMark_Find;
    CRect                m_rtBotMark_SearchArea;
    CPoint                m_ptBotMark_FindResult;
    CRect                m_rtBotMark_FindResult;
 
    int                    m_nBotMarkToEdge_X_pxl;
    int                    m_nBotMarkToEdge_Y_pxl;
 
    // Scan Start锭 固府 拌魂秦辑 静磊..
    double                m_dCamResolutionX;    
    double                m_dCamResolutionY;
 
    // Frame 喊 茫篮 Side Line...
    double                m_nSideLineFrame[MAX_IMAGE_FRAME];                // Frame Side Line
    double                m_nSide_Chamfer_LineFrame[MAX_IMAGE_FRAME];        // Frame Side Line
 
    int                    m_nSideLinePosY[MAX_IMAGE_FRAME];                // Frame Side Real Y
    BOOL                m_bSideLine_NG[MAX_IMAGE_FRAME];                // OK, NG
 
    CRect                m_rtInspectArea[MAX_IMAGE_FRAME];
 
    int                    m_nSideInspectAreaCount[MAX_IMAGE_FRAME];
    CRect                m_rtSideInspectArea[MAX_IMAGE_FRAME][MAX_SIDE_INSPECT_AREA_COUNT];
 
    CRect                m_rtInspectArea_InsType[MAX_SIDE_INSPECT_TYPE][MAX_IMAGE_FRAME];        // 八荤 康开
    int                    m_nSideFilterLine_InsType[MAX_SIDE_INSPECT_TYPE][MAX_IMAGE_FRAME];        // Side Filter Line
 
    // Measure Dimension
    BOOL                m_bSideMeasureLine[MAX_SIDE_DIMENSION_MEASURE_COUNT];
    CPoint                m_ptSideMeasure_Start[MAX_SIDE_DIMENSION_MEASURE_COUNT];                // Measure Align Line..
    
    int                    m_nSideMeasure_CutLine_Status[MAX_SIDE_DIMENSION_MEASURE_COUNT];        // 0 : None, 1 : ok, 2 : ng
    CPoint                m_ptSideMeasure_CutLine[MAX_SIDE_DIMENSION_MEASURE_COUNT];                // Measure Glass Cut Line..
    double                m_dSideMeasrue_CutLine_Result_mm[MAX_SIDE_DIMENSION_MEASURE_COUNT];
    double                m_dSideMeasrue_CutLine_Offset_mm[MAX_SIDE_DIMENSION_MEASURE_COUNT];
    
    int                    m_nSideMeasure_ChamferLine_Status[MAX_SIDE_DIMENSION_MEASURE_COUNT];    // 0 : None, 1 : ok, 2 : ng
    CPoint                m_ptSideMeasure_ChamferLine[MAX_SIDE_DIMENSION_MEASURE_COUNT];            // Measure Chamfer Line..
    double                m_dSideMeasrue_Chamfer_Result_mm[MAX_SIDE_DIMENSION_MEASURE_COUNT];
 
 
    // Top Corner Measure Dimension
    int                    m_nTopCornerMeasure_CutLine_Status[MAX_CORNER_DIMENSION_MEASURE_COUNT];        // 0 : None, 1 : ok, 2 : ng
    CPoint                m_ptTopCornerMeasure_CutLine[MAX_CORNER_DIMENSION_MEASURE_COUNT];            // Measure Chamfer Line..
    double                m_dTopCornerMeasrue_CutLine_Result_mm[MAX_CORNER_DIMENSION_MEASURE_COUNT];
 
    int                    m_nTopCornerMeasure_Chamfer_Status[MAX_CORNER_DIMENSION_MEASURE_COUNT];        // 0 : None, 1 : ok, 2 : ng
    CPoint                m_ptTopCornerMeasure_Chamfer[MAX_CORNER_DIMENSION_MEASURE_COUNT];            // Measure Chamfer Line..
    double                m_dTopCornerMeasrue_Chamfer_Result_mm[MAX_CORNER_DIMENSION_MEASURE_COUNT];
 
    BOOL                m_bTopCornerMeasureResult;
    CRect                m_rtTopCornerResult[2];
    int                    m_nTopCornerWidth;
    int                    m_nTopCornerHeight;
 
    // Bot Corner Measure Dimension
    int                    m_nBotCornerMeasure_CutLine_Status[MAX_CORNER_DIMENSION_MEASURE_COUNT];        // 0 : None, 1 : ok, 2 : ng
    CPoint                m_ptBotCornerMeasure_CutLine[MAX_CORNER_DIMENSION_MEASURE_COUNT];            // Measure Chamfer Line..
    double                m_dBotCornerMeasrue_CutLine_Result_mm[MAX_CORNER_DIMENSION_MEASURE_COUNT];
 
    int                    m_nBotCornerMeasure_Chamfer_Status[MAX_CORNER_DIMENSION_MEASURE_COUNT];        // 0 : None, 1 : ok, 2 : ng
    CPoint                m_ptBotCornerMeasure_Chamfer[MAX_CORNER_DIMENSION_MEASURE_COUNT];            // Measure Chamfer Line..
    double                m_dBotCornerMeasrue_Chamfer_Result_mm[MAX_CORNER_DIMENSION_MEASURE_COUNT];
 
    BOOL                m_bBottomMeasureResult;
    CRect                m_rtBottomCornerResult[2];
    int                    m_nBottomCornerWidth;
    int                    m_nBottomCornerHeight;
 
    // Notch
    BOOL                m_bNotchInspection_Complete;
 
    int                    m_nNotchCount;
    CRect                m_rtNotchArea_pxl[MAX_SIDE_NOTCH_COUNT];
    char                m_strNotchMeasure_Comment[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_MEASURE_COUNT][256];
 
    CPoint                m_ptNotch_Reference[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_MEASURE_COUNT];
    CPoint                m_ptNotch_Dimension_Edge[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_MEASURE_COUNT];
    int                    m_nNotch_Dimension_Edge_Judge[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_MEASURE_COUNT];    // 0 : None, 1 : ok, 2 : over, 3 : under
    double                m_dNotch_Dimension_Edge_Result_um[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_MEASURE_COUNT];
    double                m_dNotch_Dimension_Edge_Result_Diff_um[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_MEASURE_COUNT];
    double                m_dNotch_Dimension_Edge_Judge_Std_um[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_MEASURE_COUNT];
    double                m_dNotch_Dimension_Edge_Judge_Min_um[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_MEASURE_COUNT];
    double                m_dNotch_Dimension_Edge_Judge_Max_um[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_MEASURE_COUNT];
    
    CPoint                m_ptNotch_Chamfer_Edge[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_MEASURE_COUNT];
    int                    m_nNotch_Chamfer_Edge_Judge[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_MEASURE_COUNT];    // 0 : None, 1 : ok, 2 : over, 3 : under
    double                m_dNotch_Chamfer_Edge_Result_um[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_MEASURE_COUNT];
    double                m_dNotch_Chamfer_Edge_Result_Diff_um[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_MEASURE_COUNT];
    double                m_dNotch_Chamfer_Edge_Judge_Std_um[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_MEASURE_COUNT];
    double                m_dNotch_Chamfer_Edge_Judge_Min_um[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_MEASURE_COUNT];
    double                m_dNotch_Chamfer_Edge_Judge_Max_um[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_MEASURE_COUNT];
 
    // Notch Circle
    int                    m_nNotchCircleCount[MAX_SIDE_NOTCH_COUNT];
    int                    m_nNotchCircle_Radius_Judge[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_CIRCLE_COUNT];            // 0 : None, 1 : ok, 2 : over, 3 : under
    CRect                m_rtNotchCircleArea_pxl[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_CIRCLE_COUNT];
    CPoint                m_ptNotchCircle_Center_pxl[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_CIRCLE_COUNT];
    double                m_ptNotchCircle_Radius_Result_X_pxl[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_CIRCLE_COUNT];
    double                m_ptNotchCircle_Radius_Result_Y_pxl[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_CIRCLE_COUNT];
    double                m_ptNotchCircle_Radius_Result_um[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_CIRCLE_COUNT];
    double                m_ptNotchCircle_Radius_Result_Diff_um[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_CIRCLE_COUNT];
    double                m_ptNotchCircle_Radius_Judge_Std_um[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_CIRCLE_COUNT];
    double                m_ptNotchCircle_Radius_Judge_Min_um[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_CIRCLE_COUNT];
    double                m_ptNotchCircle_Radius_Judge_Max_um[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_CIRCLE_COUNT];
    char                m_strNotchCircle_Radius_Comment[MAX_SIDE_NOTCH_COUNT][MAX_SIDE_NOTCH_CIRCLE_COUNT][256];
 
    // Exception
    int                    m_nExceptionAreaCount;
    CRect                m_rtExceptionArea_pxl[MAX_SIDE_EXCEPTION_AREA_COUNT];
 
    // User Defect
    int                    m_nUserDefectAreaCount;
    CRect                m_rtUserDefectArea_pxl[MAX_SIDE_USER_DEFECT_AREA_COUNT];
 
 
    // Defect
    int                    m_nTotalDefectCount;
    int                    m_nNgDefectCount;
 
    // Thread Processing..
    BOOL                m_nFrameThreadProc[MAX_IMAGE_FRAME];            // Thread啊 瘤唱埃 Frame阑 眉农窍磊..
    CCriticalSection    m_csFrameThread;
 
};