| | |
| | | |
| | | #define OFFLINE_KEY 1 //OFFLINE_KEY:1是离线模式;0是在线模式 |
| | | #define PROHIBITED_LICENSE 0 //Prohibited license |
| | | |
| | | #define MARKIMG_NOTSAVE 0 // 不保存IMG_MARK文件夹的图片 |
| | | #endif |
| | |
| | | |
| | | ZeroMemory(m_EdgeResultInfo,sizeof(INS_EDGE_RESULT_INFO)*MAX_DIMENSION_COUNT); |
| | | m_stProfileResult.Reset(); |
| | | ZeroMemory(m_nGlassResult,sizeof(short)*5); |
| | | ZeroMemory(m_nGlassResult,sizeof(short) * 11); |
| | | m_ProfileInspectData.Reset(); |
| | | |
| | | ZeroMemory(m_nStageLongTheta,sizeof(short)*2); |
| | |
| | | |
| | | INS_EDGE_RESULT_INFO m_EdgeResultInfo[MAX_DIMENSION_COUNT]; |
| | | INS_PROFILE_RESULT_INFO m_stProfileResult; |
| | | short m_nGlassResult[5]; |
| | | short m_nGlassResult[11]; |
| | | PROFILECHAMFER_RESULT_DATA m_ProfileInspectData; |
| | | |
| | | BOOL m_bScanEndCamera[MAX_CAMERA_COUNT][MAX_SCAN_COUNT]; |
| | |
| | | int nChipCount; |
| | | int nChamferCount; |
| | | int nBurrCount; |
| | | int nUnknownCount; |
| | | |
| | | int nUnknownCount; |
| | | int nProAlarmResultCountA; |
| | | int nProAlarmResultCountB; |
| | | int nProAlarmResultCountC; |
| | | int nProAlarmResultCountD; |
| | | BOOL bProfileJudge[MAX_PROFILE_SETTING_COUNT]; |
| | | int nProfileDiff[MAX_PROFILE_SETTING_COUNT]; |
| | | BOOL bChamferJudgeUp[MAX_PROFILE_SETTING_COUNT]; |
| | |
| | | case DefectLoc_RCUTChip: str = _T("RCUTChip"); break; |
| | | } |
| | | |
| | | int nDefectSize = pInsDefect->m_nDefectRScale; |
| | | strFile.Format(_T("%s\\%03d_%s_%s_%s.jpg"),m_strDefectFolder,pInsDefect->m_nGlassDefectIdx,g_pBase->m_strHPanelID,PANEL_SIDE[(DimensionDir)pDefect->m_nSideLoc],str); |
| | | |
| | | CRect rectDefect; |
| | | |
| | | CRect rectDefect; |
| | | rectDefect.left = DEFECTIMAGE_WIDTH/2-pInsDefect->m_sPixelWidth/2; |
| | | rectDefect.right = DEFECTIMAGE_WIDTH/2+pInsDefect->m_sPixelWidth/2; |
| | | rectDefect.top = DEFECTIMAGE_HEIGHT/2-pInsDefect->m_sPixelHeight/2; |
| | |
| | | if(pDefect->m_DefectLoc == DefectLoc_Chamfer || pDefect->m_DefectLoc == DefectLoc_Profile) |
| | | continue; |
| | | |
| | | if (pDefect->m_DefectLoc == DefectLoc_KDist || pDefect->m_DefectLoc == DefectLoc_RCUTChip) |
| | | if (pDefect->m_DefectLoc == DefectLoc_Hole || pDefect->m_DefectLoc == DefectLoc_KDist || pDefect->m_DefectLoc == DefectLoc_RCUTChip) |
| | | continue; |
| | | |
| | | rectOrg = pDefect->m_Defect.s_DefectRect; |
| | |
| | | dumpInfo.ClientPointers = TRUE; |
| | | |
| | | // ?忑dump冼遂 |
| | | BOOL success = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpWithFullMemory, &dumpInfo, NULL, NULL); |
| | | BOOL success = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpFilterMemory, &dumpInfo, NULL, NULL); |
| | | CloseHandle(hFile); |
| | | |
| | | if (!success) { |
| | |
| | | |
| | | BOOL CSapLineGrab::CreateAcq(char *camFile) |
| | | { |
| | | if (SapManager::Open() == FALSE) |
| | | { |
| | | g_pLog->DisplayMessage(_T("Error: SapManager::Open.")); |
| | | if (SapManager::Open() == FALSE) { |
| | | //g_pLog->DisplayMessage(_T("Error: SapManager::Open.")); |
| | | return FALSE; |
| | | } |
| | | |
| | | // Get actual server count and ensure m_nBoardID is within range |
| | | int nCount = SapManager::GetServerCount(SapManager::ResourceAcq); |
| | | if (m_nBoardID < 0 || m_nBoardID >= nCount) { |
| | | g_pLog->DisplayMessage(_T("Error: Invalid Board ID. ServerCount=%d, nBoardID=%d"), nCount, m_nBoardID); |
| | | //g_pLog->DisplayMessage(_T("Error: Invalid Board ID. ServerCount=%d, nBoardID=%d"), nCount, m_nBoardID); |
| | | return FALSE; |
| | | } |
| | | |
| | |
| | | SapLocation loc(serverName, 0); |
| | | nCount = SapManager::GetResourceCount(loc, SapManager::ResourceAcq); |
| | | if (nCount < 0) { |
| | | g_pLog->DisplayMessage(_T("Error: Invalid Resource Count. ResourceCount=%d, nBoardID=%d"), nCount, m_nBoardID); |
| | | //g_pLog->DisplayMessage(_T("Error: Invalid Resource Count. ResourceCount=%d, nBoardID=%d"), nCount, m_nBoardID); |
| | | return FALSE; |
| | | } |
| | | |
| | |
| | | |
| | | if (CreateAcq(m_Param.cDCFPath) == FALSE) { |
| | | if (pErrorCode) *pErrorCode = INITX64_FAIL_CREATEACQ; |
| | | g_pLog->DisplayMessage(_T("Error: CreateAcq fail.")); |
| | | //g_pLog->DisplayMessage(_T("Error: CreateAcq fail.")); |
| | | return FALSE; |
| | | } |
| | | |
| | | if (CreateBuffer(0) == FALSE) { |
| | | if (pErrorCode) *pErrorCode = INITX64_FAIL_CREATEBUFFER; |
| | | g_pLog->DisplayMessage(_T("Error: CreateBuffer fail.")); |
| | | //g_pLog->DisplayMessage(_T("Error: CreateBuffer fail.")); |
| | | return FALSE; |
| | | } |
| | | |
| | | if (ActivateObjects() == FALSE) { |
| | | if (pErrorCode) *pErrorCode = INITX64_FAIL_CREATEXFER; |
| | | g_pLog->DisplayMessage(_T("Error: ActivateObjects fail.")); |
| | | //g_pLog->DisplayMessage(_T("Error: ActivateObjects fail.")); |
| | | return FALSE; |
| | | } |
| | | |
| | | if (m_pXfer->Connect() == FALSE) { |
| | | g_pLog->DisplayMessage(_T("Error: m_pXfer->Connect fail.")); |
| | | //g_pLog->DisplayMessage(_T("Error: m_pXfer->Connect fail.")); |
| | | return FALSE; |
| | | } |
| | | |
| | |
| | | |
| | | m_pFrameBuffer = new CFrameBufferController; |
| | | |
| | | if(TRUE == m_pFrameBuffer->CreateBuffer(m_Param.nCameraIdx,nBufSizeX ,nBufSizeY,nBufSize, nScanCount)) |
| | | { |
| | | g_pLog->DisplayMessage(_T("Create Buffer success!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize); |
| | | if(TRUE == m_pFrameBuffer->CreateBuffer(m_Param.nCameraIdx,nBufSizeX ,nBufSizeY,nBufSize, nScanCount)) { |
| | | //g_pLog->DisplayMessage(_T("Create Buffer success!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize); |
| | | } |
| | | else |
| | | { |
| | | g_pLog->DisplayMessage(_T("Create Buffer Fail!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize); |
| | | else { |
| | | //g_pLog->DisplayMessage(_T("Create Buffer Fail!:Id[%d],Frame[%d,%d],Cnt[%d]"),m_Param.nCameraIdx,nBufSizeX,nBufSizeY,nBufSize); |
| | | return FALSE; |
| | | } |
| | | |
| | |
| | | if (m_pSapAcq && !*m_pSapAcq) { |
| | | if (!m_pSapAcq->Create()) { |
| | | DestroyObjects(); |
| | | g_pLog->DisplayMessage(_T("Error: m_pSapAcq->Create fail.")); |
| | | //g_pLog->DisplayMessage(_T("Error: m_pSapAcq->Create fail.")); |
| | | return FALSE; |
| | | } |
| | | } |
| | |
| | | if (m_pSapBuffers && !*m_pSapBuffers) { |
| | | if (!m_pSapBuffers->Create()) { |
| | | DestroyObjects(); |
| | | g_pLog->DisplayMessage(_T("Error: m_pSapBuffers->Create fail.")); |
| | | //g_pLog->DisplayMessage(_T("Error: m_pSapBuffers->Create fail.")); |
| | | return FALSE; |
| | | } |
| | | m_pSapBuffers->Clear(); |
| | |
| | | m_pXfer->SetAutoEmpty(TRUE); |
| | | if (!m_pXfer->Create()) { |
| | | DestroyObjects(); |
| | | g_pLog->DisplayMessage(_T("Error: m_pXfer->Create fail.")); |
| | | //g_pLog->DisplayMessage(_T("Error: m_pXfer->Create fail.")); |
| | | return FALSE; |
| | | } |
| | | } |
| | |
| | | if(m_pFrameBuffer == NULL) |
| | | return; |
| | | |
| | | int nFrameCnt = m_pFrameBuffer->GetFrameCount(); |
| | | int nFrameCnt = m_pFrameBuffer->GetFrameCount(); |
| | | |
| | | m_nEndFrameIdx = nFrameCnt; |
| | | m_nSetBufferIdx = nFrameCnt -1; |
| | |
| | | if(pCamera == NULL) |
| | | continue; |
| | | |
| | | pBuffer = m_pInspect[iCam]->GetFullImgBuffer(iScan); |
| | | pBuffer = m_pInspect[iCam]->GetFullImgBuffer(iScan); |
| | | if(pBuffer == NULL) |
| | | continue; |
| | | |
| | |
| | | g_pLog->DisplayMessage(_T("Full Image Save Completed : Time[%d]"),GetTickCount()-dwTick); |
| | | } |
| | | |
| | | void CInterfaceManager::CoordProfileJudge(HISTORY_RESULT& pHistory) |
| | | { |
| | | PROFILECHAMFER_RESULT_DATA* pProfileResult1 = m_GlassData.GetProfileInspectData(); |
| | | pHistory.bResult = TRUE; |
| | | CINSPECT_JUDGEMENT_PARM* pJudges = m_GlassRecipe.GetJudgePrm(); |
| | | NgInfo ngArray[3][NG_INF_TOTAL]; |
| | | BlVision_GetSoftVisionApp()->Execute(4, ngArray[0]); |
| | | BlVision_GetSoftVisionApp()->Execute(5, ngArray[1]); |
| | | BlVision_GetSoftVisionApp()->Execute(7, ngArray[2]); |
| | | pHistory.nProAlarmResultCountB = 0; |
| | | pHistory.nProAlarmResultCountA = 0; |
| | | pHistory.nProAlarmResultCountD = 0; |
| | | pHistory.nProAlarmResultCountC = 0; |
| | | for (int i = 0; i < 3; i++) |
| | | { |
| | | /*A-BOT*/ |
| | | if (i == 0) |
| | | { |
| | | for (int c = 33; c < 47; c++) |
| | | { |
| | | if (pProfileResult1->ProfileData[c].bUseJudge == 1) |
| | | { |
| | | if (pHistory.nProfileDiff[c] > pJudges->nMinProfileNgCount_MinDiff[4]) |
| | | { |
| | | pHistory.bResult = FALSE; |
| | | } |
| | | if (pHistory.nProfileDiff[c] < -1 * pProfileResult1->ProfileData[c].nJudgeMinus || pHistory.nProfileDiff[c] > pProfileResult1->ProfileData[c].nJudgePlus) |
| | | { |
| | | pHistory.nProAlarmResultCountA += 1; |
| | | } |
| | | |
| | | } |
| | | } |
| | | for (int z = 0; z < 50; z++) |
| | | { |
| | | if (ngArray[i][z].ngType == 5 && ngArray[i][z].id < 6) |
| | | { |
| | | if (ngArray[i][z].maxValue<ngArray[i][z].result || ngArray[i][z].minValue>ngArray[i][z].result) |
| | | { |
| | | pHistory.nProAlarmResultCountA += 1; |
| | | if (pHistory.nProAlarmResultCountA > pJudges->nMinProfileNgCount[4] || ngArray[i][z].result > pJudges->nMinProfileNgCount_MinDiff[4]) |
| | | pHistory.bResult = FALSE; |
| | | } |
| | | |
| | | } |
| | | if (ngArray[i][z].ngType == 5 && (5 < ngArray[i][z].id && ngArray[i][z].id < 11)) |
| | | { |
| | | if (ngArray[i][z].maxValue<ngArray[i][z].result || ngArray[i][z].minValue>ngArray[i][z].result) |
| | | { |
| | | pHistory.nProAlarmResultCountA += 1; |
| | | if (pHistory.nProAlarmResultCountA > pJudges->nMinProfileNgCount[4] || ngArray[i][z].result > pJudges->nMinProfileNgCount_MinDiff[4]) |
| | | pHistory.bResult = FALSE; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | /*B-BOT*/ |
| | | if (i == 1) |
| | | { |
| | | for (int c = 0; c < 10; c++) |
| | | { |
| | | if (pProfileResult1->ProfileData[c].bUseJudge == 1) |
| | | { |
| | | if (pHistory.nProfileDiff[c] > pJudges->nMinProfileNgCount_MinDiff[5]) |
| | | { |
| | | pHistory.bResult = FALSE; |
| | | } |
| | | if (pHistory.nProfileDiff[c] < -1 * pProfileResult1->ProfileData[c].nJudgeMinus || pHistory.nProfileDiff[c] > pProfileResult1->ProfileData[c].nJudgePlus) |
| | | { |
| | | pHistory.nProAlarmResultCountB += 1; |
| | | } |
| | | |
| | | } |
| | | } |
| | | for (int z = 0; z < 50; z++) |
| | | { |
| | | if (ngArray[i][z].ngType == 5 && ngArray[i][z].id < 6) |
| | | { |
| | | if (ngArray[i][z].maxValue<ngArray[i][z].result || ngArray[i][z].minValue>ngArray[i][z].result) |
| | | { |
| | | pHistory.nProAlarmResultCountB += 1; |
| | | if (pHistory.nProAlarmResultCountB > pJudges->nMinProfileNgCount[5] || ngArray[i][z].result > pJudges->nMinProfileNgCount_MinDiff[5]) |
| | | pHistory.bResult = FALSE; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | /*D-BOT*/ |
| | | if (i == 2) |
| | | { |
| | | for (int c = 23; c < 33; c++) |
| | | { |
| | | if (pProfileResult1->ProfileData[c].bUseJudge == 1) |
| | | { |
| | | if (pHistory.nProfileDiff[c] > pJudges->nMinProfileNgCount_MinDiff[7]) |
| | | { |
| | | pHistory.bResult = FALSE; |
| | | } |
| | | if (pHistory.nProfileDiff[c] < -1 * pProfileResult1->ProfileData[c].nJudgeMinus || pHistory.nProfileDiff[c] > pProfileResult1->ProfileData[c].nJudgePlus) |
| | | { |
| | | pHistory.nProAlarmResultCountD += 1; |
| | | } |
| | | |
| | | } |
| | | } |
| | | for (int z = 0; z < 50; z++) |
| | | { |
| | | if (ngArray[i][z].ngType == 5 && ngArray[i][z].id < 6) |
| | | { |
| | | if (ngArray[i][z].maxValue<ngArray[i][z].result || ngArray[i][z].minValue>ngArray[i][z].result) |
| | | { |
| | | pHistory.nProAlarmResultCountD += 1; |
| | | if (pHistory.nProAlarmResultCountD > pJudges->nMinProfileNgCount[7] || ngArray[i][z].result > pJudges->nMinProfileNgCount_MinDiff[7]) |
| | | pHistory.bResult = FALSE; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | for (int i = 10; i < 23; i++) |
| | | { |
| | | if (pProfileResult1->ProfileData[i].bUseJudge == 1) |
| | | { |
| | | |
| | | if (pHistory.nProfileDiff[i] < -1 * pProfileResult1->ProfileData[i].nJudgeMinus || pHistory.nProfileDiff[i] > pProfileResult1->ProfileData[i].nJudgePlus) |
| | | { |
| | | pHistory.nProAlarmResultCountC += 1; |
| | | if (pHistory.nProAlarmResultCountD > pJudges->nMinProfileNgCount[6] || pHistory.nProfileDiff[i] > pJudges->nMinProfileNgCount_MinDiff[6]) |
| | | pHistory.bResult = FALSE; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | void CInterfaceManager::WritePLCResult(HISTORY_RESULT &pHistory) |
| | | { |
| | | short *pResult = m_GlassData.GetGlassResultInfo(); |
| | | ZeroMemory(pResult,sizeof(short)*5); |
| | | |
| | | |
| | | if (m_HardwareRecipe.GetCoordProfileUse() == 1) |
| | | { |
| | | CoordProfileJudge(pHistory); |
| | | if (pHistory.nDefectCnt- (pHistory.nProAlarmResultCountD+ pHistory.nProAlarmResultCountB+ pHistory.nProAlarmResultCountA+ pHistory.nProAlarmResultCountC) >0 ) |
| | | pHistory.bResult = FALSE; |
| | | } |
| | | // 0 : OK, 1 : NG |
| | | if(pHistory.bResult == TRUE) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | pResult[0] = 1; |
| | | g_pLog->DisplayMessage(_T("Inspection Result Glass %s - NG"),g_pBase->m_strHPanelID); |
| | | if (g_pLog->m_nHoleAlarmState ==TRUE) |
| | | { |
| | | pResult[10] = g_pLog->m_nHoleAlarmState; |
| | | pResult[0] = 1; |
| | | g_pLog->m_nHoleAlarmState = 0; |
| | | g_pLog->DisplayMessage(_T("Inspection Result Glass %s - NG, Hole Alarm%d-NG"), g_pBase->m_strHPanelID, pResult[10]); |
| | | } |
| | | else |
| | | { |
| | | pResult[0] = 1; |
| | | pResult[10] = 0; |
| | | g_pLog->DisplayMessage(_T("Inspection Result Glass %s - NG"), g_pBase->m_strHPanelID); |
| | | } |
| | | } |
| | | |
| | | m_GlassData.GetStageTheta(0,pResult[1],pResult[2]); |
| | | m_GlassData.GetStageTheta(1,pResult[3],pResult[4]); |
| | | |
| | | m_pControlInterface->SendCIMData(pResult,PLC_ADDR_GLASS_JUDEMENT,5); |
| | | g_pLog->DisplayMessage(_T("write PLC Result Data : Resut %d,1_L_Theat %d,1_S_Theat %d,2_L_Theat %d,2_S_Theat %d"),pResult[0],pResult[1],pResult[2],pResult[3],pResult[4]); |
| | | m_pControlInterface->SendCIMData(pResult,PLC_ADDR_GLASS_JUDEMENT,11); |
| | | g_pLog->DisplayMessage(_T("write PLC Result Data : Resut %d,1_L_Theat %d,1_S_Theat %d,2_L_Theat %d,2_S_Theat %d,pResult[10]:%d"),pResult[0],pResult[1],pResult[2],pResult[3],pResult[4], pResult[10]); |
| | | |
| | | INS_PROFILE_RESULT_INFO *pProfileResult = m_GlassData.GetProfileResultInfo(); |
| | | |
| | |
| | | public: |
| | | CInterfaceManager(void); |
| | | virtual ~CInterfaceManager(void); |
| | | NgInfo ngArray[3][NG_INF_TOTAL]; |
| | | |
| | | protected: |
| | | virtual void IMI2P_PLC_ReceiveSignalValue(int nSignalIndex, int nValue); |
| | |
| | | BOOL SetLiveGrabCommand(DimensionDir eDir,BOOL bStop); |
| | | void WriteLogManager(TCHAR *str); |
| | | void WritePLCResult(HISTORY_RESULT &pHistory); |
| | | void CoordProfileJudge(HISTORY_RESULT &pHistory); |
| | | void Save_FullImg(); |
| | | void ReadSplineModeldata(CString strRecipe); |
| | | void CopyImageBuffer(); |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | |
| | | 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) |
| | | { |
| | |
| | | { |
| | | 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) |
| | | { |
| | |
| | | { |
| | | 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) |
| | | { |
| | |
| | | { |
| | | pProfileResult->ResultChamfer[59 + i][1].bUseJudge = TRUE; |
| | | pProfileResult->ResultChamfer[59+i][1].bChamferJudge = FALSE; |
| | | nChamferAlarmResultCount = 1; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | if (ng.eDir == 5) |
| | |
| | | { |
| | | 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) |
| | | { |
| | |
| | | { |
| | | pProfileResult->ResultChamfer[59 + i][1].bUseJudge = TRUE; |
| | | pProfileResult->ResultChamfer[59 + i][1].bChamferJudge = FALSE; |
| | | |
| | | nChamferAlarmResultCount = 1; |
| | | } |
| | | } |
| | | |
| | | } |
| | | if (ng.eDir == 7) |
| | | { |
| | |
| | | { |
| | | 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) |
| | | { |
| | |
| | | { |
| | | pProfileResult->ResultChamfer[64 + i][1].bUseJudge = TRUE; |
| | | pProfileResult->ResultChamfer[64+i][1].bChamferJudge = FALSE; |
| | | nChamferAlarmResultCount = 1; |
| | | } |
| | | } |
| | | } |
| | |
| | | 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); |
| | | } |
| | | |
| | |
| | | typedef struct tagJUDGE_AVG |
| | | { |
| | | BOOL bUse; |
| | | int nDiff; |
| | | int nDiff; |
| | | }JUDGE_AVG, *PJUDGE_AVG; |
| | | |
| | | #define MAX_MARKER_COUNT 3 |
| | |
| | | BOOL bUseLengthDepthComp; |
| | | int nCornerJugeLength; |
| | | int nCornerJugeDepth; |
| | | BOOL bCoordProUse; |
| | | JUDGE_AVG AvgProfile[MAX_DIMENSION_COUNT]; |
| | | JUDGE_AVG AvgChamfer[MAX_DIMENSION_COUNT]; |
| | | |
| | |
| | | |
| | | m_bInsDirReverse = rhs.m_bInsDirReverse; |
| | | m_bUseColorVisual = rhs.m_bUseColorVisual; |
| | | |
| | | m_bUseCoordProfile = rhs.m_bUseCoordProfile; |
| | | m_bUseFreerun = rhs.m_bUseFreerun; |
| | | m_nFreerunPeriod = rhs.m_nFreerunPeriod; |
| | | m_nFreerunExposureTime = rhs.m_nFreerunExposureTime; |
| | |
| | | m_SoftWareSettings.Reset(); |
| | | m_bInsDirReverse = FALSE; |
| | | m_bUseColorVisual = TRUE; |
| | | |
| | | m_bUseCoordProfile = FALSE; |
| | | m_bTriggerBoardUse = FALSE; |
| | | m_nTriggerBoardComport = 0; |
| | | m_nFullImageCompressRatio = 70; |
| | |
| | | str = _T("FOLERREMOVEDAY"); |
| | | else if((void *)&m_bUseColorVisual == pValue) |
| | | str = _T("USECOLORVISUAL"); |
| | | else if ((void*)&m_bUseCoordProfile == pValue) |
| | | str = _T("USECOORDPROFILE"); |
| | | else if((void *)&m_bUseFreerun == pValue) |
| | | str = _T("USE_FREERUN"); |
| | | else if((void *)&m_nFreerunPeriod == pValue) |
| | |
| | | if(str.IsEmpty() == TRUE) |
| | | return FALSE; |
| | | BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str,m_bUseColorVisual); |
| | | |
| | | str = GetFileString((void*)&m_bUseCoordProfile); |
| | | if (str.IsEmpty() == TRUE) |
| | | return FALSE; |
| | | BasicInfoFile.GetItemValue((TCHAR*)(LPCTSTR)str, m_bUseCoordProfile); |
| | | |
| | | SetCameraCount(m_nCameraCount,m_nScanCount); |
| | | iLoop = 0; |
| | |
| | | if(str.IsEmpty() == TRUE) |
| | | return FALSE; |
| | | Register.GetItemValue((TCHAR*)(LPCTSTR)str,m_bUseColorVisual); |
| | | |
| | | str = GetFileString((void*)&m_bUseCoordProfile); |
| | | if (str.IsEmpty() == TRUE) |
| | | return FALSE; |
| | | Register.GetItemValue((TCHAR*)(LPCTSTR)str, m_bUseCoordProfile); |
| | | SetCameraCount(m_nCameraCount,m_nScanCount); |
| | | iLoop = 0; |
| | | for(iCam=0;iCam<m_nCameraCount;iCam++) |
| | |
| | | if(str.IsEmpty() == TRUE) |
| | | return FALSE; |
| | | Register.SetItemValue((TCHAR*)(LPCTSTR)str,m_bUseColorVisual); |
| | | |
| | | str = GetFileString((void*)&m_bUseCoordProfile); |
| | | if (str.IsEmpty() == TRUE) |
| | | return FALSE; |
| | | Register.SetItemValue((TCHAR*)(LPCTSTR)str, m_bUseCoordProfile); |
| | | if(m_pCameraSettings != NULL) |
| | | { |
| | | iLoop = 0; |
| | |
| | | return FALSE; |
| | | BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str,m_bUseColorVisual); |
| | | |
| | | str = GetFileString((void*)&m_bUseCoordProfile); |
| | | if (str.IsEmpty() == TRUE) |
| | | return FALSE; |
| | | BasicInfoFile.SetItemValue((TCHAR*)(LPCTSTR)str, m_bUseCoordProfile); |
| | | if(m_pCameraSettings != NULL) |
| | | { |
| | | iLoop = 0; |
| | |
| | | BOOL m_bInsDirReverse; |
| | | int m_nFolderRemoveDay; |
| | | BOOL m_bUseColorVisual; |
| | | |
| | | BOOL m_bUseCoordProfile; |
| | | |
| | | // Software |
| | | public: |
| | | CSoftSettings *GetSoftSettings(){return &m_SoftWareSettings;} |
| | |
| | | |
| | | public: |
| | | BOOL GetTriggerBoardUse() {return m_bTriggerBoardUse;} |
| | | BOOL GetCoordProfileUse() { return m_bUseCoordProfile; } |
| | | int GetTriggerBoardComport() {return m_nTriggerBoardComport;} |
| | | |
| | | BOOL m_bTriggerBoardUse; |
| | |
| | | |
| | | CStdioFile* m_pFileLog; |
| | | CFileException m_fileException; |
| | | |
| | | int m_nHoleAlarmState; |
| | | }; |
| | | |
| | | #define g_pLog CDisplayMessage::GetSingletonPtr() |
| | |
| | | m_st_GdiItem.colorOrange = RGB(250, 150, 0); |
| | | |
| | | m_bMouseLDown = FALSE; |
| | | |
| | | m_nBrushGray = 5; |
| | | } |
| | | |
| | | CFrameImg::~CFrameImg() |
| | |
| | | x = int(m_ptMouseCurrent.x / m_dZoom)+ m_ptOrg.x; |
| | | y = int(m_ptMouseCurrent.y / m_dZoom); |
| | | |
| | | if (0 > m_nBrushGray || 255 < m_nBrushGray) |
| | | m_nBrushGray = 5; |
| | | |
| | | for(k = y -20 ; k < y+20 ; k++) |
| | | { |
| | | for(l = x -8; l < x + 8 ; l++) |
| | | { |
| | | m_pBuffer[k * m_szImg.cx + l ] = 5; |
| | | m_pBuffer[k * m_szImg.cx + l ] = m_nBrushGray; |
| | | } |
| | | } |
| | | } |
| | |
| | | CPen pen(PS_SOLID, 1, RGB(255, 0, 0)); |
| | | CPen pen_SearchArea(PS_DASH, 1, RGB(255, 0, 255)); |
| | | CPen pen_Line(PS_DASH, 1, RGB(0, 255, 255)); |
| | | CPen roiPen(PS_SOLID, 1, RGB(0, 255, 255)); |
| | | |
| | | CBrush brush_Null; |
| | | brush_Null.CreateStockObject(NULL_BRUSH); |
| | |
| | | } |
| | | } |
| | | else if (1 == nType) { //矩形 |
| | | if (4 == inf.eVision) { |
| | | dc.SelectObject(&pen); |
| | | if (1 == inf.showROI) { |
| | | dc.SelectObject(&roiPen); |
| | | } |
| | | else { |
| | | dc.SelectObject(&pen_SearchArea); |
| | | if (4 == inf.eVision) { |
| | | dc.SelectObject(&pen); |
| | | } |
| | | else { |
| | | dc.SelectObject(&pen_SearchArea); |
| | | } |
| | | } |
| | | CPoint pt0, pt1, pt; |
| | | pt0.x = (int)((inf.rectX1 - m_ptOrg.x) * m_dZoom); |
| | |
| | | SIZE m_szMark; |
| | | MANUAL_MEASURE m_ManualMeausre; |
| | | CPoint m_ptMouseSaved; // Profile Save 扁瓷矫 荤侩 |
| | | |
| | | IViewInterface2Parent *m_pI2M; |
| | | bitset<MAX_DISPLAY_MODE> m_bitModeDisplay; // 拳搁 葛靛 bit |
| | | CRect m_rcROI; // 泅力 焊咯瘤绊 乐绰 康开 |
| | |
| | | |
| | | CGlass_Data *m_pGlassData; |
| | | CHardwareSettings *m_pHardware; |
| | | CGlassRecipe *m_pRecipe; |
| | | CGlassRecipe *m_pRecipe; |
| | | // CRecipe m_RecipeManager; |
| | | |
| | | public: |
| | |
| | | |
| | | int m_nModeTrackerVCR; |
| | | CPoint m_ptOldMouseVCR; |
| | | int m_nBrushGray; |
| | | }; |
| | | |
| | | |
| | |
| | | DDX_Text(pDX,IDC_EDIT_FOLDER_REMOVE_DAY,m_pDlgHDSettingParm->m_nFolderRemoveDay); |
| | | |
| | | DDX_Check(pDX,IDC_CHK_USECOLORVISUAL,m_pDlgHDSettingParm->m_bUseColorVisual); |
| | | |
| | | DDX_Check(pDX, IDC_CHK_USE_COORD_PROFILE,m_pDlgHDSettingParm->m_bUseCoordProfile); |
| | | DDX_Check(pDX,IDC_CHECK_USE_FREERUN_INSPECT,m_pDlgHDSettingParm->m_bUseFreerun); |
| | | DDX_Text(pDX,IDC_EDIT_FREERUN_PERIOD,m_pDlgHDSettingParm->m_nFreerunPeriod); |
| | | DDX_Text(pDX,IDC_EDIT_PREERUN_EXPOSURETIME,m_pDlgHDSettingParm->m_nFreerunExposureTime); |
| | |
| | | |
| | | public: |
| | | void View_LicenseInfo(); |
| | | |
| | | |
| | | protected: |
| | | CGridCtrl m_LightGrid; |
| | | CGridCtrl m_CameraGrid; |
| | |
| | | pCell->SetTextClr(color); |
| | | pCell->SetFont(&lf); |
| | | } |
| | | str.Format(_T("%.3f"),(double)m_HistoryData.nProfileDiff[nProfileIndex]/1000.); |
| | | str.Format(_T("%.3f"),(double)m_HistoryData.nProfileDiff[nProfileIndex] / 1000.); |
| | | m_GrdMeasureLine[i].SetItemText(nRowIdx,iCol,str); |
| | | |
| | | nRowIdx = 2; |
| | |
| | | pCell->SetTextClr(color); |
| | | pCell->SetFont(&lf); |
| | | } |
| | | str.Format(_T("%.3f"),(double)m_HistoryData.nChamferThickDn[nProfileIndex]/1000.); |
| | | str.Format(_T("%.3f"),(double)m_HistoryData.nChamferThickDn[nProfileIndex] / 1000.); |
| | | m_GrdMeasureLine[i].SetItemText(nRowIdx,iCol,str); |
| | | |
| | | if (i > MAX_VIEWINFO_GRD_CNT - 3 && (68 == nProfileIndex || 78 == nProfileIndex)) |
| | |
| | | |
| | | DDX_Check(pDX,IDC_CHK_USE_AVG_PROFILE_JUDGEMENT,pJudge->AvgProfile[m_nCndRDSide].bUse); |
| | | DDX_Text(pDX,IDC_EDIT_AVG_PROFILE_DIFF,pJudge->AvgProfile[m_nCndRDSide].nDiff); |
| | | |
| | | DDX_Check(pDX,IDC_CHK_USE_AVG_CHAMFER_JUDGEMENT,pJudge->AvgChamfer[m_nCndRDSide].bUse); |
| | | DDX_Text(pDX,IDC_EDIT_AVG_CHAMFER_DIFF,pJudge->AvgChamfer[m_nCndRDSide].nDiff); |
| | | |
| | |
| | | DDX_Control(pDX, IDC_SLIDER_ZOOM2 , m_sliderZoom); |
| | | DDX_Control(pDX, IDC_SCROLLBAR_V , m_ctrlScrollV); |
| | | DDX_Control(pDX, IDC_SCROLLBAR_H , m_ctrlScrollH); |
| | | |
| | | DDX_Text(pDX, IDC_BRUSH_GRAY , m_frameImg.m_nBrushGray); |
| | | |
| | | UINT nIDCmdSelect[] = { IDC_RDO_RCP_INSPECT_SETTING,IDC_RDO_RCP_PROFILE_SETTING,IDC_RDO_RCP_CHAMFER_SETTING}; |
| | | for (int i = 0; i < eRcp_End; i++) { |
| | | DDX_Control(pDX, nIDCmdSelect[i], m_ctrlCmdSelect[i]); |