From 5df9b7b6281bbe1d7fd1637e41c343f2ec3042e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=B0=E4=BB=94?= Date: Tue, 6 Oct 2026 14:33:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:rodAndBarDetection:=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=A3=92=E6=9D=90=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8D=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E5=86=8D=E8=AE=A1=E7=AE=97=E6=96=99=E6=A1=86=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sourceCode/dataFitting.cpp | 3 ++- sourceCode/rodAndBarDetection.cpp | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sourceCode/dataFitting.cpp b/sourceCode/dataFitting.cpp index 26292e5..ec86a22 100644 --- a/sourceCode/dataFitting.cpp +++ b/sourceCode/dataFitting.cpp @@ -180,7 +180,8 @@ double fitCircleByLeastSquare( double r2 = radius * radius; for (int pId = 0; pId < N; ++pId) { e = abs(pow(pointArray[pId].x - center.x, 2) + pow(pointArray[pId].y - center.y, 2) - r2); -#if 0 if (e > err) { +#if 0 + if (e > err) { err = e; } #else diff --git a/sourceCode/rodAndBarDetection.cpp b/sourceCode/rodAndBarDetection.cpp index 8f16833..1b0181c 100644 --- a/sourceCode/rodAndBarDetection.cpp +++ b/sourceCode/rodAndBarDetection.cpp @@ -32,7 +32,8 @@ //version 1.4.0 : 矩森棒材抓取算法改进:(1)修正了两个棒材被识别成一根的问题(2)增强了对噪点的容忍度,增强了鲁棒性 //version 1.5.0 : 矩森棒材抓取算法改进:加强了对强噪声点云的处理 //version 1.6.0 : 矩森棒材抓取算法改进:添加了料筐信息提取和对边缘工件的判断 -std::string m_strVersion = "RodAndBarDetection_1.6.0"; +//version 1.6.1 : 矩森棒材抓取算法崩溃修复:没有棒材的情况不需要再计算料框信息 +std::string m_strVersion = "RodAndBarDetection_1.6.1"; const char* wd_rodAndBarDetectionVersion(void) { return m_strVersion.c_str(); @@ -3916,6 +3917,13 @@ void sx_rodPositioning( } } } + + if (rodInfo.empty()) + { + *errCode = SX_ERR_ZERO_OBJECTS; + return; + } + //(2)遮挡判断 //按高度排序 std::sort(rodInfo.begin(), rodInfo.end(), _commpareByCenterZ);