From 68e7bb9839ff6f5158f25b114b2df26475b978fa Mon Sep 17 00:00:00 2001 From: jerryzeng Date: Thu, 22 Oct 2026 16:11:18 +0800 Subject: [PATCH] =?UTF-8?q?beltTearingDetection=20version=201.0.1=20:=20?= =?UTF-8?q?=E7=9A=AE=E5=B8=A6=E6=92=95=E8=A3=82:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=92=95=E8=A3=82Y=E6=96=B9=E5=90=91=E6=9C=80=E5=B0=8F?= =?UTF-8?q?=E5=92=8C=E6=9C=80=E5=A4=A7=E5=AE=BD=E5=BA=A6=EF=BC=8C=20?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E9=9D=9E=E8=B4=AF=E7=A9=BF=E6=92=95=E8=A3=82?= =?UTF-8?q?=E6=9C=80=E5=B0=8F=E6=B7=B1=E5=BA=A6=EF=BC=8C=E7=94=A8=E4=BA=8E?= =?UTF-8?q?=E6=BB=A4=E9=99=A4=E7=82=B9=E4=BA=91=E6=B3=A2=E5=8A=A8=E5=92=8C?= =?UTF-8?q?=E9=9B=A8=E5=88=B7=E8=BF=90=E5=8A=A8=E6=97=B6=E4=BA=A7=E7=94=9F?= =?UTF-8?q?=E7=9A=84=E8=99=9A=E6=8B=9FGap=EF=BC=88=E4=B8=AD=E4=BF=A1?= =?UTF-8?q?=E9=87=8D=E5=B7=A5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beltTearingDetection_test.cpp | 11 +++++++++-- sourceCode/beltTearingDetection.cpp | 19 +++++++++++++++---- sourceCode/beltTearingDetection_Export.h | 6 +++++- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/beltTearingDetection_test/beltTearingDetection_test.cpp b/beltTearingDetection_test/beltTearingDetection_test.cpp index 78ef2d8..4f037d3 100644 --- a/beltTearingDetection_test/beltTearingDetection_test.cpp +++ b/beltTearingDetection_test/beltTearingDetection_test.cpp @@ -1051,13 +1051,16 @@ int main() }; SVzNLRange fileIdx[TEST_GROUP] = { - {10,24}, {2, 18}, {16,16}, {1,2}, {1,3} }; + {10,24}, {2, 18}, {16,16}, {1,2}, {2,3} }; double camPoseR[9] = { 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0 }; + const char* ver = sg_beltTearingVersion(); + printf("ver:%s\n", ver); + SSG_beltTearingParam algoParam; algoParam.differnceBinTh = 2.0; // 1.0; algoParam.extractPara.gapChkWin = 7; @@ -1067,6 +1070,10 @@ int main() algoParam.tearingMinGap = 100.0; //两个å�Œä½�置的纵撕的最å°�间隔。大于此门é™�视为两个撕裂 algoParam.tearingMinLen = 30.0; + algoParam.tearingMinDepth = 2.0; //对于é�žç©¿é€�型撕裂的检测最å°�深度,用于滤除点云波动形æˆ�的虚å�‡æ’•裂 + algoParam.tearingMinYWidth = 2.0; //撕裂在Yæ–¹å�‘的最大宽度, 用于滤除雨刷è¿�行产生的虚å�‡Gap + algoParam.tearingMaxYWidth = 150; //撕裂在Yæ–¹å�‘的最大宽度, 用于滤除雨刷è¿�行产生的虚å�‡Gap + char _scan_file[256]; int endGroup = TEST_GROUP - 1; for (int grp = 4; grp <= endGroup; grp++) @@ -1120,7 +1127,7 @@ int main() for (int lineIdx = 0; lineIdx < lineNum; lineIdx++) { - if ((lineIdx == 56) || (lineIdx == 857)) + if ((lineIdx == 56) || (lineIdx == 435)) int kkk = 1; SVzNL3DLaserLine* a_line = &laser3DPoints[lineIdx]; sg_detectBeltTearing( diff --git a/sourceCode/beltTearingDetection.cpp b/sourceCode/beltTearingDetection.cpp index 247827f..7458fdb 100644 --- a/sourceCode/beltTearingDetection.cpp +++ b/sourceCode/beltTearingDetection.cpp @@ -6,7 +6,8 @@ #include "SG_errCode.h" //version 1.0.0 : Ƥ´øËºÁѰ汾Ìí¼Ó°æ±¾ºÅºóµÄ»ù´¡°æ±¾ -std::string m_strVersion = "BeltTearing 1.0.0"; +//version 1.0.1 : Ìí¼Ó˺ÁÑY·½Ïò×îСºÍ×î´ó¿í¶È£¬ ÒÔ¼°·Ç¹á´©ËºÁÑ×îСÉî¶È£¬ÓÃÓÚÂ˳ýµãÔÆ²¨¶¯ºÍÓêË¢Ô˶¯Ê±²úÉúµÄÐéÄâGap£¨ÖÐÐÅÖØ¹¤£© +std::string m_strVersion = "BeltTearing 1.0.1"; const char* sg_beltTearingVersion(void) { return m_strVersion.c_str(); @@ -226,7 +227,7 @@ void sg_bearTearing_vLineProc( } } } - if (end > start) //gap±ØÐë´óÓÚ0 + if (end > start+1) //gap±ØÐë´óÓÚ1 { //Éú³ÉÌØÕ÷ SSG_basicFeatureGap a_feature; @@ -324,10 +325,20 @@ void sg_bearTearing_vLineProc( } } //ÅÅÐò + gapFeatureNum = (int)vLineFeatures.size(); if (gapFeatureNum > 0) { - // - std::sort(vLineFeatures.begin(), vLineFeatures.end(), compareByStartY); + //¼ì²é¿í¶È + for (int i = gapFeatureNum - 1; i >= 0; i--) + { + if ( (vLineFeatures[i].gap_width > measureParam.tearingMaxYWidth) || + (vLineFeatures[i].gap_width < measureParam.tearingMinYWidth) || + ((vLineFeatures[i].gap_depth >= 0) && (vLineFeatures[i].gap_depth < measureParam.tearingMinDepth))) + vLineFeatures.erase(vLineFeatures.begin() + i); + } + gapFeatureNum = (int)vLineFeatures.size(); + if(gapFeatureNum > 0) + std::sort(vLineFeatures.begin(), vLineFeatures.end(), compareByStartY); } #endif return; diff --git a/sourceCode/beltTearingDetection_Export.h b/sourceCode/beltTearingDetection_Export.h index be9de09..4ffdbd2 100644 --- a/sourceCode/beltTearingDetection_Export.h +++ b/sourceCode/beltTearingDetection_Export.h @@ -6,7 +6,7 @@ #define ENABLE_CROSS_WISE_TEAR 0 #define OUTPUT_TEARING_POINTS 1 #define KEEP_GAP_AS_FEATURE 1 -#define SCAN_BUFF_SIZE 21 //»º´æÇø´óС£¬»º´æ21ÌõɨÃèÏߣ¬´¦ÀíÖмäɨÃèÏß +#define SCAN_BUFF_SIZE 3 //»º´æÇø´óС£¬»º´æ21ÌõɨÃèÏߣ¬´¦ÀíÖмäɨÃèÏß typedef struct { @@ -16,6 +16,10 @@ typedef struct SSG_tearFeatureExtactPara extractPara; double tearingMinLen; //×îС˺Áѳ¤¶È£¬´ïµ½´Ë³¤¶ÈʱÊä³ö˺ÁÑ double tearingMinGap; //Á½¸öͬλÖõÄ˺Áѵļä¸ô¡£Ð¡Óڴ˼ä¸ôʱ£¬ÊÓΪͬһ¸ö˺ÁÑ¡£ + + double tearingMinDepth; //¶ÔÓÚ·Ç´©Í¸ÐÍ˺Áѵļì²â×îСÉî¶È£¬ÓÃÓÚÂ˳ýµãÔÆ²¨¶¯ÐγɵÄÐé¼Ù˺ÁÑ + double tearingMinYWidth; //˺ÁÑÔÚY·½ÏòµÄ×îС¿í¶È£¬ ÓÃÓÚÂ˳ýµãÔÆ²¨¶¯ÐγɵÄÐé¼Ù˺ÁÑ + double tearingMaxYWidth; //˺ÁÑÔÚY·½ÏòµÄ×î´ó¿í¶È }SSG_beltTearingParam; typedef enum