SDC C-Project CF Review 프로그램
LYW
2021-10-14 26e2541b87ca76e16cf69399eb9a3cce62d2e864
Ongoing80 #3671 CF AOI Review 전설비 Align Matching 방법 개선

- 메인 보조 모두 매칭률이 낮아 실패 후 찾은 Align 픽셀이 동일 위치로 판단할 기준 Pixel값 설정 기능 추가
- 메인 보조 모두 매칭률이 낮지만 위치 조건으로 Align 성공한 횟수 가 설정한 횟수보다 높아지면 알람 발생 기능 추가
14개 파일 변경됨
109 ■■■■■ 파일 변경됨
ReviewSystem/CHReviewRecipe/Rcp_RsAlignManager.cpp 12 ●●●●● 패치 | 보기 | raw | blame | 히스토리
ReviewSystem/CHReviewRecipe/RsRcpAlignInfo.cpp 2 ●●●●● 패치 | 보기 | raw | blame | 히스토리
ReviewSystem/ReviewRecipeEditor/DlgAlign.cpp 22 ●●●●● 패치 | 보기 | raw | blame | 히스토리
ReviewSystem/ReviewRecipeEditor/DlgAlign.h 2 ●●●●● 패치 | 보기 | raw | blame | 히스토리
ReviewSystem/ReviewRecipeEditor/ReviewRecipeEditor.rc 7 ●●●● 패치 | 보기 | raw | blame | 히스토리
ReviewSystem/ReviewRecipeEditor/resource.h 2 ●●●●● 패치 | 보기 | raw | blame | 히스토리
ReviewSystem/ReviewSystem/CameraControlAlign.cpp 25 ●●●● 패치 | 보기 | raw | blame | 히스토리
ReviewSystem/ReviewSystem/CameraControlAlign.h 4 ●●●● 패치 | 보기 | raw | blame | 히스토리
ReviewSystem/ReviewSystem/ReviewInterface.cpp 16 ●●●●● 패치 | 보기 | raw | blame | 히스토리
ReviewSystem/ReviewSystem/ReviewInterface.h 5 ●●●●● 패치 | 보기 | raw | blame | 히스토리
ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp 2 ●●●●● 패치 | 보기 | raw | blame | 히스토리
ReviewSystem/include/CHAlignFinder/AlignFinderParam.h 6 ●●●●● 패치 | 보기 | raw | blame | 히스토리
ReviewSystem/include/CHReviewRecipe/RsRcpAlignInfo.h 2 ●●●●● 패치 | 보기 | raw | blame | 히스토리
ReviewSystem/include/CHReviewResult/AlignResult.h 2 ●●●●● 패치 | 보기 | raw | blame | 히스토리
ReviewSystem/CHReviewRecipe/Rcp_RsAlignManager.cpp
@@ -40,6 +40,12 @@
    strItem.Format(_T("RCP_ALIGN_SECOND_ASSISTANT_IMAGE_FILE"));
    macroFile.SetItem(strItem, m_rsRcpAlignInfo.m_strSecondAssistantImageFile);
    strItem.Format(_T("RCP_ALIGN_MATCHING_PIXEL_STANDARD"));
    macroFile.SetItem(strItem, m_rsRcpAlignInfo.m_strMatchingPixelStandard);
    strItem.Format(_T("RCP_ALIGN_MATCHING_ALARM_CONDITION"));
    macroFile.SetItem(strItem, m_rsRcpAlignInfo.m_strMatchingAlarmCondition);
    /*< LYW 20211012 - #3671 ADD End >*/
    strItem.Format(_T("RCP_ALIGN_TOTAL_PITCH_IMAGE_FILE"));
@@ -141,6 +147,12 @@
    strItem.Format(_T("RCP_ALIGN_SECOND_ASSISTANT_IMAGE_FILE"));
    macroFile.GetItem(strItem, m_rsRcpAlignInfo.m_strSecondAssistantImageFile, _T(""));
    strItem.Format(_T("RCP_ALIGN_MATCHING_PIXEL_STANDARD"));
    macroFile.GetItem(strItem, m_rsRcpAlignInfo.m_strMatchingPixelStandard, _T("0"));
    strItem.Format(_T("RCP_ALIGN_MATCHING_ALARM_CONDITION"));
    macroFile.GetItem(strItem, m_rsRcpAlignInfo.m_strMatchingAlarmCondition, _T("0"));
    /*< LYW 20211012 - #3671 ADD End >*/
    strItem.Format(_T("RCP_ALIGN_TOTAL_PITCH_IMAGE_FILE"));
ReviewSystem/CHReviewRecipe/RsRcpAlignInfo.cpp
@@ -23,6 +23,8 @@
    /*< LYW 20211012 - #3671 ADD Start >*/
    m_strFirstAssistantImageFile = _T("");
    m_strSecondAssistantImageFile = _T("");
    m_strMatchingPixelStandard = _T("");
    m_strMatchingAlarmCondition = _T("");
    /*< LYW 20211012 - #3671 ADD End >*/
    m_strTotalPitchImageFile= _T("");
    // edge find param
ReviewSystem/ReviewRecipeEditor/DlgAlign.cpp
@@ -16,6 +16,8 @@
    CDlgAlign::CDlgAlign(CWnd* pParent /*=NULL*/)
    : CDialog(CDlgAlign::IDD, pParent)
    , m_dMatchingPixelStandard(0)
    , m_dMatchingAlarmCondition(0)
{
    m_pFirstView = new CCHImageView(this);
    m_pSecondView = new CCHImageView(this);
@@ -71,6 +73,8 @@
    DDX_Control(pDX, IDC_CHECK_EDGEALIGN_PROCESS, m_ctrlCheckEdgeAlignProcess);
    DDX_Control(pDX, IDC_CHECK_ALIGN_SKIP, m_ctrlCheckAlignSkip);
    DDX_Control(pDX, IDC_CHECK_TOTALPITCHMEASRE, m_ctrlTotalPitchMeasure);
    DDX_Text(pDX, IDC_EDIT_MATCHONG_PIXEL_STANDARD, m_dMatchingPixelStandard);
    DDX_Text(pDX, IDC_EDIT_MATCHING_ALARM_CONDITION, m_dMatchingAlarmCondition);
}
@@ -377,6 +381,12 @@
    nRowIdx++;
    pRcpRsAlignManager->GetRsRcpAlignInfo()->m_strSecondAssistantImageFile = m_ctrlGridAlignImageInfo.GetItemText(nRowIdx, nColIdx);
    nRowIdx++;
    strItemText.Format(_T("%d"), m_dMatchingPixelStandard);
    pRcpRsAlignManager->GetRsRcpAlignInfo()->m_strMatchingPixelStandard = strItemText;
    strItemText.Format(_T("%d"), m_dMatchingAlarmCondition);
    pRcpRsAlignManager->GetRsRcpAlignInfo()->m_strMatchingAlarmCondition = strItemText;
    /*< LYW 20211012 - #3671 ADD End >*/
    strItemText = m_ctrlGridAlignImageInfo.GetItemText(nRowIdx, nColIdx);
@@ -746,6 +756,15 @@
    pCellButton = (CGridCellButton*)m_ctrlGridAlignImageInfo.GetCell(nRowIdx, nColIdx);
    pCellButton->SetText(_T("Browser"));
    /*< LYW 20211014 - #3671 ADD Start >*/
    strItemText = pRcpRsAlignManager->GetRsRcpAlignInfo()->m_strMatchingPixelStandard;
    m_dMatchingPixelStandard = _tcstod(strItemText, NULL);
    strItemText = pRcpRsAlignManager->GetRsRcpAlignInfo()->m_strMatchingAlarmCondition;
    m_dMatchingAlarmCondition = _tcstod(strItemText, NULL);
    /*< LYW 20211014 - #3671 ADD End >*/
    m_ctrlCheckImageProcess.SetCheck(pRcpRsAlignManager->GetRsRcpAlignInfo()->m_bUseImage);
@@ -951,6 +970,9 @@
    FillAlignRotateInfo();
    FillAlignImageInfo();
    /*< LYW 20211014 - #3671 ADD Start >*/
    UpdateData(FALSE);
    /*< LYW 20211014 - #3671 ADD End >*/
    Invalidate(FALSE);
}
ReviewSystem/ReviewRecipeEditor/DlgAlign.h
@@ -83,4 +83,6 @@
    CButton m_ctrlCheckAlignSkip;
    CButton m_ctrlTotalPitchMeasure;
    afx_msg void OnBnClickedButtonRcpFindTest();
    int m_dMatchingPixelStandard;
    int m_dMatchingAlarmCondition;
};
ReviewSystem/ReviewRecipeEditor/ReviewRecipeEditor.rc
@@ -226,7 +226,7 @@
    LTEXT           "Rotation Correction",IDC_STATIC,7,271,64,14,SS_CENTERIMAGE | WS_DISABLED
    CONTROL         "Operate",IDC_CHECK_ROTATE_PROCESS,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,74,273,55,10
    LTEXT           "Image Matching",IDC_STATIC,7,7,53,14,SS_CENTERIMAGE
    CONTROL         "Custom1",IDC_GRID_RCP_ALIGN_IMAGE_INFO,"MFCGridCtrl",WS_TABSTOP,7,22,311,92
    CONTROL         "Custom1",IDC_GRID_RCP_ALIGN_IMAGE_INFO,"MFCGridCtrl",WS_TABSTOP,7,22,311,76
    CONTROL         "Operate",IDC_CHECK_IMAGE_PROCESS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,64,10,55,10
    CONTROL         "Operate",IDC_CHECK_EDGE_PROCESS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,46,118,55,10
    LTEXT           "Align Images",IDC_STATIC,7,315,48,14,SS_CENTERIMAGE
@@ -237,6 +237,11 @@
    CONTROL         "TotalPitchMeasure",IDC_CHECK_TOTALPITCHMEASRE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,192,10,74,10
    LTEXT           "main Templete",IDC_STATIC,226,370,53,14,SS_CENTERIMAGE
    LTEXT           "Assistant Templete",IDC_STATIC,226,463,84,14,SS_CENTERIMAGE
    LTEXT           "보조 매칭 pixel 기준값:",IDC_STATIC,8,99,74,14,SS_CENTERIMAGE
    LTEXT           "알람 조건:",IDC_STATIC,132,99,38,14,SS_CENTERIMAGE
    LTEXT           "회 연속 발생시 ",IDC_STATIC,184,99,51,14,SS_CENTERIMAGE
    EDITTEXT        IDC_EDIT_MATCHONG_PIXEL_STANDARD,86,100,32,11,ES_AUTOHSCROLL
    EDITTEXT        IDC_EDIT_MATCHING_ALARM_CONDITION,167,101,16,10,ES_AUTOHSCROLL
END
IDD_DIALOG_REVIEW_RCP_EDITOR_DEFECT_FIND DIALOGEX 0, 0, 379, 526
ReviewSystem/ReviewRecipeEditor/resource.h
@@ -78,6 +78,7 @@
#define IDC_EDIT_RRCP_REVIEW_USER_DEFECT_COUNT 1008
#define IDC_EDIT_RCP_REVIEW_USER_DEFECT_COUNT 1008
#define IDC_EDIT_WSI_COUNT              1008
#define IDC_EDIT_MATCHING_ALARM_CONDITION 1008
#define IDC_GRID_RRCP_REVIEW_USER_DEFECT_INFO 1009
#define IDC_GRID_RCP_REVIEW_USER_DEFECT_INFO 1009
#define IDC_EDIT_MAG_INDEX              1009
@@ -141,6 +142,7 @@
#define IDC_REVIEW_DEFOCUS_VAL          1044
#define IDC_REVIEW_DEFOCUS_VALUE        1044
#define IDC_EDIT_RCP_JUDGE_CELL_JUDGE_COUNT 1044
#define IDC_EDIT_MATCHONG_PIXEL_STANDARD 1044
#define IDC_BUTTON_RCP_REVIEW_APPLY2    1045
#define IDC_BUTTON_RCP_REVIEW_PRIORITY_APPLY 1045
#define IDC_EDIT_RCP_MEASURE_COUNT      1045
ReviewSystem/ReviewSystem/CameraControlAlign.cpp
@@ -588,7 +588,11 @@
    CCameraImageData* pCameraImage = m_vecCameraImage[nCameraIdx];
    CAlignFinder* pAlignFinder = m_vecAlignFinder[nCameraIdx];
    if (pCameraImage==NULL || pAlignFinder==NULL) return FALSE;
    /*< LYW 20211014 - #index MOD Start >*/
    if (pCameraImage == NULL || pAlignFinder == NULL || m_pACC2P == NULL) return FALSE;
    /*< LYW 20211014 - #index MOD End >*/
    /*< Origin Code >*/
    //if (pCameraImage == NULL || pAlignFinder == NULL) return FALSE;
    // set find param;
    SAlignFindParam findParam;
@@ -601,6 +605,8 @@
    findParam.nEdgeThreshold        = m_AlignRecipe.nEdgeThreshold;
    findParam.nMergeRange            = m_AlignRecipe.nMergeRange;
    findParam.dEdgeRate                = m_AlignRecipe.dEdgeRate;
    findParam.dMatchingPixelStandard = _tcstod(m_AlignRecipe.strMatchingPixelStandard,NULL);
    findParam.dMatchingAlarmCondition = _tcstod(m_AlignRecipe.strMatchingAlarmCondition, NULL);
//    findParam.m_nAlignMarkPos        = m_AlignRecipe.nAlignMarkPosition;
@@ -633,11 +639,11 @@
//     CString strFilename = ALIGN_IMAGE_PATH;
//     if (nCameraIdx == 0)
//     {
//         strFilename += _T("\\Test3.BMP");
//         strFilename += _T("\\Test1.BMP");
//     }
//     else
//     {
//         strFilename += _T("\\Test4.BMP");
//         strFilename += _T("\\Test2.BMP");
//     }
//     TestImage.LoadImage(strFilename);
//     TestImage.GetBandImage(BandTypeGray, m_vecCameraImage[nCameraIdx]->GetImageData(View_Camera));
@@ -684,13 +690,14 @@
            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) <= 10 && abs(dffmain2assistanstY) <= 10 && findResult.dMatchValue != 0.0)
            if (abs(dffmain2assistanstX) <= findParam.dMatchingPixelStandard && abs(dffmain2assistanstY) <= findParam.dMatchingPixelStandard && findResult.dMatchValue != 0.0)
            {
                g_pLog->DisplayMessage(_T("Main Assistant Templete Find Same Point! Align Success!"));
                m_AlignResult.nFindAlign[nCameraIdx] = 1;
                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
@@ -699,6 +706,14 @@
                m_AlignResult.nFindAlign[nCameraIdx] = 0;
                m_AlignResult.dFindScore[nCameraIdx] = findResult.dMatchValue;
            }
            if (m_pACC2P->IACC2P_GetAccumaulate() > findParam.dMatchingAlarmCondition)
            {
                m_AlignResult.nFindAlign[nCameraIdx] = 0;
                m_AlignResult.dFindScore[nCameraIdx] = findResult.dMatchValue;
                m_pACC2P->IACC2P_SetAccumaulate(0);
                g_pLog->DisplayMessage(_T("Low Matching, But Align Same Point, Count is more Than MatchingAlarmCondition , Accumaulate = %d Reset"), m_pACC2P->IACC2P_GetAccumaulate());
            }
        }
    }
    /*< LYW 20211013 - #3671 ADD End >*/
ReviewSystem/ReviewSystem/CameraControlAlign.h
@@ -116,6 +116,10 @@
    virtual void IACC2P_CameraControl(int nValue) = 0;
    virtual BOOL IACC2P_SetLightLevel(int nCameraIndex, int nValue) = 0;
    virtual BOOL IACC2P_GetLightLevel(int nCameraIndex, int& nValue) = 0;
    /*< LYW 20211014 - #3671 ADD Start >*/
    virtual int     IACC2P_GetAccumaulate() = 0;
    virtual void IACC2P_SetAccumaulate(int dValue) = 0;
    /*< LYW 20211014 - #3671 ADD End >*/
};
class CCameraControlAlign : public CCameraController,
ReviewSystem/ReviewSystem/ReviewInterface.cpp
@@ -127,6 +127,10 @@
    m_bFirstReviewLeft = 0;
    m_bFirstReviewRight = 0;
    /*< LYW 20211014 - #3671 ADD Start >*/
    m_daccumulate = 0;
    /*< LYW 20211014 - #3671 ADD End >*/
    // cs init
    InitializeCriticalSection(&m_csReviewResult);
    InitializeCriticalSection(&m_csReviewSignal);
@@ -3115,6 +3119,16 @@
    return AlignLight_GetLightLevel(nCameraIndex, nValue);
}
int CReviewInterface::IACC2P_GetAccumaulate()
{
    return m_daccumulate;
}
void CReviewInterface::IACC2P_SetAccumaulate(int dValue)
{
    m_daccumulate = dValue;
}
BOOL CReviewInterface::IRCC2P_GetCurrentFrame(int nModuleIndex, int nCameraIndex, int nFrameWidth, int nFrameHeight, int nFrameChannels, CCHImageData* pImageData)
{
    if (m_pVirtualGlassMap==NULL) return FALSE;
@@ -5775,6 +5789,8 @@
        /*< LYW 20211012 - #3671 ADD Start >*/
        pGlassResult->m_AlignRecipe.strFirstAssistantImageFile = pRsRcpAlignInfo->m_strFirstAssistantImageFile;
        pGlassResult->m_AlignRecipe.strSecondAssistantImageFile = pRsRcpAlignInfo->m_strSecondAssistantImageFile;
        pGlassResult->m_AlignRecipe.strMatchingPixelStandard = pRsRcpAlignInfo->m_strMatchingPixelStandard;
        pGlassResult->m_AlignRecipe.strMatchingAlarmCondition = pRsRcpAlignInfo->m_strMatchingAlarmCondition;
        /*< LYW 20211012 - #3671 ADD End >*/
        pGlassResult->m_AlignRecipe.strTotalPitchImageFile = pRsRcpAlignInfo->m_strTotalPitchImageFile;
ReviewSystem/ReviewSystem/ReviewInterface.h
@@ -195,6 +195,10 @@
    virtual void    IACC2P_CameraControl(int nValue);
    virtual BOOL    IACC2P_SetLightLevel(int nCameraIndex, int nValue);
    virtual BOOL    IACC2P_GetLightLevel(int nCameraIndex, int& nValue);
    /*< LYW 20211014 - #3671 ADD Start >*/
    virtual int        IACC2P_GetAccumaulate();
    virtual void    IACC2P_SetAccumaulate(int dValue);
    /*< LYW 20211014 - #3671 ADD End >*/
    // review camera control 2 parent
    virtual BOOL    IRCC2P_GetCurrentFrame(int nModuleIndex, int nCameraIndex, int nFrameWidth, int nFrameHeight, int nFrameChannels, CCHImageData *pImageData);
@@ -264,6 +268,7 @@
    BOOL    m_bFirstReviewLeft;
    BOOL    m_bFirstReviewRight;
    int        m_daccumulate;
    virtual BOOL                        IRP2P_SaveDefectMap(const CString& strPath);
ReviewSystem/ReviewSystem/SequenceProcessor_CPJT.cpp
@@ -3775,6 +3775,8 @@
        /*< LYW 20211012 - #3671 ADD Start >*/
        pGlassResult->m_AlignRecipe.strFirstAssistantImageFile = pRsRcpAlignInfo->m_strFirstAssistantImageFile;
        pGlassResult->m_AlignRecipe.strSecondAssistantImageFile = pRsRcpAlignInfo->m_strSecondAssistantImageFile;
        pGlassResult->m_AlignRecipe.strMatchingPixelStandard = pRsRcpAlignInfo->m_strMatchingPixelStandard;
        pGlassResult->m_AlignRecipe.strMatchingAlarmCondition = pRsRcpAlignInfo->m_strMatchingAlarmCondition;
        /*< LYW 20211012 - #3671 ADD End >*/
        pGlassResult->m_AlignRecipe.strTotalPitchImageFile = pRsRcpAlignInfo->m_strTotalPitchImageFile;
ReviewSystem/include/CHAlignFinder/AlignFinderParam.h
@@ -17,6 +17,8 @@
        // match
        bMatchProcess            = TRUE;
        dMatchRate                = 0.8;
        dMatchingPixelStandard  = 0;
        dMatchingAlarmCondition = 0;
        // edge
        bEdgeProcess            = TRUE;
@@ -44,6 +46,10 @@
    // match
    BOOL    bMatchProcess;
    double    dMatchRate;
    /*< LYW 20211014 - #3671 ADD Start >*/
    int        dMatchingPixelStandard;
    int        dMatchingAlarmCondition;
    /*< LYW 20211014 - #3671 ADD End >*/
    // edge 
    BOOL    bEdgeProcess;
ReviewSystem/include/CHReviewRecipe/RsRcpAlignInfo.h
@@ -31,6 +31,8 @@
/*< LYW 20211012 - #3671 ADD Start >*/
    CString m_strFirstAssistantImageFile;
    CString m_strSecondAssistantImageFile;
    CString m_strMatchingPixelStandard;
    CString m_strMatchingAlarmCondition;
/*< LYW 20211012 - #3671 ADD End >*/
    CString m_strTotalPitchImageFile;
ReviewSystem/include/CHReviewResult/AlignResult.h
@@ -45,6 +45,8 @@
    /*< LYW 20211012 - #3671 ADD Start >*/
    CString strFirstAssistantImageFile;
    CString strSecondAssistantImageFile;
    CString strMatchingPixelStandard;
    CString strMatchingAlarmCondition;
    /*< LYW 20211012 - #3671 ADD End >*/
    CString strTotalPitchImageFile;