mrDarker
2025-08-22 04d89bc9216553adcd0df87985a7665882924093
EdgeInspector_App/Process/InspectCamera.cpp
@@ -4443,6 +4443,10 @@
   strTemp.Format(_T("Notch\\Notch_%d_Defect_ProcBinImage"), nNotchIdx);
   SaveDebugImage(emDim, stFrame, pProcBinImage, strTemp);
   const double dExpectedLen = 6500;
   const double dMinNotchLen = 0.20 * dExpectedLen;
   const double dAlarmAbs = 0.10 * dExpectedLen;
   CvSeq* pContours = nullptr;
   CvMemStorage* pStorage = cvCreateMemStorage(0);
   cvFindContours(pProcBinImage, pStorage, &pContours, sizeof(CvContour), CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
@@ -4452,11 +4456,12 @@
      }
      double dLength = cvArcLength(c);
      if (dLength < 2000) {
      if (dLength < dMinNotchLen) {
         continue;
      }
      g_pLog->DisplayMessage(_T("Notch defect contour length: %f, Frame: %d, Scan: %d, Camera: %d, NotchIdx: %d"), dLength, stFrame.nFrameIdx, stFrame.nScanIdx, m_iCamera, nNotchIdx);
      if (std::abs(dLength - 7000) > 1000) {
      if (std::abs(dLength - dExpectedLen) > dAlarmAbs) {
         CvRect rect = cvBoundingRect(c, 0);
         CRect rtDefectPos_pxl(
            rect.x + rtROI.left,
@@ -4487,7 +4492,7 @@
         info.m_rtDefectPos_pxl = rtDefectPos_pxl;
         info.m_DefectLoc = DefectLoc_Notch_Broken;
         m_pDefectControl->ExtractDefect_NotchBroken(emDim, m_iCamera, stFrame.nScanIdx, info);
         g_pLog->DisplayMessage(_T("[WARN] Notch defect contour length deviates significantly from expected: %f"), dLength);
         g_pLog->DisplayMessage(_T("Notch defect contour length deviates significantly from expected: %f"), dLength);
         break;
      }
   }