From daf053dfd30a3c20524d92290be9d3dc2ac599ec Mon Sep 17 00:00:00 2001
From: LWQ <1806950222@qq.com>
Date: 星期三, 30 七月 2025 19:27:02 +0800
Subject: [PATCH] 1.修复:区分测量精度及研磨量距离单像素精度功能 2.修改:上传到CIM的数据
---
ENRIT/Process/InspectCamera.cpp | 146 +++++++++++++++++++++++++++++++++++++-----------
1 files changed, 113 insertions(+), 33 deletions(-)
diff --git a/ENRIT/Process/InspectCamera.cpp b/ENRIT/Process/InspectCamera.cpp
index 2ad36ac..85efa19 100644
--- a/ENRIT/Process/InspectCamera.cpp
+++ b/ENRIT/Process/InspectCamera.cpp
@@ -615,12 +615,13 @@
g_pLog->DisplayMessage(_T("%s Re Align Mark Find[%d] Fail x %.2f, y %.2f"),PANEL_SIDE[emDim],iPos,m_iSideLine[stFrame.nScanIdx] + m_dMark2MarkX[stFrame.nScanIdx][iPos], pResInfo->nGlassStartLine + m_dMark2MarkY[stFrame.nScanIdx][iPos]);
}
+#if MARKIMG_NOTSAVE
+ CString strFile;
+ CvRect saveRect = cvRect((int)matchResut.pt.x - rectAlign.Width() / 2, (int)(matchResut.pt.y + rectAlign.top) - rectAlign.Height() / 2, rectAlign.Width(), rectAlign.Height());
+ strFile.Format(_T("%sIMG_MARK\\%s\\%s\\%s\\Align_%s_%s_%s.jpg"), PATH_INSPECTION_DATA, g_pBase->m_strLoadingDay, g_pBase->m_strHPanelID, g_pBase->m_strLoadingTime, strPos, PANEL_SIDE[emDim], strRes);
- CString strFile;
- CvRect saveRect = cvRect((int)matchResut.pt.x-rectAlign.Width()/2,(int)(matchResut.pt.y + rectAlign.top)-rectAlign.Height()/2,rectAlign.Width(),rectAlign.Height());
- strFile.Format(_T("%sIMG_MARK\\%s\\%s\\%s\\Align_%s_%s_%s.jpg"),PATH_INSPECTION_DATA,g_pBase->m_strLoadingDay,g_pBase->m_strHPanelID,g_pBase->m_strLoadingTime,strPos,PANEL_SIDE[emDim],strRes);
-
- SaveCvAlignImage(saveRect,strFile,stFrame.nScanIdx,nFrameWidth,nFrameHeight);
+ SaveCvAlignImage(saveRect, strFile, stFrame.nScanIdx, nFrameWidth, nFrameHeight);
+#endif // 0
return TRUE;
}
@@ -1090,7 +1091,20 @@
dConv = pCamera->m_dConvResolution[nStageNo];
dScan = pCamera->m_dScanResolution[nStageNo];
if(dConv <= 0 || dScan <= 0)
- return FALSE;
+ return FALSE;
+
+ if (m_pRecipe != nullptr) {
+ CProfileInspect_Prm& profile = m_pRecipe->m_ProfilePrm;
+ double dConvRes = profile.m_dConvResolution[eDimension][nStageNo];
+ if (dConvRes > 0.0) {
+ dConv = dConvRes;
+ }
+
+ double dScanRes = profile.m_dScanResolution[eDimension][nStageNo];
+ if (dScanRes > 0.0) {
+ dScan = dScanRes;
+ }
+ }
srand((unsigned int)time(NULL));
@@ -1362,12 +1376,13 @@
continue;
CopyBuffer.SetPixel((int)ptChamferEdgePos.u,v,128);
}
-
+#if MARKIMG_NOTSAVE
CString str;
- str.Format(_T("%sIMG_MARK\\%s\\%s\\%s\\ChamferRes_%s_%d.bmp"),PATH_INSPECTION_DATA,g_pBase->m_strLoadingDay,g_pBase->m_strHPanelID,g_pBase->m_strLoadingTime,PANEL_SIDE[eDimension],index);
+ str.Format(_T("%sIMG_MARK\\%s\\%s\\%s\\ChamferRes_%s_%d.bmp"), PATH_INSPECTION_DATA, g_pBase->m_strLoadingDay, g_pBase->m_strHPanelID, g_pBase->m_strLoadingTime, PANEL_SIDE[eDimension], index);
CBufferAttach attach(str);
attach.AttachToFile(CopyBuffer);
- }
+#endif // 0
+ }
return TRUE;
}
@@ -1672,7 +1687,15 @@
double dConv = pCamera->m_dConvResolution[g_pBase->m_nStageNo];
if(dConv <= 0)
- return FALSE;
+ return FALSE;
+
+ if (m_pRecipe != nullptr) {
+ CProfileInspect_Prm& profile = m_pRecipe->m_ProfilePrm;
+ double dConvRes = profile.m_dConvResolution[emDim][g_pBase->m_nStageNo];
+ if (dConvRes > 0.0) {
+ dConv = dConvRes;
+ }
+ }
double dProfileAvg;
double dChamferAvg;
@@ -1849,7 +1872,15 @@
double dConv = pCamera->m_dConvResolution[g_pBase->m_nStageNo];
if(dConv <= 0)
- return FALSE;
+ return FALSE;
+
+ if (m_pRecipe != nullptr) {
+ CProfileInspect_Prm& profile = m_pRecipe->m_ProfilePrm;
+ double dConvRes = profile.m_dConvResolution[emDim][g_pBase->m_nStageNo];
+ if (dConvRes > 0.0) {
+ dConv = dConvRes;
+ }
+ }
INS_EDGE_RESULT_INFO *pResInfo = NULL;
pResInfo = m_pGlassData->GetEdgeResultInfo(emDim);
@@ -1953,6 +1984,19 @@
{
g_pLog->DisplayMessage(_T("%s MakeProfilePosition Res Null : Frame %d, %d,%.3f,%.3f"),PANEL_SIDE[emDim],stFrame.nFrameIdx,g_pBase->m_nStageNo,dConv,dScan);
return FALSE;
+ }
+
+ if (m_pRecipe != nullptr) {
+ CProfileInspect_Prm& profile = m_pRecipe->m_ProfilePrm;
+ double dConvRes = profile.m_dConvResolution[emDim][g_pBase->m_nStageNo];
+ if (dConvRes > 0.0) {
+ dConv = dConvRes;
+ }
+
+ double dScanRes = profile.m_dScanResolution[emDim][g_pBase->m_nStageNo];
+ if (dScanRes > 0.0) {
+ dScan = dScanRes;
+ }
}
ptOffset.x = (float)((double)ptOffset.x / dConv);
@@ -2197,6 +2241,10 @@
int nStartLine = pEdgeInfo->nGlassStartLine - nOffset / 2;
int nEndLine = nSetEnd + nOffset / 2;
int nDefectIdx = 0;
+ int nChamferAlarmResultCount = 0;
+ int nProAlarmResultCount_MinDiff = 0;
+
+ CINSPECT_JUDGEMENT_PARM* pJudge = m_pRecipe->GetJudgePrm();
for (int i = 0; i < ngNum; i++) {
NgInfo ng = ngArray[i]; //渚鹅焷璀啀雽勮綆頇у眻
if (ng.eDir > 8 || ng.eDir < 0) continue;
@@ -2231,8 +2279,10 @@
int offy = ng.y2 - ps.y;
if (m_pDefectControl != NULL/* && nDefectIdx < 1*/)
- m_pDefectControl->ExtractDefect_Hole(eDim, m_iCamera, stFrame.nScanIdx, vecList, ngNum, DefectLoc_Hole, CRect(offx, offy, 2 * offx,2 * offy));
-
+ {
+ m_pDefectControl->ExtractDefect_Hole(eDim, m_iCamera, stFrame.nScanIdx, vecList, ngNum, DefectLoc_Hole, CRect(offx, offy, 2 * offx, 2 * offy));
+ g_pLog->m_nHoleAlarmState = 1;
+ }
}
if (5 == ng.ngType)
{
@@ -2245,8 +2295,11 @@
{
pProfileResult->ProfileData[59+i].bUseJudge = TRUE;
pProfileResult->ProfileData[59 + i].bProfileJudge = FALSE;
+ if (pJudge->nMinProfileNgCount_MinDiff[ng.eDir] < abs(ng.result))
+ {
+ nProAlarmResultCount_MinDiff = 1;
+ }
}
-
}
else if (5<ng.id&& ng.id < 11)
{
@@ -2255,16 +2308,22 @@
{
pProfileResult->ProfileData[69 + i].bUseJudge = TRUE;
pProfileResult->ProfileData[69+i].bProfileJudge = FALSE;
+
+ if (pJudge->nMinProfileNgCount_MinDiff[ng.eDir] < abs(ng.result))
+ {
+ nProAlarmResultCount_MinDiff = 1;
+ }
}
}
else if (10<ng.id && ng.id < 16)
{
- pProfileResult->ResultChamfer[49 +i][1].nChamferCalThick = ng.result;
- if (ng.maxValue<ng.result || ng.minValue>ng.result)
- {
- pProfileResult->ResultChamfer[49 + i][1].bUseJudge = TRUE;
- pProfileResult->ResultChamfer[49+i][1].bChamferJudge= FALSE;
- }
+ pProfileResult->ResultChamfer[49 + i][1].nChamferCalThick = ng.result;
+ if (ng.maxValue<ng.result || ng.minValue>ng.result)
+ {
+ pProfileResult->ResultChamfer[49 + i][1].bUseJudge = TRUE;
+ pProfileResult->ResultChamfer[49 + i][1].bChamferJudge = FALSE;
+ nChamferAlarmResultCount = 1;
+ }
}
else if (15<ng.id && ng.id < 21)
{
@@ -2273,9 +2332,9 @@
{
pProfileResult->ResultChamfer[59 + i][1].bUseJudge = TRUE;
pProfileResult->ResultChamfer[59+i][1].bChamferJudge = FALSE;
+ nChamferAlarmResultCount = 1;
}
- }
-
+ }
}
if (ng.eDir == 5)
@@ -2287,8 +2346,12 @@
{
pProfileResult->ProfileData[64 + i].bUseJudge = TRUE;
pProfileResult->ProfileData[64 + i].bProfileJudge = FALSE;
+
+ if (pJudge->nMinProfileNgCount_MinDiff[ng.eDir] < abs(ng.result))
+ {
+ nProAlarmResultCount_MinDiff = 1;
+ }
}
-
}
else if (5 < ng.id && ng.id < 11)
{
@@ -2297,10 +2360,9 @@
{
pProfileResult->ResultChamfer[59 + i][1].bUseJudge = TRUE;
pProfileResult->ResultChamfer[59 + i][1].bChamferJudge = FALSE;
-
+ nChamferAlarmResultCount = 1;
}
}
-
}
if (ng.eDir == 7)
{
@@ -2311,8 +2373,12 @@
{
pProfileResult->ProfileData[69 + i].bUseJudge = TRUE;
pProfileResult->ProfileData[69 + i].bProfileJudge = FALSE;
+
+ if (pJudge->nMinProfileNgCount_MinDiff[ng.eDir] < abs(ng.result))
+ {
+ nProAlarmResultCount_MinDiff = 1;
+ }
}
-
}
else if (5 < ng.id && ng.id < 11)
{
@@ -2321,6 +2387,7 @@
{
pProfileResult->ResultChamfer[64 + i][1].bUseJudge = TRUE;
pProfileResult->ResultChamfer[64+i][1].bChamferJudge = FALSE;
+ nChamferAlarmResultCount = 1;
}
}
}
@@ -3984,12 +4051,22 @@
if(nStageNo < 0 || nStageNo > 1)
nStageNo = 0;
- int nChipInsArea = (int)((double)pChipPrm->m_nChippingInsArea/pCamera->m_dConvResolution[nStageNo]);
- CRect rectChip = CRect(rectChamfer.CenterPoint().x,0,rectChamfer.CenterPoint().x,rectChamfer.Height());
- int nCrackInsArea = (int)((double)pChipPrm->m_nCrackINsArea/pCamera->m_dConvResolution[nStageNo]);
- CRect rectCrack = CRect(rectChamfer.CenterPoint().x,0,rectChamfer.CenterPoint().x,rectChamfer.Height());
- int nBrokenInsArea = (int)((double)pChipPrm->m_nBrokenInsArea/pCamera->m_dConvResolution[nStageNo]);
- CRect rectBroken = CRect(rectChamfer.CenterPoint().x,0,rectChamfer.CenterPoint().x,rectChamfer.Height());
+ double dConvRes = pCamera->m_dConvResolution[nStageNo];
+
+ //if (m_pRecipe != nullptr) {
+ // CProfileInspect_Prm& profile = m_pRecipe->m_ProfilePrm;
+ // double dProfileRes = profile.m_dConvResolution[eDim][nStageNo];
+ // if (dProfileRes > 0.0) {
+ // dConvRes = dProfileRes;
+ // }
+ //}
+
+ int nChipInsArea = (int)((double)pChipPrm->m_nChippingInsArea / dConvRes);
+ CRect rectChip = CRect(rectChamfer.CenterPoint().x, 0, rectChamfer.CenterPoint().x, rectChamfer.Height());
+ int nCrackInsArea = (int)((double)pChipPrm->m_nCrackINsArea / dConvRes);
+ CRect rectCrack = CRect(rectChamfer.CenterPoint().x, 0, rectChamfer.CenterPoint().x, rectChamfer.Height());
+ int nBrokenInsArea = (int)((double)pChipPrm->m_nBrokenInsArea / dConvRes);
+ CRect rectBroken = CRect(rectChamfer.CenterPoint().x, 0, rectChamfer.CenterPoint().x, rectChamfer.Height());
rectChip.InflateRect(align_4byte(nChipInsArea)/2,0);
rectCrack.InflateRect(align_4byte(nCrackInsArea)/2,0);
@@ -4228,8 +4305,11 @@
USES_CONVERSION;
char str_filename[1024];
sprintf_s(str_filename, "%s", W2A(strFile));
- cvSaveImage(str_filename,IpImg);
+#if MARKIMG_NOTSAVE
+ cvSaveImage(str_filename, IpImg);
+#endif // 0
+
cvReleaseImage(&IpImg);
}
--
Gitblit v1.9.3