From e3da46c70ef597490c3791984b9e020428924469 Mon Sep 17 00:00:00 2001
From: LWQ <1806950222@qq.com>
Date: 星期五, 22 八月 2025 11:35:38 +0800
Subject: [PATCH] Merge branch 'LWQ'

---
 EdgeInspector_App/Process/InspectCamera.cpp |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/EdgeInspector_App/Process/InspectCamera.cpp b/EdgeInspector_App/Process/InspectCamera.cpp
index 5c328ec..2bb6081 100644
--- a/EdgeInspector_App/Process/InspectCamera.cpp
+++ b/EdgeInspector_App/Process/InspectCamera.cpp
@@ -4443,6 +4443,21 @@
 	strTemp.Format(_T("Notch\\Notch_%d_Defect_ProcBinImage"), nNotchIdx);
 	SaveDebugImage(emDim, stFrame, pProcBinImage, strTemp);
 
+	CvSeq* pContours = nullptr;
+	CvMemStorage* pStorage = cvCreateMemStorage(0);
+	cvFindContours(pProcBinImage, pStorage, &pContours, sizeof(CvContour), CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
+	for (CvSeq* c = pContours; c != nullptr; c = c->h_next) {
+		double dLength = cvArcLength(c);
+		if (dLength < 2000) {
+			continue;
+		}
+
+		if (std::abs(dLength - 7000) > 1000) {
+			g_pLog->DisplayMessage(_T("[WARN] Notch defect contour length deviates significantly from expected: %f"), dLength);
+			break;
+		}
+	}
+
 #if	MINI_LED == 0
 	// 鎺橀健韴囬優電撮憭锛岆牆宀弘矔雽曤彅閳措船鐝傡儉旖旊嫺鐙傜棛
 	int nDilateCount = pNotchParam->m_nNotch_Inspect_Defect_dilate;

--
Gitblit v1.9.3