From 4acb751647aa1495bd9d890d5153c5ba527376ab Mon Sep 17 00:00:00 2001 From: jerryzeng Date: Thu, 12 Mar 2026 23:05:59 +0800 Subject: [PATCH] =?UTF-8?q?wheelArchHeigthMeasure=20version=201.3.1=20:=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E4=B8=80=E4=B8=AA=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E8=BD=AE=E6=AF=82=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8=E7=9A=84?= =?UTF-8?q?=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BQ_workpieceCornerExtract_test.cpp | 16 ++++-- .../BQ_workpieceCornerExtract_test.vcxproj | 2 +- baseAlgorithm/baseAlgorithm.vcxproj | 6 +- sourceCode/SG_baseDataType.h | 3 + sourceCode/wheelArchHeigthMeasure.cpp | 34 ++++++++++- sourceCode/wheelArchHeigthMeasure_Export.h | 5 ++ .../wheelArchHeigthMeasure_test.cpp | 57 +++++++++++-------- .../wheelArchHeigthMeasure_test.vcxproj | 4 +- .../wheelArchHeigthMeaure.vcxproj | 4 +- 9 files changed, 92 insertions(+), 39 deletions(-) diff --git a/BQ_workpieceCornerExtract_test/BQ_workpieceCornerExtract_test.cpp b/BQ_workpieceCornerExtract_test/BQ_workpieceCornerExtract_test.cpp index 92f6c10..47272a9 100644 --- a/BQ_workpieceCornerExtract_test/BQ_workpieceCornerExtract_test.cpp +++ b/BQ_workpieceCornerExtract_test/BQ_workpieceCornerExtract_test.cpp @@ -743,7 +743,7 @@ int main() const char* ver = wd_BQWorkpieceCornerVersion(); printf("ver:%s\n", ver); - for (int grp = 8; grp <= 8; grp++) + for (int grp = 7; grp <= 7; grp++) { SSG_planeCalibPara poseCalibPara; //初始化成单位阵 @@ -765,7 +765,7 @@ int main() for (int fidx = fileIdx[grp].nMin; fidx <= fileIdx[grp].nMax; fidx++) { - fidx =7; + //fidx =2; char _scan_file[256]; if(0 == grp) sprintf_s(_scan_file, "%sscanData_%d_grid.txt", dataPath[grp], fidx); @@ -804,7 +804,7 @@ int main() } #if 0 char _out_file[256]; - sprintf_s(_out_file, "%s_%d_leveling.txt", dataPath[grp], fidx); + sprintf_s(_out_file, "%s%d_leveling.txt", dataPath[grp], fidx); int headNullLines = 0; _outputScanDataFile_vector(_out_file, scanLines, false, &headNullLines); #endif @@ -821,9 +821,9 @@ int main() filterParam.outlierTh = 5; SSG_treeGrowParam growParam; growParam.maxLineSkipNum = 10; - growParam.yDeviation_max = 10.0; - growParam.maxSkipDistance = 10.0; - growParam.zDeviation_max = 10.0;// algoParam.bagParam.bagH / 2; //袋子高度1/2 + growParam.yDeviation_max = 5.0; + growParam.maxSkipDistance = 5.0; + growParam.zDeviation_max = 5.0;// growParam.minLTypeTreeLen = 100; //mm growParam.minVTypeTreeLen = 100; //mm SSX_BQworkpiecePara workpieceParam; @@ -831,6 +831,10 @@ int main() workpieceParam.lineLen = 120; // 120.0; //直线段长度 else workpieceParam.lineLen = 160.0; //直线段长度 + workpieceParam.dirAngleScale = 20.0; //计算方向角的尺度 + workpieceParam.lineDeviation = 10.0;//直线偏离度。工作直线边缘由于扫描和切割导致波动,此参数用于描述此波动。 + workpieceParam.minCutAngleTh = 15; //最小截角。由于扫描不全导致的截角,当截角过小时无法区分真下的截角和由于点波动导致的角度波动 + int errCode = 0; std::vector debug_conturs; SSX_BQworkpieceResult workpieceCorner = sx_BQ_getWorkpieceCorners( diff --git a/BQ_workpieceCornerExtract_test/BQ_workpieceCornerExtract_test.vcxproj b/BQ_workpieceCornerExtract_test/BQ_workpieceCornerExtract_test.vcxproj index 5e10773..3fe390e 100644 --- a/BQ_workpieceCornerExtract_test/BQ_workpieceCornerExtract_test.vcxproj +++ b/BQ_workpieceCornerExtract_test/BQ_workpieceCornerExtract_test.vcxproj @@ -48,7 +48,7 @@ Application false - v142 + v143 true Unicode diff --git a/baseAlgorithm/baseAlgorithm.vcxproj b/baseAlgorithm/baseAlgorithm.vcxproj index 9633928..088da2a 100644 --- a/baseAlgorithm/baseAlgorithm.vcxproj +++ b/baseAlgorithm/baseAlgorithm.vcxproj @@ -48,7 +48,7 @@ DynamicLibrary false - v142 + v143 true Unicode @@ -78,12 +78,12 @@ true - ..\..\thirdParty\VzNLSDK\Inc;..\..\thirdParty\opencv320\build\include;..\sourceCode;..\sourceCode\inc;F:\ShangGu\ProductDev\AlgoDev\thirdParty\PCL 1.12.0\3rdParty\Eigen\eigen3;$(IncludePath) + ..\..\thirdParty\VzNLSDK\Inc;..\..\thirdParty\opencv320\build\include;..\sourceCode;..\sourceCode\inc;..\..\thirdParty\PCL 1.12.0\3rdParty\Eigen\eigen3;$(IncludePath) $(SolutionDir)build\$(Platform)\$(Configuration)\ false - ..\..\thirdParty\VzNLSDK\Inc;..\..\thirdParty\opencv320\build\include;..\sourceCode;..\sourceCode\inc;F:\ShangGu\ProductDev\AlgoDev\thirdParty\PCL 1.12.0\3rdParty\Eigen\eigen3;$(IncludePath) + ..\..\thirdParty\VzNLSDK\Inc;..\..\thirdParty\opencv320\build\include;..\sourceCode;..\sourceCode\inc;..\..\thirdParty\PCL 1.12.0\3rdParty\Eigen\eigen3;$(IncludePath) $(SolutionDir)build\$(Platform)\$(Configuration)\ diff --git a/sourceCode/SG_baseDataType.h b/sourceCode/SG_baseDataType.h index 8fc7e60..267b853 100644 --- a/sourceCode/SG_baseDataType.h +++ b/sourceCode/SG_baseDataType.h @@ -569,6 +569,7 @@ typedef struct int pntIdx; int forward_pntIdx; int backward_pntIdx; + int flag; SWD_polarPt point; }SSG_dirCornerAngle; @@ -600,6 +601,8 @@ typedef struct int L2_ptIndex; double cornerAngle; int cornerDir; + int flag; + SWD_polarPt point; }SWD_polarPeakInfo; typedef struct diff --git a/sourceCode/wheelArchHeigthMeasure.cpp b/sourceCode/wheelArchHeigthMeasure.cpp index 81f7f7e..d06fbe8 100644 --- a/sourceCode/wheelArchHeigthMeasure.cpp +++ b/sourceCode/wheelArchHeigthMeasure.cpp @@ -8,8 +8,9 @@ //version 1.0.0 : base version release to customer //version 1.1.0 : ü߶ //version 1.2.0 : ˵ƽֹת180 -//version 1.3.0 : Ѱµʹù̶޵ -std::string m_strVersion = "1.3.0"; +//version 1.3.0 : Ѱµʹù̶޵ +//version 1.3.1 : һǷڵĺ +std::string m_strVersion = "1.3.1"; const char* wd_wheelArchHeigthMeasureVersion(void) { return m_strVersion.c_str(); @@ -243,6 +244,35 @@ SVzNL3DPoint _getWheelArcFittingPoint( return fitPt; } + +bool wd_wheelPresenseDetection( + std::vector>& scanLines, + const SVzNL3DRangeD wheelRoi3d) +{ + int lines = (int)scanLines.size(); + int validPtNum = 0; + for (int line = 0; line < lines; line++) + { + std::vector< SVzNL3DPosition>& a_line = scanLines[line]; + int ptNum = (int)a_line.size(); + for (int i = 0; i < ptNum; i++) + { + SVzNL3DPoint& a_pt3D = a_line[i].pt3D; + if ( (a_pt3D.x > wheelRoi3d.xRange.min) && (a_pt3D.x < wheelRoi3d.xRange.max)&& + (a_pt3D.y > wheelRoi3d.yRange.min) && (a_pt3D.y < wheelRoi3d.yRange.max)&& + (a_pt3D.z > wheelRoi3d.zRange.min) && (a_pt3D.z < wheelRoi3d.zRange.max) && (a_pt3D.z> 1e-4)) + { + validPtNum++; + } + } + } + if (validPtNum > 1000) + return true; + else + return false; + +} + //ü߶Ȳ WD_wheelArchInfo wd_wheelArchHeigthMeasure( std::vector< std::vector>& scanLines, diff --git a/sourceCode/wheelArchHeigthMeasure_Export.h b/sourceCode/wheelArchHeigthMeasure_Export.h index 05af0bf..0f952de 100644 --- a/sourceCode/wheelArchHeigthMeasure_Export.h +++ b/sourceCode/wheelArchHeigthMeasure_Export.h @@ -33,6 +33,11 @@ SG_APISHARED_EXPORT void wd_horizonCamera_lineDataR( const double* camPoseR, double groundH); +//ˮƽʱ̬ƽȥ +SG_APISHARED_EXPORT bool wd_wheelPresenseDetection( + std::vector>& scanLine, + const SVzNL3DRangeD wheelRoi3d); + //ȡǵ㼰λϢ SG_APISHARED_EXPORT WD_wheelArchInfo wd_wheelArchHeigthMeasure( std::vector< std::vector>& scanLines, diff --git a/wheelArchHeigthMeasure_test/wheelArchHeigthMeasure_test.cpp b/wheelArchHeigthMeasure_test/wheelArchHeigthMeasure_test.cpp index 4d4fedb..20081c8 100644 --- a/wheelArchHeigthMeasure_test/wheelArchHeigthMeasure_test.cpp +++ b/wheelArchHeigthMeasure_test/wheelArchHeigthMeasure_test.cpp @@ -2762,19 +2762,8 @@ int main() //algoParam.filterParam.outlierTh = 5; long t1 = GetTickCount64(); - int lineNum = (int)scanData.size(); - for (int i = 0; i < lineNum; i++) - { - if (i == 14) - int kkk = 1; - //行处理 - //调平,去除地面 - wd_horizonCamera_lineDataR(scanData[i], poseCalibPara.planeCalib, poseCalibPara.planeHeight-5); - } -#if 0 //数据转存 - sprintf_s(_scan_file, "%sLaserLine%d_grid_RTadjust.txt", dataPath[grp], fidx); - _outputScanDataFile_self(_scan_file, scanData, 0, 0, 0); -#endif + + SVzNL3DRangeD wheelRoi3d = { {-1000, 1000}, {-2000, 2000}, {500, 2500} }; SSG_cornerParam cornerParam; cornerParam.cornerTh = 45; //45度角 cornerParam.scale = 50; // algoParam.bagParam.bagH / 8; // 15; // algoParam.bagParam.bagH / 8; @@ -2784,7 +2773,7 @@ int main() cornerParam.jumpCornerTh_2 = 60; SSG_lineSegParam lineSegPara; - lineSegPara.maxDist = 1.0; + lineSegPara.distScale = 1.0; lineSegPara.segGapTh_y = 5.0; //y方向间隔大于5mm认为是分段 lineSegPara.segGapTh_z = 10.0; //z方向间隔大于10mm认为是分段 @@ -2800,18 +2789,40 @@ int main() growParam.minLTypeTreeLen = 100; //mm growParam.minVTypeTreeLen = 100; //mm - int errCode = 0; - WD_wheelArchInfo wheelArcHeight = wd_wheelArchHeigthMeasure( - scanData, - cornerParam, - lineSegPara, - filterParam, - growParam, - poseCalibPara, - &errCode); + WD_wheelArchInfo wheelArcHeight; + memset(&wheelArcHeight, 0, sizeof(WD_wheelArchInfo)); + bool wheePresense = wd_wheelPresenseDetection( scanData, wheelRoi3d); + if (true == wheePresense) + { + int lineNum = (int)scanData.size(); + for (int i = 0; i < lineNum; i++) + { + if (i == 14) + int kkk = 1; + //行处理 + //调平,去除地面 + wd_horizonCamera_lineDataR(scanData[i], poseCalibPara.planeCalib, poseCalibPara.planeHeight - 5); + } +#if 0 //数据转存 + sprintf_s(_scan_file, "%sLaserLine%d_grid_RTadjust.txt", dataPath[grp], fidx); + _outputScanDataFile_self(_scan_file, scanData, 0, 0, 0); +#endif + + + int errCode = 0; + WD_wheelArchInfo wheelArcHeight = wd_wheelArchHeigthMeasure( + scanData, + cornerParam, + lineSegPara, + filterParam, + growParam, + poseCalibPara, + &errCode); + } long t2 = GetTickCount64(); + char _dbg_file[256]; #if 1 diff --git a/wheelArchHeigthMeasure_test/wheelArchHeigthMeasure_test.vcxproj b/wheelArchHeigthMeasure_test/wheelArchHeigthMeasure_test.vcxproj index fcd689d..20bf8d2 100644 --- a/wheelArchHeigthMeasure_test/wheelArchHeigthMeasure_test.vcxproj +++ b/wheelArchHeigthMeasure_test/wheelArchHeigthMeasure_test.vcxproj @@ -42,13 +42,13 @@ Application true - v142 + v143 Unicode Application false - v142 + v143 true Unicode diff --git a/wheelArchHeigthMeaure/wheelArchHeigthMeaure.vcxproj b/wheelArchHeigthMeaure/wheelArchHeigthMeaure.vcxproj index 77a77f5..566c8be 100644 --- a/wheelArchHeigthMeaure/wheelArchHeigthMeaure.vcxproj +++ b/wheelArchHeigthMeaure/wheelArchHeigthMeaure.vcxproj @@ -49,13 +49,13 @@ DynamicLibrary true - v142 + v143 Unicode DynamicLibrary false - v142 + v143 true Unicode