1.0.3增加了点到平面的参数调整

This commit is contained in:
cool609 2026-04-07 22:56:18 +08:00
parent cced2a9646
commit 0d88858738
4 changed files with 10 additions and 3 deletions

5
.gitignore vendored
View File

@ -1,4 +1,7 @@
.claude
nul
build
Algo/DetectHole/Export/
Algo/DetectHole/Export
Algo/DetectBarIntersection/build
Algo/DetectBarIntersection/data
Algo/DetectBarIntersection/Export

View File

@ -16,6 +16,8 @@ struct RansacPlaneSegmentationParams {
float minPlaneRatio; // 平面最小点数占比 (相对最大平面), 建议 0.05-0.2
float maxNormalAngleDeg; // 平面法向量与Z轴最大夹角 (度), 超过则直接丢弃; <=0 表示不过滤
float maxDistFromPlane; // 点到平面的最大允许距离;超出则从 pointIndices 中移除;<=0 表示不过滤
RansacPlaneSegmentationParams()
: distanceThreshold(0.5f)
, maxIterations(500)
@ -24,6 +26,7 @@ struct RansacPlaneSegmentationParams {
, growthZThreshold(1.0f)
, minPlaneRatio(0.1f)
, maxNormalAngleDeg(30.0f)
, maxDistFromPlane(1.f)
{
}
};

View File

@ -12,7 +12,7 @@
namespace {
const static char* g_algo_name = "DetectHole";
const static char* g_algo_ver = "1.0.2";
const static char* g_algo_ver = "1.0.3";
void PrintHoleResult(const SHoleResult& hole, int index) {
@ -196,6 +196,7 @@ int DetectMultipleHoles(
// ============ Step 2: 法向量过滤 ============
NormalFilterParams normalParams;
normalParams.maxDistFromPlane = ransacParams.maxDistFromPlane;
FilterPlanesByNormal(planes, normalParams, points, totalPointCount);
// 如果没有找到有效平面,回退到处理整个点云

View File

@ -298,7 +298,7 @@ struct NormalFilterParams {
, refNx(0.0f)
, refNy(0.0f)
, refNz(1.0f)
, maxDistFromPlane(2.0f)
, maxDistFromPlane(0.0f)
{}
};