修正了法向量因杂点导致的问题

This commit is contained in:
MaJunwei 2026-04-01 19:53:42 +08:00
parent 43da1ecf9d
commit 567765b702
4 changed files with 9 additions and 6 deletions

View File

@ -484,7 +484,7 @@ int ProcessSingleFile(const std::string& inputFile,
debugCallbacks.onHoleFitted = OnHoleFitted;
debugCallbacks.onSegmentPairsDetected = OnSegmentPairsDetected;
debugCallbacks.onLineAngleProfileDetected = nullptr;// OnLineAngleProfileDetected;
debugCallbacks.onPlanesSegmented = OnPlanesSegmented;
debugCallbacks.onPlanesSegmented = nullptr;// OnPlanesSegmented;
debugCallbacks.onMaskedPointsReady = nullptr;// OnMaskedPointsReady;
#else
debugCallbacks.onBoundaryDetected = nullptr;

View File

@ -296,6 +296,7 @@ int DetectMultipleHoles(
SHoleResult hole;
ret = hole_detection::internal::FitHoleFromExtremePoints(
maskedPoints.data(),
points,
rows,
cols,

View File

@ -251,7 +251,8 @@ int FitHolesFromClusters(
}
int FitHoleFromExtremePoints(
const SVzNLPointXYZ* points,
const SVzNLPointXYZ* mask_points,
const SVzNLPointXYZ* all_points,
int rows,
int cols,
const std::vector<SHoleBoundaryPoint>& extremePoints,
@ -261,7 +262,7 @@ int FitHoleFromExtremePoints(
int* errCode,
const SHoleDetectionDebugCallbacks* debugCallbacks
) {
if (points == nullptr || errCode == nullptr) {
if (mask_points == nullptr || errCode == nullptr) {
if (errCode) *errCode = HD_ERR_INVALID_INPUT;
return HD_ERR_INVALID_INPUT;
}
@ -303,7 +304,7 @@ int FitHoleFromExtremePoints(
continue;
}
int idx = r * cols + c;
const SVzNLPointXYZ& p = points[idx];
const SVzNLPointXYZ& p = mask_points[idx];
if (!IsValidPoint(p)) continue;
expandedPoints.push_back(p);
}
@ -657,7 +658,7 @@ int FitHoleFromExtremePoints(
float invNorm = static_cast<float>(1.0 / planeResidualNorm);
for (int r = innerMinRow; r <= innerMaxRow; r++) {
for (int c = innerMinCol; c <= innerMaxCol; c++) {
const SVzNLPointXYZ& pt = points[r * cols + c];
const SVzNLPointXYZ& pt = all_points[r * cols + c];
if (!IsValidPoint(pt)) continue;
float dx = pt.x - center.x;
float dy = pt.y - center.y;

View File

@ -86,7 +86,8 @@ int FitHolesFromClusters(
);
int FitHoleFromExtremePoints(
const SVzNLPointXYZ* points,
const SVzNLPointXYZ* mask_points,
const SVzNLPointXYZ* all_points,
int rows,
int cols,
const std::vector<SHoleBoundaryPoint>& extremePoints,