| | |
| | | m_pVectorAlignLightControl = NULL; |
| | | m_nViewMode = 0; |
| | | m_strSaveImageBasePath = _T(""); |
| | | m_strSaveImageOKPath = _T(""); |
| | | m_strSaveImageNGPath = _T(""); |
| | | |
| | | m_nAlignType = FALSE; |
| | | |
| | |
| | | m_strSaveImageBasePath = strPath; |
| | | } |
| | | |
| | | void CCameraControlAlign::SetSaveImageOKPath(CString strPath) |
| | | { |
| | | m_strSaveImageOKPath = strPath; |
| | | } |
| | | |
| | | void CCameraControlAlign::SetSaveImageNGPath(CString strPath) |
| | | { |
| | | m_strSaveImageNGPath = strPath; |
| | | } |
| | | |
| | | CCameraControl* CCameraControlAlign::GetCameraControl(int nCameraIndex) |
| | | { |
| | | for (VectorCameraControlIt it=m_vecCameraControl.begin(); it!=m_vecCameraControl.end(); it++) |
| | |
| | | |
| | | |
| | | //SAlignFindResult findResult = pAlignFinder->FindAlign(pCameraImage->GetImageData(View_Matching), findParam, pCameraImage->GetImageData(View_Template)); |
| | | //Main Align Matching |
| | | SAlignFindResult findResult = pAlignFinder->FindAlign(&camImage, findParam, pCameraImage->GetImageData(View_Template)); |
| | | g_pLog->DisplayMessage(_T("Main TempleteMatching Result : %d Cam ResultCode = %d, PixelX = %d, PixelY = %d, MatchingRate = %.3lf"), nCameraIdx, findResult.nResultCode, int(findResult.dPosX + 0.5), int(findResult.dPosY + 0.5), findResult.dMatchValue); |
| | | |
| | | // result process |
| | | //Main Align Matching result process |
| | | if (findResult.nResultCode==AlignMatch_Success) |
| | | { |
| | | /*< LYW 20211015 - #3671 ADD Start >*/ |
| | |
| | | |
| | | else |
| | | { |
| | | //Assistant Align Matching |
| | | SAlignFindResult findAssistantResult = pAlignFinder->FindAlign(&camImage, findParam, pCameraImage->GetImageData(View_AssistantTemplate)); |
| | | g_pLog->DisplayMessage(_T("Assistant TempleteMatching Result : %d Cam ResultCode = %d, PixelX = %d, PixelY = %d, MatchingRate = %.3lf"), nCameraIdx, findAssistantResult.nResultCode, int(findAssistantResult.dPosX + 0.5), int(findAssistantResult.dPosY + 0.5), findAssistantResult.dMatchValue); |
| | | //Assistant Align Matching result process |
| | | if (findAssistantResult.nResultCode == AlignMatch_Success) |
| | | { |
| | | /*< LYW 20211015 - #3671 ADD Start >*/ |
| | |
| | | |
| | | else |
| | | { |
| | | //Main, Assistant Find Pos Compare |
| | | int dffmain2assistanstX = int(findResult.dPosX) - int(findAssistantResult.dPosX); |
| | | int dffmain2assistanstY = int(findResult.dPosY) - int(findAssistantResult.dPosY); |
| | | g_pLog->DisplayMessage(_T("Main, Assistant TempleteMatching All Low Score! differenceX = %d, differenceY = %d"), dffmain2assistanstX, dffmain2assistanstY); |
| | | |
| | | if (abs(dffmain2assistanstX) <= findParam.dMatchingPixelStandard && abs(dffmain2assistanstY) <= findParam.dMatchingPixelStandard && findResult.dMatchValue != 0.0) |
| | | if (abs(dffmain2assistanstX) <= findParam.dMatchingPixelStandard && abs(dffmain2assistanstY) <= findParam.dMatchingPixelStandard && findResult.dMatchValue != 0.0 && findAssistantResult.dMatchValue != 0.0) |
| | | { |
| | | //Main, Assistant Find Pos Compare Result Success Process |
| | | m_AlignResult.nFindAlign[nCameraIdx] = 1; |
| | | m_AlignResult.dFindPixelX[nCameraIdx] = int(findResult.dPosX + 0.5); |
| | | m_AlignResult.dFindPixelY[nCameraIdx] = int(findResult.dPosY + 0.5); |
| | | /*< LYW 20211015 - #3671 MOD Start >*/ |
| | | m_AlignResult.dFindPixelX[nCameraIdx] = int((findResult.dPosX + findAssistantResult.dPosX) / 2 + 0.5); |
| | | m_AlignResult.dFindPixelY[nCameraIdx] = int((findResult.dPosY + findAssistantResult.dPosY) / 2 + 0.5); |
| | | /*< LYW 20211015 - #3671 MOD End >*/ |
| | | /*< Origin Code >*/ |
| | | //m_AlignResult.dFindPixelX[nCameraIdx] = int(findResult.dPosX + 0.5); |
| | | //m_AlignResult.dFindPixelY[nCameraIdx] = int(findResult.dPosY + 0.5); |
| | | m_AlignResult.dFindScore[nCameraIdx] = findResult.dMatchValue; |
| | | m_pACC2P->IACC2P_SetAccumaulate(m_pACC2P->IACC2P_GetAccumaulate() + 1); |
| | | g_pLog->DisplayMessage(_T("Main, Assistant Templete Find Same Point! Align Success! Accumaulate = %d"), m_pACC2P->IACC2P_GetAccumaulate()); |
| | |
| | | |
| | | else |
| | | { |
| | | //Main, Assistant Find Pos Compare Result Fail Process |
| | | g_pLog->DisplayMessage(_T("Main Assistant Templete Don`t Find Same Point! Align Fail!")); |
| | | m_AlignResult.nFindAlign[nCameraIdx] = 0; |
| | | m_AlignResult.dFindScore[nCameraIdx] = findResult.dMatchValue; |
| | |
| | | |
| | | if (m_pACC2P->IACC2P_GetAccumaulate() >= findParam.dMatchingAlarmCondition) |
| | | { |
| | | //Main, Assistant Find Pos Alarm Process |
| | | m_AlignResult.nFindAlign[nCameraIdx] = 0; |
| | | m_AlignResult.dFindScore[nCameraIdx] = findResult.dMatchValue; |
| | | m_pACC2P->IACC2P_SetAccumaulate(0); |
| | |
| | | time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond()); |
| | | pAlignFinder->SaveResultImage(strPath); |
| | | |
| | | Sleep(10); |
| | | //< SWK 20221226 - #4403 DEL > |
| | | // Sleep(10); |
| | | if (nCameraIdx == 0) |
| | | { |
| | | m_AlignResult.strAlignFirest = strPath; |
| | |
| | | m_AlignResult.strAlignSecond = strPath; |
| | | } |
| | | |
| | | if (m_AlignResult.nFindAlign[nCameraIdx] == 1) |
| | | { |
| | | CreateDirectory(m_strSaveImageOKPath, NULL); |
| | | // save threshold image |
| | | strPath.Format(_T("%s\\Cam%02d_Align_OK_TH_%04d%02d%02d%02d%02d%02d.jpg"), m_strSaveImageOKPath, nCameraIdx, |
| | | time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond()); |
| | | pAlignFinder->SaveThresholdImage(strPath); |
| | | |
| | | // save Result Image 20210208 얼라인 결과 저장 |
| | | strPath.Format(_T("%s\\Cam%02d_AlignResultOK_%04d%02d%02d%02d%02d%02d.jpg"), m_strSaveImageOKPath, nCameraIdx, |
| | | time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond()); |
| | | pAlignFinder->SaveResultImage(strPath); |
| | | } |
| | | |
| | | else |
| | | { |
| | | CreateDirectory(m_strSaveImageNGPath, NULL); |
| | | // save threshold image |
| | | strPath.Format(_T("%s\\Cam%02d_Align_NG_TH_%04d%02d%02d%02d%02d%02d.jpg"), m_strSaveImageNGPath, nCameraIdx, |
| | | time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond()); |
| | | pAlignFinder->SaveThresholdImage(strPath); |
| | | |
| | | // save Result Image 20210208 얼라인 결과 저장 |
| | | strPath.Format(_T("%s\\Cam%02d_AlignResultNG_%04d%02d%02d%02d%02d%02d.jpg"), m_strSaveImageNGPath, nCameraIdx, |
| | | time.GetYear(), time.GetMonth(), time.GetDay(), time.GetHour(), time.GetMinute(), time.GetSecond()); |
| | | pAlignFinder->SaveResultImage(strPath); |
| | | } |
| | | |
| | | // update matching image |
| | | pAlignFinder->GetBlobImage(pCameraImage->GetImageData(View_Matching)); |