修复找点的bug

This commit is contained in:
MaJunwei 2026-03-31 15:30:44 +08:00
parent df8bf74c7a
commit 25ee49a2f1
2 changed files with 10 additions and 14 deletions

View File

@ -402,7 +402,6 @@ void OnPlanesSegmented(const SPlaneSegmentInfo* planes, int planeCount,
// Callback: Masked points ready for a plane
void OnMaskedPointsReady(const SVzNLPointXYZ* points, int rows, int cols,
int planeIndex, void* userData) {
return;
CallbackUserData* data = static_cast<CallbackUserData*>(userData);
if (!data) {
return;
@ -479,12 +478,12 @@ int ProcessSingleFile(const std::string& inputFile,
SHoleDetectionDebugCallbacks debugCallbacks;
debugCallbacks.onBoundaryDetected = OnBoundaryDetected;
debugCallbacks.onClustersFound = nullptr;// OnClustersFound;
debugCallbacks.onExpandedRegion = nullptr;// OnExpandedRegion;
debugCallbacks.onClustersFound = OnClustersFound;
debugCallbacks.onExpandedRegion = OnExpandedRegion;
debugCallbacks.onHoleFitted = nullptr;// OnHoleFitted;
debugCallbacks.onSegmentPairsDetected = OnSegmentPairsDetected;
debugCallbacks.onLineAngleProfileDetected = OnLineAngleProfileDetected;
debugCallbacks.onPlanesSegmented = OnPlanesSegmented;
debugCallbacks.onLineAngleProfileDetected = nullptr;// OnLineAngleProfileDetected;
debugCallbacks.onPlanesSegmented = nullptr;// OnPlanesSegmented;
debugCallbacks.onMaskedPointsReady = OnMaskedPointsReady;
debugCallbacks.userData = &callbackData;
@ -586,6 +585,7 @@ int main(int argc, char* argv[]) {
// Set up detection parameters (using defaults from constructor)
SHoleDetectionParams detectionParams;
detectionParams.minRadius = 0.5f;
SHoleFilterParams filterParams;
std::cout << "=== Hole Detection Visualization Demo ===" << std::endl;

View File

@ -392,15 +392,11 @@ void EvaluateLine(
float span = planeDist(pts[startPos].point, pts[endPos].point);
if (span < params.minFeatureSpan) continue;
// 纯空洞特征:检查总 Gap 点数
if (isGapFeature && !isPit) {
int totalGapPts = 0;
for (size_t gi = si + 1; gi < bestExit; gi++) {
if (segs[gi].type == ESegType::Gap)
totalGapPts += segs[gi].endPos - segs[gi].startPos + 1;
}
if (totalGapPts > params.maxGapPointsInLine) continue;
}
// 纯空洞特征:检查物理跨度不超过最大孔洞直径
// 原先用点数maxGapPointsInLine过滤但点数与传感器密度相关
// 导致真实孔洞在点密度较低或孔洞稍大时被误杀(如 33 点 gap ≈ 12mm 被 12 点上限拒绝)。
// 改用物理跨度与 maxRadius 比较,保证检测上限与孔洞尺寸参数一致。
if (isGapFeature && !isPit && span > params.maxRadius * 2.0f) continue;
SSegmentPair pair;
pair.startPoint = pts[startPos].point;