GrabBag/App/ScrewPosition/ScrewPositionConfig/Src/AlgorithmParamConverter.cpp

40 lines
1.7 KiB
C++

#include "AlgorithmParamConverter.h"
ScrewDetectAlgorithmParams::ScrewDetectAlgorithmParams()
: rodDiameter(10.0)
, isHorizonScan(true)
, cornerParam()
, filterParam()
, growParam()
{
}
ScrewDetectAlgorithmParams AlgorithmParamConverter::ToScrewDetectAlgorithmParams(
const VrAlgorithmParams& algorithmParams)
{
ScrewDetectAlgorithmParams params;
params.rodDiameter = algorithmParams.screwParam.rodDiameter;
params.isHorizonScan = algorithmParams.screwParam.isHorizonScan;
params.cornerParam.minEndingGap = algorithmParams.cornerParam.minEndingGap;
params.cornerParam.minEndingGap_z = algorithmParams.cornerParam.minEndingGap_z;
// Keep the existing runtime behavior: the algorithm scale is derived from rod diameter.
params.cornerParam.scale = params.rodDiameter / 4.0;
params.cornerParam.cornerTh = algorithmParams.cornerParam.cornerTh;
params.cornerParam.jumpCornerTh_1 = algorithmParams.cornerParam.jumpCornerTh_1;
params.cornerParam.jumpCornerTh_2 = algorithmParams.cornerParam.jumpCornerTh_2;
params.growParam.yDeviation_max = algorithmParams.growParam.yDeviation_max;
params.growParam.zDeviation_max = algorithmParams.growParam.zDeviation_max;
params.growParam.maxLineSkipNum = algorithmParams.growParam.maxLineSkipNum;
params.growParam.maxSkipDistance = algorithmParams.growParam.maxSkipDistance;
params.growParam.minLTypeTreeLen = algorithmParams.growParam.minLTypeTreeLen;
params.growParam.minVTypeTreeLen = algorithmParams.growParam.minVTypeTreeLen;
params.filterParam.continuityTh = algorithmParams.filterParam.continuityTh;
params.filterParam.outlierTh = algorithmParams.filterParam.outlierTh;
return params;
}