48 #include <visp/vpXmlConfigParserKeyPoint.h>
53 m_matchingFactorThreshold(2.0), m_matchingMethod(stdDistanceThreshold), m_matchingRatioThreshold(0.85), m_nbRansacIterations(200),
54 m_nbRansacMinInlierCount(100), m_ransacConsensusPercentage(20.0), m_ransacReprojectionError(6.0), m_ransacThreshold(0.001),
55 m_useRansacConsensusPercentage(false), m_useRansacVVS(false)
64 vpXmlConfigParserKeyPoint::init()
109 vpXmlConfigParserKeyPoint::readMainClass(xmlDocPtr doc, xmlNodePtr node)
111 bool detector_node =
false;
112 bool extractor_node =
false;
113 bool matcher_node =
false;
115 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
116 if(dataNode->type == XML_ELEMENT_NODE){
117 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
118 if(iter_data !=
nodeMap.end()){
119 switch (iter_data->second){
121 this->read_detector(doc, dataNode);
122 detector_node =
true;
126 this->read_extractor(doc, dataNode);
127 extractor_node =
true;
131 this->read_matcher(doc, dataNode);
136 this->read_ransac(doc, dataNode);
147 std::cout <<
"detector: name: "<< m_detectorName <<
" (default)" << std::endl;
150 if(!extractor_node) {
151 std::cout <<
"extractor: name: "<< m_extractorName <<
" (default)" << std::endl;
155 std::cout <<
"matcher: name: "<< m_matcherName <<
" (default)" << std::endl;
166 vpXmlConfigParserKeyPoint::read_detector(xmlDocPtr doc, xmlNodePtr node)
168 bool detector_name_node =
false;
170 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
171 if(dataNode->type == XML_ELEMENT_NODE) {
172 std::map<std::string, int>::iterator iter_data = this->
nodeMap.find((
char*) dataNode->name);
173 if (iter_data !=
nodeMap.end()) {
174 switch(iter_data->second) {
177 detector_name_node =
true;
187 if(!detector_name_node)
188 std::cout <<
"detector : Name : "<< m_detectorName <<
" (default)" << std::endl;
190 std::cout <<
"detector : Name : "<< m_detectorName << std::endl;
200 vpXmlConfigParserKeyPoint::read_extractor(xmlDocPtr doc, xmlNodePtr node)
202 bool extractor_name_node =
false;
204 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
205 if(dataNode->type == XML_ELEMENT_NODE) {
206 std::map<std::string, int>::iterator iter_data = this->
nodeMap.find((
char*) dataNode->name);
207 if (iter_data !=
nodeMap.end()) {
208 switch(iter_data->second) {
211 extractor_name_node =
true;
221 if(!extractor_name_node)
222 std::cout <<
"extractor : Name : "<< m_extractorName <<
" (default)" << std::endl;
224 std::cout <<
"extractor : Name : "<< m_extractorName << std::endl;
234 vpXmlConfigParserKeyPoint::read_matcher(xmlDocPtr doc, xmlNodePtr node)
236 bool matcher_name_node =
false;
237 bool matching_method_node =
false;
238 std::string matchingMethodName =
"stdDistanceThreshold";
239 bool matching_factor_threshold_node =
false;
240 bool matching_ratio_threshold_node =
false;
242 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
243 if(dataNode->type == XML_ELEMENT_NODE) {
244 std::map<std::string, int>::iterator iter_data = this->
nodeMap.find((
char*) dataNode->name);
245 if(iter_data !=
nodeMap.end()) {
246 switch(iter_data->second) {
249 matcher_name_node =
true;
256 std::map<std::string, int>::iterator iter_data2 =
nodeMap.find(matchingMethodName);
257 if(iter_data2 !=
nodeMap.end()) {
258 matching_method_node =
true;
259 switch(iter_data2->second) {
281 matching_method_node =
false;
290 matching_factor_threshold_node =
true;
295 matching_ratio_threshold_node =
true;
305 if(!matcher_name_node)
306 std::cout <<
"matcher : Name : "<< m_matcherName <<
" (default)" << std::endl;
308 std::cout <<
"matcher : Name : "<< m_matcherName <<std::endl;
310 if(!matching_method_node)
311 std::cout <<
"matcher : Filter method : "<< matchingMethodName <<
" (default)" << std::endl;
313 std::cout <<
"matcher : Filter method : "<< matchingMethodName << std::endl;
315 if(!matching_factor_threshold_node)
316 std::cout <<
"matcher : matching factor threshold : "<< m_matchingFactorThreshold <<
" (default)" << std::endl;
318 std::cout <<
"matcher : matching factor threshold : "<< m_matchingFactorThreshold << std::endl;
320 if(!matching_ratio_threshold_node)
321 std::cout <<
"matcher : matching ratio threshold : "<< m_matchingRatioThreshold <<
" (default)" << std::endl;
323 std::cout <<
"matcher : matching ratio threshold : "<< m_matchingRatioThreshold << std::endl;
333 vpXmlConfigParserKeyPoint::read_ransac(xmlDocPtr doc, xmlNodePtr node)
335 bool use_ransac_vvs_node =
false;
336 bool use_ransac_consensus_percentage_node =
false;
337 bool nb_ransac_iterations_node =
false;
338 bool ransac_reprojection_error_node =
false;
339 bool nb_ransac_min_inlier_count_node =
false;
340 bool ransac_threshold_node =
false;
341 bool ransac_consensus_percentage_node =
false;
343 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
344 if(dataNode->type == XML_ELEMENT_NODE) {
345 std::map<std::string, int>::iterator iter_data = this->
nodeMap.find((
char*) dataNode->name);
346 if(iter_data !=
nodeMap.end()) {
347 switch(iter_data->second) {
350 use_ransac_vvs_node =
true;
355 use_ransac_consensus_percentage_node =
true;
360 nb_ransac_iterations_node =
true;
365 ransac_reprojection_error_node =
true;
370 nb_ransac_min_inlier_count_node =
true;
375 ransac_threshold_node =
true;
380 ransac_consensus_percentage_node =
true;
390 if(!use_ransac_vvs_node)
391 std::cout <<
"ransac: use ransac vvs pose estimation: "<< m_useRansacVVS <<
" (default)" << std::endl;
393 std::cout <<
"ransac: use ransac vvs pose estimation: "<< m_useRansacVVS <<std::endl;
395 if(!use_ransac_consensus_percentage_node)
396 std::cout <<
"ransac: use consensus percentage: "<< m_useRansacConsensusPercentage <<
" (default)" << std::endl;
398 std::cout <<
"ransac: use consensus percentage: "<< m_useRansacConsensusPercentage <<std::endl;
400 if(!nb_ransac_iterations_node)
401 std::cout <<
"ransac: nb ransac iterations: "<< m_nbRansacIterations <<
" (default)" << std::endl;
403 std::cout <<
"ransac: nb ransac iterations: "<< m_nbRansacIterations <<std::endl;
405 if(!ransac_reprojection_error_node)
406 std::cout <<
"ransac: ransac reprojection error in pixel (for OpenCV function): "<< m_ransacReprojectionError <<
" (default)" << std::endl;
408 std::cout <<
"ransac: ransac reprojection error in pixel (for OpenCV function): "<< m_ransacReprojectionError <<std::endl;
410 if(!nb_ransac_min_inlier_count_node)
411 std::cout <<
"ransac: nb ransac min inlier count: "<< m_nbRansacMinInlierCount <<
" (default)" << std::endl;
413 std::cout <<
"ransac: nb ransac min inlier count: "<< m_nbRansacMinInlierCount <<std::endl;
415 if(!ransac_threshold_node)
416 std::cout <<
"ransac: ransac threshold in meter (for ViSP function): "<< m_ransacThreshold <<
" (default)" << std::endl;
418 std::cout <<
"ransac: ransac threshold in meter (for ViSP function): "<< m_ransacThreshold <<std::endl;
420 if(!ransac_consensus_percentage_node)
421 std::cout <<
"ransac: consensus percentage: "<< m_ransacConsensusPercentage <<
" (default)" << std::endl;
423 std::cout <<
"ransac: consensus percentage: "<< m_ransacConsensusPercentage <<std::endl;
426 #endif //VISP_HAVE_XML2
void setMainTag(const std::string &tag)
double xmlReadDoubleChild(xmlDocPtr doc, xmlNodePtr node)
int xmlReadIntChild(xmlDocPtr doc, xmlNodePtr node)
vpXmlConfigParserKeyPoint()
std::string xmlReadStringChild(xmlDocPtr doc, xmlNodePtr node)
std::map< std::string, int > nodeMap
void parse(const std::string &filename)
void parse(const std::string &filename)