39 yCError(RGBDSENSORPARAMPARSER) <<
"Check"<<param.
name<<
"in config file";
44 yCError(RGBDSENSORPARAMPARSER) <<
"Parameter" << param.
name <<
"size should be" << param.
size;
48 for (
size_t i=0;i<b->
size();i++)
65 bool ret1, ret2, ret3;
73 yCError(RGBDSENSORPARAMPARSER) <<
"Setting " << param.
name <<
" can either be a 'SETTING' or 'HW_DESCRIPTION', not both. Fix the config file. \
74 Look for documentation online.";
77 return (ret1 && ret2 && ret3);
84 pair<string, double*> realparam;
85 vector<pair<string, double*> > realParams;
88 if (!config.
check(groupName))
101 realparam.first =
"physFocalLength"; realparam.second = ¶ms.
physFocalLength; realParams.push_back(realparam);
102 realparam.first =
"focalLengthX"; realparam.second = ¶ms.
focalLengthX; realParams.push_back(realparam);
103 realparam.first =
"focalLengthY"; realparam.second = ¶ms.
focalLengthY; realParams.push_back(realparam);
104 realparam.first =
"principalPointX"; realparam.second = ¶ms.
principalPointX; realParams.push_back(realparam);
105 realparam.first =
"principalPointY"; realparam.second = ¶ms.
principalPointY; realParams.push_back(realparam);
107 for(i = 0; i < realParams.size(); i++)
109 if (!intrinsic.
check(realParams[i].first))
111 yCError(RGBDSENSORPARAMPARSER) <<
"Missing" << realParams[i].first <<
"param in" << groupName <<
"group in the configuration file";
115 *(realParams[i].second) = intrinsic.
find(realParams[i].first).
asFloat64();
118 if (!intrinsic.
check(
"distortionModel"))
120 yCError(RGBDSENSORPARAMPARSER) <<
"Missing distortionModel param in configuration";
126 yCError(RGBDSENSORPARAMPARSER) <<
"Missing" << intrinsic.
find(
"distortionModel").
asString() <<
"group in configuration file";
132 if (!distortion.
check(
"name"))
134 yCError(RGBDSENSORPARAMPARSER) <<
"Missing name param in" << config.
find(
"distortionModel").
asString() <<
"group in configuration file";
139 yCError(RGBDSENSORPARAMPARSER) <<
"Only plumb_bob distortion model is supported at the moment";
144 realparam.first =
"k1"; realparam.second = ¶ms.
distortionModel.
k1; realParams.push_back(realparam);
145 realparam.first =
"k2"; realparam.second = ¶ms.
distortionModel.
k2; realParams.push_back(realparam);
146 realparam.first =
"t1"; realparam.second = ¶ms.
distortionModel.
t1; realParams.push_back(realparam);
147 realparam.first =
"t2"; realparam.second = ¶ms.
distortionModel.
t2; realParams.push_back(realparam);
148 realparam.first =
"k3"; realparam.second = ¶ms.
distortionModel.
k3; realParams.push_back(realparam);
150 for(i = 0; i < realParams.size(); i++)
152 if (!distortion.
check(realParams[i].first))
154 yCError(RGBDSENSORPARAMPARSER) <<
"Missing" << realParams[i].first <<
"param in" << intrinsic.
find(
"distortionModel").
asString() <<
"group in the configuration file";
157 *(realParams[i].second) = distortion.
find(realParams[i].first).
asFloat64();
163 bool RGBDSensorParamParser::parseParam(
const Searchable &config, std::vector<RGBDParam*>& params)
167 if (!config.
check(
"SETTINGS"))
169 yCError(RGBDSENSORPARAMPARSER) <<
"Missing SETTINGS section on the configuration file";
175 if (!config.
check(
"HW_DESCRIPTION"))
177 yCError(RGBDSENSORPARAMPARSER) <<
"Missing HW_DESCRIPTION section on the configuration file";
184 for (
auto& v: params)
191 yCError(RGBDSENSORPARAMPARSER) <<
"Driver input file not correct, please fix it!";
195 if (!
parseIntrinsic(config,
"RGB_INTRINSIC_PARAMETERS", rgbIntrinsic))
197 yCError(RGBDSENSORPARAMPARSER) <<
"Incomplete or missing RGB_INTRINSIC_PARAMETERS section on the configuration file";
202 if (!
parseIntrinsic(config,
"DEPTH_INTRINSIC_PARAMETERS", depthIntrinsic))
204 yCError(RGBDSENSORPARAMPARSER) <<
"Incomplete or missing DEPTH_INTRINSIC_PARAMETERS section on the configuration file";
208 if (!config.
check(
"EXTRINSIC_PARAMETERS"))
210 if (!isOptionalExtrinsic)
212 yCError(RGBDSENSORPARAMPARSER) <<
"Missing EXTRINSIC_PARAMETERS section on the configuration file";
225 if (!extrinsic.
check(
"transformation"))
227 yCError(RGBDSENSORPARAMPARSER) <<
"Missing transformation parameter under EXTRINSIC_PARAMETERS group in configuration file";
234 if (transformation.
size()==1)
242 if (!(
tf->size() == 4*4))
244 yCError(RGBDSENSORPARAMPARSER) <<
"The size of the transformation matrix is wrong";
248 for(
int i = 0; i < 4; i++)
250 for(
int j = 0; j < 4; j++)
256 yCError(RGBDSENSORPARAMPARSER) <<
"Wrong data format on transformation matrix (position" << k <<
")";
259 transformationMatrix[i][j] = v.
asFloat64();