| | |
| | | #include "CameraControlReview.h" |
| | | #include "CHImageControls/CHImageProcess.h" |
| | | #include "CHMotorControls/MotorControl.h" |
| | | #include "CHSignalControls/SignalControl.h" |
| | | |
| | | #include "CHEdgeTriangle/EdgeTriangle.h" |
| | | #include "CHEdgeTriangle/RecipeManager.h" |
| | |
| | | } |
| | | |
| | | LeaveCriticalSection(&m_csUserCriticalSection); |
| | | . |
| | | m_pRP2P->IRP2P_UpdateReviewResult(nModuleIndex, pGlassResult); |
| | | return; |
| | | |
| | |
| | | |
| | | if (pReviewResult->nModuleIdx == 0 && m_pRP2P->IRP2P_GetFirstReviewLeft()) |
| | | { |
| | | const CSignalControlInfo* pSignalInfo = m_pRP2P->IRP2P_GetReviewSignalinfo(); |
| | | int nDefocusValueMin = pSignalInfo->GetDefocusValueMin(); |
| | | int nDefocusValueMax = pSignalInfo->GetDefocusValueMax(); |
| | | |
| | | m_pRP2P->IRP2P_GetCurrentGlassResult()->nReview00ImageContrast = dFocusValue; |
| | | m_pRP2P->IRP2P_SetFirstReviewLeft(FALSE); |
| | | m_pRP2P->IRP2P_DisplayMessage(_T("FirstReviewLeft FDC FocusValue = %.2f "), dFocusValue); |
| | | |
| | | if (dFocusValue < nDefocusValueMin || dFocusValue > nDefocusValueMax) |
| | | { |
| | | m_pRP2P->IRP2P_GetSequenceProcessor()->SendSignalToSignalControl(0, 3, 1000); |
| | | } |
| | | } |
| | | else if(pReviewResult->nModuleIdx == 1 && m_pRP2P->IRP2P_GetFirstReviewRight()) |
| | | { |
| | | const CSignalControlInfo* pSignalInfo = m_pRP2P->IRP2P_GetReviewSignalinfo(); |
| | | int nDefocusValueMin = pSignalInfo->GetDefocusValueMin(); |
| | | int nDefocusValueMax = pSignalInfo->GetDefocusValueMax(); |
| | | |
| | | m_pRP2P->IRP2P_GetCurrentGlassResult()->nReview01ImageContrast = dFocusValue; |
| | | m_pRP2P->IRP2P_SetFirstReviewRight(FALSE); |
| | | m_pRP2P->IRP2P_DisplayMessage(_T("FirstReviewRight FDC FocusValue = %.2f "), dFocusValue); |
| | | |
| | | if (dFocusValue < nDefocusValueMin || dFocusValue > nDefocusValueMax) |
| | | { |
| | | m_pRP2P->IRP2P_GetSequenceProcessor()->SendSignalToSignalControl(0, 3, 1000); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | if (pReviewResult->nModuleIdx == 0 && m_pRP2P->IRP2P_GetFirstReviewLeft()) |
| | | { |
| | | const CSignalControlInfo* pSignalInfo = m_pRP2P->IRP2P_GetReviewSignalinfo(); |
| | | int nDefocusValueMin = pSignalInfo->GetDefocusValueMin(); |
| | | int nDefocusValueMax = pSignalInfo->GetDefocusValueMax(); |
| | | |
| | | m_pRP2P->IRP2P_GetCurrentGlassResult()->nReview00ImageContrast = dFocusValue; |
| | | m_pRP2P->IRP2P_SetFirstReviewLeft(FALSE); |
| | | m_pRP2P->IRP2P_DisplayMessage(_T("FirstReviewLeft FDC FocusValue = %.2f "), dFocusValue); |
| | | |
| | | if (dFocusValue < nDefocusValueMin || dFocusValue > nDefocusValueMax) |
| | | { |
| | | m_pRP2P->IRP2P_GetSequenceProcessor()->SendSignalToSignalControl(0, 3, 1000); |
| | | } |
| | | |
| | | } |
| | | else if (pReviewResult->nModuleIdx == 1 && m_pRP2P->IRP2P_GetFirstReviewRight()) |
| | | { |
| | | const CSignalControlInfo* pSignalInfo = m_pRP2P->IRP2P_GetReviewSignalinfo(); |
| | | int nDefocusValueMin = pSignalInfo->GetDefocusValueMin(); |
| | | int nDefocusValueMax = pSignalInfo->GetDefocusValueMax(); |
| | | |
| | | m_pRP2P->IRP2P_GetCurrentGlassResult()->nReview01ImageContrast = dFocusValue; |
| | | m_pRP2P->IRP2P_SetFirstReviewRight(FALSE); |
| | | m_pRP2P->IRP2P_DisplayMessage(_T("FirstReviewRight FDC FocusValue = %.2f "), dFocusValue); |
| | | |
| | | if (dFocusValue < nDefocusValueMin || dFocusValue > nDefocusValueMax) |
| | | { |
| | | m_pRP2P->IRP2P_GetSequenceProcessor()->SendSignalToSignalControl(0, 3, 1000); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | if (pReviewResult->nModuleIdx == 0 && m_pRP2P->IRP2P_GetFirstReviewLeft()) |
| | | { |
| | | const CSignalControlInfo* pSignalInfo = m_pRP2P->IRP2P_GetReviewSignalinfo(); |
| | | int nDefocusValueMin = pSignalInfo->GetDefocusValueMin(); |
| | | int nDefocusValueMax = pSignalInfo->GetDefocusValueMax(); |
| | | |
| | | m_pRP2P->IRP2P_GetCurrentGlassResult()->nReview00ImageContrast = dFocusValue; |
| | | m_pRP2P->IRP2P_SetFirstReviewLeft(FALSE); |
| | | m_pRP2P->IRP2P_DisplayMessage(_T("FirstReviewLeft FDC FocusValue = %.2f "), dFocusValue); |
| | | |
| | | if (dFocusValue < nDefocusValueMin || dFocusValue > nDefocusValueMax) |
| | | { |
| | | m_pRP2P->IRP2P_GetSequenceProcessor()->SendSignalToSignalControl(0, 3, 1000); |
| | | } |
| | | } |
| | | else if (pReviewResult->nModuleIdx == 1 && m_pRP2P->IRP2P_GetFirstReviewRight()) |
| | | { |
| | | const CSignalControlInfo* pSignalInfo = m_pRP2P->IRP2P_GetReviewSignalinfo(); |
| | | int nDefocusValueMin = pSignalInfo->GetDefocusValueMin(); |
| | | int nDefocusValueMax = pSignalInfo->GetDefocusValueMax(); |
| | | |
| | | m_pRP2P->IRP2P_GetCurrentGlassResult()->nReview01ImageContrast = dFocusValue; |
| | | m_pRP2P->IRP2P_SetFirstReviewRight(FALSE); |
| | | m_pRP2P->IRP2P_DisplayMessage(_T("FirstReviewRight FDC FocusValue = %.2f "), dFocusValue); |
| | | |
| | | if (dFocusValue < nDefocusValueMin || dFocusValue > nDefocusValueMax) |
| | | { |
| | | m_pRP2P->IRP2P_GetSequenceProcessor()->SendSignalToSignalControl(0, 3, 1000); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | if (pReviewResult->nModuleIdx == 0 && m_pRP2P->IRP2P_GetFirstReviewLeft()) |
| | | { |
| | | const CSignalControlInfo* pSignalInfo = m_pRP2P->IRP2P_GetReviewSignalinfo(); |
| | | int nDefocusValueMin = pSignalInfo->GetDefocusValueMin(); |
| | | int nDefocusValueMax = pSignalInfo->GetDefocusValueMax(); |
| | | |
| | | m_pRP2P->IRP2P_GetCurrentGlassResult()->nReview00ImageContrast = dFocusValue; |
| | | m_pRP2P->IRP2P_SetFirstReviewLeft(FALSE); |
| | | m_pRP2P->IRP2P_DisplayMessage(_T("FirstReviewLeft FDC FocusValue = %.2f "), dFocusValue); |
| | | |
| | | if (dFocusValue < nDefocusValueMin || dFocusValue > nDefocusValueMax) |
| | | { |
| | | m_pRP2P->IRP2P_GetSequenceProcessor()->SendSignalToSignalControl(0, 3, 1000); |
| | | } |
| | | } |
| | | else if (pReviewResult->nModuleIdx == 1 && m_pRP2P->IRP2P_GetFirstReviewRight()) |
| | | { |
| | | const CSignalControlInfo* pSignalInfo = m_pRP2P->IRP2P_GetReviewSignalinfo(); |
| | | int nDefocusValueMin = pSignalInfo->GetDefocusValueMin(); |
| | | int nDefocusValueMax = pSignalInfo->GetDefocusValueMax(); |
| | | |
| | | m_pRP2P->IRP2P_GetCurrentGlassResult()->nReview01ImageContrast = dFocusValue; |
| | | m_pRP2P->IRP2P_SetFirstReviewRight(FALSE); |
| | | m_pRP2P->IRP2P_DisplayMessage(_T("FirstReviewRight FDC FocusValue = %.2f "), dFocusValue); |
| | | |
| | | if (dFocusValue < nDefocusValueMin || dFocusValue > nDefocusValueMax) |
| | | { |
| | | m_pRP2P->IRP2P_GetSequenceProcessor()->SendSignalToSignalControl(0, 3, 1000); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | BYTE *pImageBufferByte = (BYTE*)(pImageBuffer); |
| | | if (pImageBuffer==NULL) return 0.; |
| | | |
| | | //#3524_210902_LYW_MOD START |
| | | int nWidth = nImageWidth; |
| | | //int nWidthStep = nImageWidth; |
| | | int nHeight = nImageHeight; |
| | | int nCalWidth = nWidth/2; |
| | | int nCalHeight = nHeight/2; |
| | | // int nCalWidth = nWidth/2; |
| | | // int nCalHeight = nHeight/2; |
| | | // |
| | | // int nStartX = nWidth/2 - nCalWidth/2; |
| | | // int nStartY = nHeight/2 - nCalHeight/2; |
| | | |
| | | int nStartX = nWidth/2 - nCalWidth/2; |
| | | int nStartY = nHeight/2 - nCalHeight/2; |
| | | int nCalWidth = nWidth; |
| | | int nCalHeight = nHeight; |
| | | |
| | | // |
| | | double Focusvalue = 0; |
| | | double SumValue = 0; |
| | | double TempValue = 0; |
| | | double m_nResultFocusValue = 0; |
| | | int nStartX = 0; |
| | | int nStartY = 0; |
| | | |
| | | for (int y = 0; y < nHeight - 1; y++) |
| | | int nStep = 3; |
| | | |
| | | double dXValue = 0., dYValue = 0., dCurr = 0., dSum = 0., dFocus = 0.; |
| | | for (int nH = nStartY; nH < nStartY + nCalHeight - nStep; nH++) |
| | | { |
| | | for (int x = 0; x < nWidth - 1; x++) |
| | | for (int nW = nStartX; nW < nStartX + nCalWidth - nStep; nW++) |
| | | { |
| | | TempValue = (double)(pImageBufferByte[y*nWidth + x] - pImageBufferByte[y*nWidth + x + 1]); |
| | | SumValue = TempValue * TempValue; |
| | | TempValue = (double)(pImageBufferByte[y*nWidth + x] - pImageBufferByte[(y + 1)*nWidth + x]); |
| | | SumValue += TempValue * TempValue; |
| | | |
| | | Focusvalue += sqrt(SumValue); |
| | | //Focusvalue += SumValue; |
| | | } |
| | | } |
| | | |
| | | m_nResultFocusValue = int(Focusvalue / (double)(nWidth*nHeight)); |
| | | |
| | | double dXValue=0., dYValue=0., dCurr=0., dSum=0., dFocus=0.; |
| | | for(int nH=nStartY ; nH<nStartY+nCalHeight-1 ; nH++) |
| | | { |
| | | for(int nW=nStartX ; nW<nStartX+nCalWidth-1 ; nW++) |
| | | { |
| | | dXValue = float((pImageBufferByte[nH*nW + nW+1] - pImageBufferByte[nH*nW + nW])*(pImageBufferByte[nH*nW + nW+1] - pImageBufferByte[nH*nW + nW])); |
| | | dYValue = float((pImageBufferByte[(nH+1)*nW + nW] - pImageBufferByte[nH*nW + nW])*(pImageBufferByte[(nH+1)*nW + nW] - pImageBufferByte[nH*nW + nW])); |
| | | dXValue = float((pImageBufferByte[nH*nWidth + nW + nStep] - pImageBufferByte[nH*nWidth + nW])*(pImageBufferByte[nH*nWidth + nW + nStep] - pImageBufferByte[nH*nWidth + nW])); |
| | | dYValue = float((pImageBufferByte[(nH + nStep)*nWidth + nW] - pImageBufferByte[nH*nWidth + nW])*(pImageBufferByte[(nH + nStep)*nWidth + nW] - pImageBufferByte[nH*nWidth + nW])); |
| | | dCurr = sqrt(dXValue + dYValue); |
| | | //break; |
| | | |
| | | dSum += dCurr; |
| | | } |
| | | } |
| | | dFocus = dSum/double(nCalWidth*nCalHeight); |
| | | dFocus = dSum / double(nCalWidth*nCalHeight); |
| | | |
| | | return dFocus; |
| | | //#3524_210902_LYW_MOD END |
| | | //Origin |
| | | // int nWidth = nImageWidth; |
| | | // int nHeight = nImageHeight; |
| | | // int nCalWidth = nWidth/2; |
| | | // int nCalHeight = nHeight/2; |
| | | // |
| | | // int nStartX = nWidth/2 - nCalWidth/2; |
| | | // int nStartY = nHeight/2 - nCalHeight/2; |
| | | // |
| | | // // |
| | | // double Focusvalue = 0; |
| | | // double SumValue = 0; |
| | | // double TempValue = 0; |
| | | // double m_nResultFocusValue = 0; |
| | | // |
| | | // for (int y = 0; y < nHeight - 1; y++) |
| | | // { |
| | | // for (int x = 0; x < nWidth - 1; x++) |
| | | // { |
| | | // TempValue = (double)(pImageBufferByte[y*nWidth + x] - pImageBufferByte[y*nWidth + x + 1]); |
| | | // SumValue = TempValue * TempValue; |
| | | // TempValue = (double)(pImageBufferByte[y*nWidth + x] - pImageBufferByte[(y + 1)*nWidth + x]); |
| | | // SumValue += TempValue * TempValue; |
| | | // |
| | | // Focusvalue += sqrt(SumValue); |
| | | // //Focusvalue += SumValue; |
| | | // } |
| | | // } |
| | | // |
| | | // m_nResultFocusValue = int(Focusvalue / (double)(nWidth*nHeight)); |
| | | // |
| | | // double dXValue=0., dYValue=0., dCurr=0., dSum=0., dFocus=0.; |
| | | // for(int nH=nStartY ; nH<nStartY+nCalHeight-1 ; nH++) |
| | | // { |
| | | // for(int nW=nStartX ; nW<nStartX+nCalWidth-1 ; nW++) |
| | | // { |
| | | // dXValue = float((pImageBufferByte[nH*nW + nW+1] - pImageBufferByte[nH*nW + nW])*(pImageBufferByte[nH*nW + nW+1] - pImageBufferByte[nH*nW + nW])); |
| | | // dYValue = float((pImageBufferByte[(nH+1)*nW + nW] - pImageBufferByte[nH*nW + nW])*(pImageBufferByte[(nH+1)*nW + nW] - pImageBufferByte[nH*nW + nW])); |
| | | // dCurr = sqrt(dXValue + dYValue); |
| | | // dSum += dCurr; |
| | | // } |
| | | // } |
| | | // dFocus = dSum/double(nCalWidth*nCalHeight); |
| | | // |
| | | // return dFocus; |
| | | } |
| | | |