#pragma once
|
#define PROJECTION_DIR "D:\\IJPReflowJudgement"
|
|
enum CellSide {CS_TOP, CS_LEFT, CS_RIGHT/*, CS_BOTTOM*/};
|
|
|
|
//20190926 최형목 CSOT DAM 판정시 모노모가 넘치는 부분도
|
//완전히 검은색 라인이 사라지는것이아니라 조정해줘야되서 추가
|
extern int m_nLineCheckerLocalPeakPeriod;
|
|
class reflowParam
|
{
|
public:
|
reflowParam()
|
{
|
pImageBuffer = NULL;
|
nImageWidth = -1;
|
nImageHeight = -1;
|
nChannel = -1;
|
nImageWidthStep = -1;
|
ROI_Rect = NULL;
|
nSide = -1;
|
nBaseTh = -1;
|
nDamTh2 = -1;
|
nDamTh1 = -1;
|
nDamTh2_in = -1;
|
nDamTh1_in = -1;
|
nDistance = NULL;
|
nBaseline = -1;
|
nBaseDam2 = -1;
|
nDam2Dist = -1;
|
nDam12Dist = -1;
|
nDam1Dist = -1;
|
|
pMasterBuffer = NULL;
|
nMasterWidth = -1;
|
nMasterHeight = -1;
|
nMasterChannel = -1;
|
nMasterWidthStep = -1;
|
nPeakPeriod = 10;
|
}
|
|
BYTE *pImageBuffer;
|
int nImageWidth;
|
int nImageHeight;
|
int nChannel;
|
int nImageWidthStep;
|
CRect *ROI_Rect;
|
int nSide;
|
int nBaseTh;
|
int nDamTh2;
|
int nDamTh1;
|
int nDamTh2_in;
|
int nDamTh1_in;
|
int *nDistance;
|
int nBaseline;
|
int nBaseDam2;
|
int nDam2Dist;
|
int nDam12Dist;
|
int nDam1Dist;
|
|
BYTE *pMasterBuffer;
|
int nMasterWidth;
|
int nMasterHeight;
|
int nMasterChannel;
|
int nMasterWidthStep;
|
|
int nPeakPeriod;
|
};
|
|
//20190926최형목 Reflow Result 데이터 없길래 만듬
|
class reflowResult
|
{
|
public:
|
reflowResult()
|
{
|
nDAM1 =FALSE;
|
nDam1_in =FALSE;
|
nDam2_in =FALSE;
|
nDam2 =FALSE;
|
|
nDam2_GrayMin = -1;
|
nDam2_GrayMax =-1;
|
nDam2_GrayDif=-1;
|
nDam2_GrayTH=-1;
|
|
nDam2_in_GrayMin = -1;
|
nDam2_in_GrayMax = -1;
|
nDam2_in_GrayDif=-1;
|
nDam2_in_GrayTH=-1;
|
|
nDam1_in_GrayMin = -1;
|
nDam1_in_GrayMax = -1;
|
nDam1_in_GrayDif=-1;
|
nDam1_in_GrayTH=-1;
|
|
nDAM1_GrayMin = -1;
|
nDAM1_GrayMax = -1;
|
nDam1_GrayDif=-1;
|
nDam1_GrayTH=-1;
|
|
nErrorcode = -1;
|
|
}
|
// 0 FAIL 1 SUCCESS
|
int nDAM1;
|
int nDam1_in;
|
int nDam2_in;
|
int nDam2;
|
|
int nDam2_GrayMin;
|
int nDam2_GrayMax;
|
int nDam2_GrayDif;//MIN MAX 차이
|
int nDam2_GrayTH;//보정후 TH
|
|
int nDam2_in_GrayMin;
|
int nDam2_in_GrayMax;
|
int nDam2_in_GrayDif;//MIN MAX 차이
|
int nDam2_in_GrayTH;//보정후 TH
|
|
int nDAM1_GrayMin;
|
int nDAM1_GrayMax;
|
int nDam1_GrayDif;//MIN MAX 차이
|
int nDam1_GrayTH;//보정후 TH
|
|
int nDam1_in_GrayMin;
|
int nDam1_in_GrayMax;
|
int nDam1_in_GrayDif;//MIN MAX 차이
|
int nDam1_in_GrayTH;//보정후 TH
|
|
|
//ERROR CODE
|
int nErrorcode;
|
|
|
};
|
//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_out
|
//nDamTh2_in : threshold dam2_in
|
//nDamTh1 : threshold dam1_out
|
//nDamTh1_in : threshold dam1_in
|
//nBaseline : Base Line distance
|
//nBaseDam2 : Base Line - dam2 distance
|
//nDam2Dist : dam2 distance
|
//nDam12Dist : dam2-dam1 distance
|
//nDam1Dist : dam1 distance
|
|
|
#define LOCAL_PEAK_PERIOD 10
|
//#define LINE_COMPENSATION
|
|
|
|
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);
|
|
reflowResult AFX_EXT_API Linecheck_New_Method(int* boe_line, reflowParam *rParam, BOOL bSetMaster);
|
////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
|
//int Linecheck_Method_Side0(int* boe_line, BYTE* pImage, int nImageWidth, int nImageHeight, CRect* ROI_Rect, int thDam2, int thDam2_2, int thDam1, int thDam1_2, int *nDistance); //distDam2Out, distDam2In, distDam1Out, distDam1In
|
//int Linecheck_Method_Side1(int* boe_line, BYTE* pImage, int nImageWidth, int nImageHeight, CRect* ROI_Rect, int thDam2, int thDam2_2, int thDam1, int thDam1_2, int *nDistance);
|
//int Linecheck_Method_Side2(int* boe_line, BYTE* pImage, int nImageWidth, int nImageHeight, CRect* ROI_Rect, int thDam2, int thDam2_2, int thDam1, int thDam1_2, int *nDistance);
|
|
int Linecheck_Method_Side0(int* boe_line, BYTE* pImage, int nImageWidth, int nImageHeight, CRect* ROI_Rect, int thDam2, int thDam2_2, int thDam1, int thDam1_2, int *nDistance,reflowResult* result); //distDam2Out, distDam2In, distDam1Out, distDam1In
|
int Linecheck_Method_Side1(int* boe_line, BYTE* pImage, int nImageWidth, int nImageHeight, CRect* ROI_Rect, int thDam2, int thDam2_2, int thDam1, int thDam1_2, int *nDistance,reflowResult* result);
|
int Linecheck_Method_Side2(int* boe_line, BYTE* pImage, int nImageWidth, int nImageHeight, CRect* ROI_Rect, int thDam2, int thDam2_2, int thDam1, int thDam1_2, int *nDistance,reflowResult* result);
|
|
|
|
//Error Code 의미 부여용 define
|
#define REFLOW_RESULT_IMAGE_LOAD_ERROR -1
|
#define REFLOW_RESULT_ROI_SETTING_ERROR -2
|
#define REFLOW_RESULT_DAM_SETTING_ERROR -3
|
#define REFLOW_RESULT_MATCHING_ERROR -4
|
#define REFLOW_RESULT_OUTPUT_ARRAY_ERROR -5
|
#define REFLOW_RESULT_REFLOWPARAM_SETTING_ERROR -6
|
|
|
|
|
//비사용 method
|
|
//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);
|
|
//위의 메소드와 같은 기능을 수행하지만, Threshold를 Dam1(Th1), Dam2(Th2)로 나눠서 검사하는 메소드
|
//int Linecheck_Method_Side0(int* boe_line, BYTE* pImage, int imageWidth, int imageHeight, CRect* ROI_Rect, int thDam2, int thDam1, int *nDistance); //distDam2Out, distDam2In, distDam1Out, distDam1In
|
//int Linecheck_Method_Side1(int* boe_line, BYTE* pImage, int imageWidth, int imageHeight, CRect* ROI_Rect, int thDam2, int thDam1, int *nDistance);
|
//int Linecheck_Method_Side2(int* boe_line, BYTE* pImage, int imageWidth, int imageHeight, CRect* ROI_Rect, int thDam2, int thDam1, int *nDistance);
|
|
//int AFX_EXT_API BOE_Linecheck(int* boe_line, reflowParam *rParam, BOOL bSetMaster = FALSE);
|
|
//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);
|
|
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"
|