#include "AlgoParamConverter.h" #include "VrLog.h" namespace AlgoParamConverter { RansacPlaneSegmentationParams ToAlgoParam(const VrRansacPlaneSegmentationParam& param) { RansacPlaneSegmentationParams algo; algo.distanceThreshold = static_cast(param.distanceThreshold); algo.maxIterations = param.maxIterations; algo.minPlanePoints = param.minPlanePoints; algo.maxPlanes = param.maxPlanes; algo.growthZThreshold = static_cast(param.growthZThreshold); algo.minPlaneRatio = static_cast(param.minPlaneRatio); algo.maxNormalAngleDeg = static_cast(param.maxNormalAngleDeg); return algo; } SHoleDetectionParams ToAlgoParam(const VrHoleDetectionParam& param) { SHoleDetectionParams algo; algo.angleThresholdPos = static_cast(param.angleThresholdPos); algo.angleThresholdNeg = static_cast(param.angleThresholdNeg); algo.angleSearchDistance = static_cast(param.angleSearchDistance); algo.minPitDepth = static_cast(param.minPitDepth); algo.minRadius = static_cast(param.minRadius); algo.maxRadius = static_cast(param.maxRadius); algo.expansionSize1 = param.expansionSize1; algo.expansionSize2 = param.expansionSize2; algo.minVTransitionPoints = param.minVTransitionPoints; algo.jumpThresholdResidual = static_cast(param.jumpThresholdResidual); algo.gapJumpThresholdResidual = static_cast(param.gapJumpThresholdResidual); algo.maxGapPointsInLine = param.maxGapPointsInLine; algo.minFeatureSpan = static_cast(param.minFeatureSpan); algo.residualSmoothWindow = param.residualSmoothWindow; algo.slopeAngleThreshold = static_cast(param.slopeAngleThreshold); algo.edgeBoundaryFilterDist = static_cast(param.edgeBoundaryFilterDist); return algo; } SHoleFilterParams ToAlgoParam(const VrHoleFilterParam& param) { SHoleFilterParams algo; algo.maxEccentricity = static_cast(param.maxEccentricity); algo.minAngularCoverage = static_cast(param.minAngularCoverage); algo.maxRadiusFitRatio = static_cast(param.maxRadiusFitRatio); algo.minQualityScore = static_cast(param.minQualityScore); algo.maxPlaneResidual = static_cast(param.maxPlaneResidual); algo.maxAngularGap = static_cast(param.maxAngularGap); algo.minInlierRatio = static_cast(param.minInlierRatio); algo.minHoleDepth = static_cast(param.minHoleDepth); return algo; } void LogAlgoParams(const std::string& logTag, const RansacPlaneSegmentationParams& ransacParams, const SHoleDetectionParams& detectionParams, const SHoleFilterParams& filterParams, const double clibMatrix[16]) { LOG_INFO("%s clibMatrix: \n\t[%.3f, %.3f, %.3f, %.3f] \n\t[%.3f, %.3f, %.3f, %.3f] \n\t[%.3f, %.3f, %.3f, %.3f] \n\t[%.3f, %.3f, %.3f, %.3f]\n", logTag.c_str(), clibMatrix[0], clibMatrix[1], clibMatrix[2], clibMatrix[3], clibMatrix[4], clibMatrix[5], clibMatrix[6], clibMatrix[7], clibMatrix[8], clibMatrix[9], clibMatrix[10], clibMatrix[11], clibMatrix[12], clibMatrix[13], clibMatrix[14], clibMatrix[15]); LOG_INFO("%s RansacParams: distanceThreshold=%.2f, maxIterations=%d, minPlanePoints=%d, maxPlanes=%d, growthZThreshold=%.2f, minPlaneRatio=%.2f, maxNormalAngleDeg=%.1f\n", logTag.c_str(), ransacParams.distanceThreshold, ransacParams.maxIterations, ransacParams.minPlanePoints, ransacParams.maxPlanes, ransacParams.growthZThreshold, ransacParams.minPlaneRatio, ransacParams.maxNormalAngleDeg); LOG_INFO("%s DetectionParams: angleThresholdPos=%.1f, angleThresholdNeg=%.1f, angleSearchDistance=%.2f, minPitDepth=%.2f\n", logTag.c_str(), detectionParams.angleThresholdPos, detectionParams.angleThresholdNeg, detectionParams.angleSearchDistance, detectionParams.minPitDepth); LOG_INFO("%s DetectionParams: minRadius=%.2f, maxRadius=%.2f, expansionSize1=%d, expansionSize2=%d\n", logTag.c_str(), detectionParams.minRadius, detectionParams.maxRadius, detectionParams.expansionSize1, detectionParams.expansionSize2); LOG_INFO("%s DetectionParams: minVTransitionPoints=%d, jumpThresholdResidual=%.2f, gapJumpThresholdResidual=%.2f, maxGapPointsInLine=%d\n", logTag.c_str(), detectionParams.minVTransitionPoints, detectionParams.jumpThresholdResidual, detectionParams.gapJumpThresholdResidual, detectionParams.maxGapPointsInLine); LOG_INFO("%s DetectionParams: minFeatureSpan=%.2f, residualSmoothWindow=%d, slopeAngleThreshold=%.2f, edgeBoundaryFilterDist=%.2f\n", logTag.c_str(), detectionParams.minFeatureSpan, detectionParams.residualSmoothWindow, detectionParams.slopeAngleThreshold, detectionParams.edgeBoundaryFilterDist); LOG_INFO("%s FilterParams: maxEccentricity=%.5f, minAngularCoverage=%.1f, maxRadiusFitRatio=%.2f, minQualityScore=%.2f\n", logTag.c_str(), filterParams.maxEccentricity, filterParams.minAngularCoverage, filterParams.maxRadiusFitRatio, filterParams.minQualityScore); LOG_INFO("%s FilterParams: maxPlaneResidual=%.2f, maxAngularGap=%.2f, minInlierRatio=%.2f, minHoleDepth=%.2f\n", logTag.c_str(), filterParams.maxPlaneResidual, filterParams.maxAngularGap, filterParams.minInlierRatio, filterParams.minHoleDepth); } } // namespace AlgoParamConverter