SDC C-Project CF Review 프로그램
kojingeun
2023-07-14 f77e8008cac062596058fca2aeddda62b80bedbf
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
#pragma once
#define PROJECTION_DIR "D:\\IJPReflowJudgement"
 
enum CellSide {CS_TOP, CS_LEFT, CS_RIGHT, CS_BOTTOM=7};
 
class reflowParam
{
public:
    reflowParam()
    {
        pImageBuffer = NULL;
        nImageWidth = -1;
        nImageHeight = -1;
        nChannel = -1;
        nImageWidthStep = -1;
        ROI_Rect = NULL;
        nSide = -1;
        nBaseTh = -1;
        nDamTh2 = -1;
        nDistance = NULL;
        nBaseline = -1;
        nBaseDam2 = -1;
        nDam2Dist = -1;
        nDam12Dist = -1;
        nDam1Dist = -1;
 
        pMasterBuffer = NULL;
        nMasterWidth = -1;
        nMasterHeight = -1;
        nMasterChannel = -1;
        nMasterWidthStep = -1;
    }
 
    BYTE *pImageBuffer;
    int nImageWidth;
    int nImageHeight;
    int nChannel;
    int nImageWidthStep;
    CRect *ROI_Rect;
    int nSide;
    int nBaseTh;
    int nDamTh2;
    int nDamTh1;
    int *nDistance;
    int nBaseline;
    int nBaseDam2;
    int nDam2Dist;
    int nDam12Dist;
    int nDam1Dist;
 
    BYTE *pMasterBuffer;
    int nMasterWidth;
    int nMasterHeight;
    int nMasterChannel;
    int nMasterWidthStep;
};
 
//pImageBuffer : Input Image. 입력받은 Image Buffer및 Channel을 활용하여 GrayScale로 변환 후 사용
//imageWidth, imageHeight : Image 크기.
//imageWidthStep : margin을 포함한 Image의 한 Line을 구성하는 Byte 수
//ROI_Rect : 검사 영역 설정
//nChannel : Input Image의 Color Channel 수. 1~4
//nSide : CS_TOP(vertical 0->dam2->dam1->pattern), CS_LEFT(horizontal 0->dam2->dam1->pattern), CS_RIGHT(horizontal 0->pattern->dam1->dam2)
//nBaseTh : threshold baseline
//nDamTh2 : threshold dam2
//nDamTh1 : threshold dam1
//nBaseline : Base Line distance
//nBaseDam2 : Base Line - dam2 distance
//nDam2Dist : dam2 distance
//nDam12Dist : dam2-dam1 distance
//nDam1Dist : dam1 distance
 
 
#define LOCAL_PEAK_PERIOD 30
 
BYTE LocalMinima(int *pProjection, int x, int width);
BYTE LocalMaxima(int *pProjection, int x, int width);
int LocalMinimaAddr(int *pProjection, int x, int width);
 
BOOL Match_Vertical(BYTE *pImage, int nImageWidth, int nImageHeight, BYTE *pMaster, int nMasterWidth, int nMasterHeight, CRect *rtMatch);
BOOL Match_Horizontal(BYTE *pImage, int nImageWidth, int nImageHeight, BYTE *pMaster, int nMasterWidth, int nMasterHeight, CRect *rtMatch);
 
int AFX_EXT_API Linecheck_Method(int* boe_line, reflowParam *rParam, BOOL bSetMaster);
int AFX_EXT_API BOE_Linecheck(int* boe_line, reflowParam *rParam, BOOL bSetMaster = FALSE);
////image와 parameter(roi, side, threshold, distance)를 입력받아 boe_line[6] 배열 및 return(line 개수) 출력
 
////OUTPUT
//return 값 : 검출한 Line의 개수. 3 미만 : DAM2 Reflow 판정, 4~5 : DAM1 Reflow 판정, 6 : no Reflow 판정 / -1 : image not loaded, -2 : roi setting error, -3 : roi length error, -4 : master image matching fail, -5 : select wrong side
//boe_line : Line 좌표 출력 배열. DAM#2 바깥 2 Lines, DAM#2, DAM#1 순으로 좌표가 저장됨(즉, Pattern을 기준으로 바깥쪽부터 저장)
 
////INPUT
//reflowParam : 검사 Parameter
 
CString AFX_EXT_API Reflow_Judge(int LineCheck);
////BOE_LineCheck Method의 Return 값을 토대로 판정을 String으로 출력
//LineCheck : 검출한 Line의 개수, BOE_Linecheck 메소드의 Return 값
//return 값 : 3 미만 : "DAM2 Reflow", "DAM1 Reflow", 6 : "no Reflow" / -1 : "image not loaded", -2 : "roi setting error", -3 : "roi length error", -5 : "select wrong side"
 
 
 
int BOE_Linecheck_Side0(int* boe_line, BYTE* pImage, int imageWidth, int imageHeight, CRect* ROI_Rect, int th, int th2, int th3, int dist0, int dist1, int dist2, int dist3, int dist4);
int BOE_Linecheck_Side1(int* boe_line, BYTE* pImage, int imageWidth, int imageHeight, CRect* ROI_Rect, int th, int th2, int th3, int dist0, int dist1, int dist2, int dist3, int dist4);
int BOE_Linecheck_Side2(int* boe_line, BYTE* pImage, int imageWidth, int imageHeight, CRect* ROI_Rect, int th, int th2, int th3, int dist0, int dist1, int dist2, int dist3, int dist4);
 
int Linecheck_Method_Side0(int* boe_line, BYTE* pImage, int imageWidth, int imageHeight, CRect* ROI_Rect, int th, int *nDistance); //distDam2Out, distDam2In, distDam1Out, distDam1In
int Linecheck_Method_Side1(int* boe_line, BYTE* pImage, int imageWidth, int imageHeight, CRect* ROI_Rect, int th, int *nDistance);
int Linecheck_Method_Side2(int* boe_line, BYTE* pImage, int imageWidth, int imageHeight, CRect* ROI_Rect, int th, int *nDistance);