35 #include <visp3/core/vpConfig.h> 42 #include <libxml/xmlmemory.h> 44 #include <visp3/mbt/vpMbtXmlGenericParser.h> 51 m_angleAppear(70), m_angleDisappear(80), m_hasNearClipping(false), m_nearClipping(false), m_hasFarClipping(false),
52 m_farClipping(false), m_fovClipping(false),
54 m_useLod(false), m_minLineLengthThreshold(50.0), m_minPolygonAreaThreshold(2500.0),
58 m_kltMaskBorder(0), m_kltMaxFeatures(0), m_kltWinSize(0), m_kltQualityValue(0.), m_kltMinDist(0.),
59 m_kltHarrisParam(0.), m_kltBlockSize(0), m_kltPyramidLevels(0),
62 m_depthNormalPclPlaneEstimationMethod(2), m_depthNormalPclPlaneEstimationRansacMaxIter(200),
63 m_depthNormalPclPlaneEstimationRansacThreshold(0.001), m_depthNormalSamplingStepX(2), m_depthNormalSamplingStepY(2),
65 m_depthDenseSamplingStepX(2), m_depthDenseSamplingStepY(2)
168 bool camera_node =
false;
169 bool face_node =
false;
170 bool ecm_node =
false;
171 bool klt_node =
false;
172 bool lod_node =
false;
173 bool depth_normal_node =
false;
174 bool depth_dense_node =
false;
176 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
177 if (dataNode->type == XML_ELEMENT_NODE) {
178 std::map<std::string, int>::const_iterator iter_data =
nodeMap.find((
char *)dataNode->name);
179 if (iter_data !=
nodeMap.end()) {
180 switch (iter_data->second) {
218 depth_normal_node =
true;
225 depth_dense_node =
true;
237 std::cout <<
"camera : u0 : " <<
m_cam.
get_u0() <<
" (default)" << std::endl;
238 std::cout <<
"camera : v0 : " <<
m_cam.
get_v0() <<
" (default)" << std::endl;
239 std::cout <<
"camera : px : " <<
m_cam.
get_px() <<
" (default)" << std::endl;
240 std::cout <<
"camera : py : " <<
m_cam.
get_py() <<
" (default)" << std::endl;
244 std::cout <<
"face : Angle Appear : " <<
m_angleAppear <<
" (default)" << std::endl;
245 std::cout <<
"face : Angle Disappear : " <<
m_angleDisappear <<
" (default)" << std::endl;
249 std::cout <<
"lod : use lod : " <<
m_useLod <<
" (default)" << std::endl;
255 std::cout <<
"ecm : mask : size : " <<
m_ecm.
getMaskSize() <<
" (default)" << std::endl;
256 std::cout <<
"ecm : mask : nb_mask : " <<
m_ecm.
getMaskNumber() <<
" (default)" << std::endl;
257 std::cout <<
"ecm : range : tracking : " <<
m_ecm.
getRange() <<
" (default)" << std::endl;
258 std::cout <<
"ecm : contrast : threshold : " <<
m_ecm.
getThreshold() <<
" (default)" << std::endl;
259 std::cout <<
"ecm : contrast : mu1 : " <<
m_ecm.
getMu1() <<
" (default)" << std::endl;
260 std::cout <<
"ecm : contrast : mu2 : " <<
m_ecm.
getMu2() <<
" (default)" << std::endl;
261 std::cout <<
"ecm : sample : sample_step : " <<
m_ecm.
getSampleStep() <<
" (default)" << std::endl;
265 std::cout <<
"klt : Mask Border : " <<
m_kltMaskBorder <<
" (default)" << std::endl;
266 std::cout <<
"klt : Max Features : " <<
m_kltMaxFeatures <<
" (default)" << std::endl;
267 std::cout <<
"klt : Windows Size : " <<
m_kltWinSize <<
" (default)" << std::endl;
268 std::cout <<
"klt : Quality : " <<
m_kltQualityValue <<
" (default)" << std::endl;
269 std::cout <<
"klt : Min Distance : " <<
m_kltMinDist <<
" (default)" << std::endl;
270 std::cout <<
"klt : Harris Parameter : " <<
m_kltHarrisParam <<
" (default)" << std::endl;
271 std::cout <<
"klt : Block Size : " <<
m_kltBlockSize <<
" (default)" << std::endl;
272 std::cout <<
"klt : Pyramid Levels : " <<
m_kltPyramidLevels <<
" (default)" << std::endl;
279 <<
" (default)" << std::endl;
281 <<
" (default)" << std::endl;
282 std::cout <<
"depth normal : PCL_plane_estimation : ransac_threshold : " 304 bool u0_node =
false;
305 bool v0_node =
false;
306 bool px_node =
false;
307 bool py_node =
false;
315 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
316 if (dataNode->type == XML_ELEMENT_NODE) {
317 std::map<std::string, int>::const_iterator iter_data =
nodeMap.find((
char *)dataNode->name);
318 if (iter_data !=
nodeMap.end()) {
319 switch (iter_data->second) {
350 std::cout <<
"camera : u0 : " <<
m_cam.
get_u0() <<
" (default)" << std::endl;
352 std::cout <<
"camera : u0 : " <<
m_cam.
get_u0() << std::endl;
355 std::cout <<
"camera : v0 : " <<
m_cam.
get_v0() <<
" (default)" << std::endl;
357 std::cout <<
"camera : v0 : " <<
m_cam.
get_v0() << std::endl;
360 std::cout <<
"camera : px : " <<
m_cam.
get_px() <<
" (default)" << std::endl;
362 std::cout <<
"camera : px : " <<
m_cam.
get_px() << std::endl;
365 std::cout <<
"camera : py : " <<
m_cam.
get_py() <<
" (default)" << std::endl;
367 std::cout <<
"camera : py : " <<
m_cam.
get_py() << std::endl;
380 bool feature_estimation_method_node =
false;
381 bool PCL_plane_estimation_node =
false;
382 bool sampling_step_node =
false;
384 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
385 if (dataNode->type == XML_ELEMENT_NODE) {
386 std::map<std::string, int>::const_iterator iter_data =
nodeMap.find((
char *)dataNode->name);
387 if (iter_data !=
nodeMap.end()) {
388 switch (iter_data->second) {
392 feature_estimation_method_node =
true;
397 PCL_plane_estimation_node =
true;
402 sampling_step_node =
true;
412 if (!feature_estimation_method_node)
418 if (!PCL_plane_estimation_node) {
420 <<
" (default)" << std::endl;
422 <<
" (default)" << std::endl;
423 std::cout <<
"depth normal : PCL_plane_estimation : ransac_threshold : " 427 if (!sampling_step_node) {
443 bool PCL_plane_estimation_method_node =
false;
444 bool PCL_plane_estimation_ransac_max_iter_node =
false;
445 bool PCL_plane_estimation_ransac_threshold_node =
false;
447 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
448 if (dataNode->type == XML_ELEMENT_NODE) {
449 std::map<std::string, int>::const_iterator iter_data =
nodeMap.find((
char *)dataNode->name);
450 if (iter_data !=
nodeMap.end()) {
451 switch (iter_data->second) {
454 PCL_plane_estimation_method_node =
true;
459 PCL_plane_estimation_ransac_max_iter_node =
true;
464 PCL_plane_estimation_ransac_threshold_node =
true;
474 if (!PCL_plane_estimation_method_node)
476 <<
" (default)" << std::endl;
481 if (!PCL_plane_estimation_ransac_max_iter_node)
483 <<
" (default)" << std::endl;
488 if (!PCL_plane_estimation_ransac_threshold_node)
489 std::cout <<
"depth normal : PCL_plane_estimation : ransac_threshold : " 492 std::cout <<
"depth normal : PCL_plane_estimation : ransac_threshold : " 506 bool sampling_step_X_node =
false;
507 bool sampling_step_Y_node =
false;
509 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
510 if (dataNode->type == XML_ELEMENT_NODE) {
511 std::map<std::string, int>::const_iterator iter_data =
nodeMap.find((
char *)dataNode->name);
512 if (iter_data !=
nodeMap.end()) {
513 switch (iter_data->second) {
516 sampling_step_X_node =
true;
521 sampling_step_Y_node =
true;
531 if (!sampling_step_X_node)
536 if (!sampling_step_Y_node)
552 bool sampling_step_node =
false;
554 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
555 if (dataNode->type == XML_ELEMENT_NODE) {
556 std::map<std::string, int>::const_iterator iter_data =
nodeMap.find((
char *)dataNode->name);
557 if (iter_data !=
nodeMap.end()) {
558 switch (iter_data->second) {
561 sampling_step_node =
true;
571 if (!sampling_step_node) {
587 bool sampling_step_X_node =
false;
588 bool sampling_step_Y_node =
false;
590 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
591 if (dataNode->type == XML_ELEMENT_NODE) {
592 std::map<std::string, int>::const_iterator iter_data =
nodeMap.find((
char *)dataNode->name);
593 if (iter_data !=
nodeMap.end()) {
594 switch (iter_data->second) {
597 sampling_step_X_node =
true;
602 sampling_step_Y_node =
true;
612 if (!sampling_step_X_node)
617 if (!sampling_step_Y_node)
633 bool mask_node =
false;
634 bool range_node =
false;
635 bool contrast_node =
false;
636 bool sample_node =
false;
638 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
639 if (dataNode->type == XML_ELEMENT_NODE) {
640 std::map<std::string, int>::const_iterator iter_data =
nodeMap.find((
char *)dataNode->name);
641 if (iter_data !=
nodeMap.end()) {
642 switch (iter_data->second) {
655 contrast_node =
true;
671 std::cout <<
"ecm : mask : size : " <<
m_ecm.
getMaskSize() <<
" (default)" << std::endl;
672 std::cout <<
"ecm : mask : nb_mask : " <<
m_ecm.
getMaskNumber() <<
" (default)" << std::endl;
676 std::cout <<
"ecm : range : tracking : " <<
m_ecm.
getRange() <<
" (default)" << std::endl;
679 if (!contrast_node) {
680 std::cout <<
"ecm : contrast : threshold " <<
m_ecm.
getThreshold() <<
" (default)" << std::endl;
681 std::cout <<
"ecm : contrast : mu1 " <<
m_ecm.
getMu1() <<
" (default)" << std::endl;
682 std::cout <<
"ecm : contrast : mu2 " <<
m_ecm.
getMu2() <<
" (default)" << std::endl;
686 std::cout <<
"ecm : sample : sample_step : " <<
m_ecm.
getSampleStep() <<
" (default)" << std::endl;
700 bool edge_threshold_node =
false;
701 bool mu1_node =
false;
702 bool mu2_node =
false;
709 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
710 if (dataNode->type == XML_ELEMENT_NODE) {
711 std::map<std::string, int>::const_iterator iter_data =
nodeMap.find((
char *)dataNode->name);
712 if (iter_data !=
nodeMap.end()) {
713 switch (iter_data->second) {
716 edge_threshold_node =
true;
740 if (!edge_threshold_node)
741 std::cout <<
"ecm : contrast : threshold " <<
m_ecm.
getThreshold() <<
" (default)" << std::endl;
746 std::cout <<
"ecm : contrast : mu1 " <<
m_ecm.
getMu1() <<
" (default)" << std::endl;
748 std::cout <<
"ecm : contrast : mu1 " <<
m_ecm.
getMu1() << std::endl;
751 std::cout <<
"ecm : contrast : mu2 " <<
m_ecm.
getMu2() <<
" (default)" << std::endl;
753 std::cout <<
"ecm : contrast : mu2 " <<
m_ecm.
getMu2() << std::endl;
766 bool size_node =
false;
767 bool nb_mask_node =
false;
773 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
774 if (dataNode->type == XML_ELEMENT_NODE) {
775 std::map<std::string, int>::const_iterator iter_data =
nodeMap.find((
char *)dataNode->name);
776 if (iter_data !=
nodeMap.end()) {
777 switch (iter_data->second) {
800 "parameter should be different " 801 "from zero in xml file"));
805 std::cout <<
"ecm : mask : size : " <<
m_ecm.
getMaskSize() <<
" (default)" << std::endl;
810 std::cout <<
"ecm : mask : nb_mask : " <<
m_ecm.
getMaskNumber() <<
" (default)" << std::endl;
825 bool tracking_node =
false;
830 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
831 if (dataNode->type == XML_ELEMENT_NODE) {
832 std::map<std::string, int>::const_iterator iter_data =
nodeMap.find((
char *)dataNode->name);
833 if (iter_data !=
nodeMap.end()) {
834 switch (iter_data->second) {
837 tracking_node =
true;
850 std::cout <<
"ecm : range : tracking : " <<
m_ecm.
getRange() <<
" (default)" << std::endl;
852 std::cout <<
"ecm : range : tracking : " <<
m_ecm.
getRange() << std::endl;
865 bool step_node =
false;
870 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
871 if (dataNode->type == XML_ELEMENT_NODE) {
872 std::map<std::string, int>::const_iterator iter_data =
nodeMap.find((
char *)dataNode->name);
873 if (iter_data !=
nodeMap.end()) {
874 switch (iter_data->second) {
890 std::cout <<
"ecm : sample : sample_step : " <<
m_ecm.
getSampleStep() <<
" (default)" << std::endl;
905 bool angle_appear_node =
false;
906 bool angle_disappear_node =
false;
907 bool near_clipping_node =
false;
908 bool far_clipping_node =
false;
909 bool fov_clipping_node =
false;
913 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
914 if (dataNode->type == XML_ELEMENT_NODE) {
915 std::map<std::string, int>::const_iterator iter_data =
nodeMap.find((
char *)dataNode->name);
916 if (iter_data !=
nodeMap.end()) {
917 switch (iter_data->second) {
920 angle_appear_node =
true;
925 angle_disappear_node =
true;
931 near_clipping_node =
true;
937 far_clipping_node =
true;
945 fov_clipping_node =
true;
955 if (!angle_appear_node)
956 std::cout <<
"face : Angle Appear : " <<
m_angleAppear <<
" (default)" << std::endl;
958 std::cout <<
"face : Angle Appear : " <<
m_angleAppear << std::endl;
960 if (!angle_disappear_node)
961 std::cout <<
"face : Angle Disappear : " <<
m_angleDisappear <<
" (default)" << std::endl;
965 if (near_clipping_node)
966 std::cout <<
"face : Near Clipping : " <<
m_nearClipping << std::endl;
968 if (far_clipping_node)
969 std::cout <<
"face : Far Clipping : " <<
m_farClipping << std::endl;
971 if (fov_clipping_node) {
973 std::cout <<
"face : Fov Clipping : True" << std::endl;
975 std::cout <<
"face : Fov Clipping : False" << std::endl;
989 bool mask_border_node =
false;
990 bool max_features_node =
false;
991 bool window_size_node =
false;
992 bool quality_node =
false;
993 bool min_distance_node =
false;
994 bool harris_node =
false;
995 bool size_block_node =
false;
996 bool pyramid_lvl_node =
false;
998 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
999 if (dataNode->type == XML_ELEMENT_NODE) {
1000 std::map<std::string, int>::const_iterator iter_data =
nodeMap.find((
char *)dataNode->name);
1001 if (iter_data !=
nodeMap.end()) {
1002 switch (iter_data->second) {
1005 mask_border_node =
true;
1010 max_features_node =
true;
1015 window_size_node =
true;
1020 quality_node =
true;
1025 min_distance_node =
true;
1035 size_block_node =
true;
1040 pyramid_lvl_node =
true;
1050 if (!mask_border_node)
1051 std::cout <<
"klt : Mask Border : " <<
m_kltMaskBorder <<
" (default)" << std::endl;
1055 if (!max_features_node)
1056 std::cout <<
"klt : Max Features : " <<
m_kltMaxFeatures <<
" (default)" << std::endl;
1060 if (!window_size_node)
1061 std::cout <<
"klt : Windows Size : " <<
m_kltWinSize <<
" (default)" << std::endl;
1063 std::cout <<
"klt : Windows Size : " <<
m_kltWinSize << std::endl;
1066 std::cout <<
"klt : Quality : " <<
m_kltQualityValue <<
" (default)" << std::endl;
1070 if (!min_distance_node)
1071 std::cout <<
"klt : Min Distance : " <<
m_kltMinDist <<
" (default)" << std::endl;
1073 std::cout <<
"klt : Min Distance : " <<
m_kltMinDist << std::endl;
1076 std::cout <<
"klt : Harris Parameter : " <<
m_kltHarrisParam <<
" (default)" << std::endl;
1080 if (!size_block_node)
1081 std::cout <<
"klt : Block Size : " <<
m_kltBlockSize <<
" (default)" << std::endl;
1083 std::cout <<
"klt : Block Size : " <<
m_kltBlockSize << std::endl;
1085 if (!pyramid_lvl_node)
1086 std::cout <<
"klt : Pyramid Levels : " <<
m_kltPyramidLevels <<
" (default)" << std::endl;
1093 bool use_lod_node =
false;
1094 bool min_line_length_threshold_node =
false;
1095 bool min_polygon_area_threshold_node =
false;
1097 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
1098 if (dataNode->type == XML_ELEMENT_NODE) {
1099 std::map<std::string, int>::const_iterator iter_data =
nodeMap.find((
char *)dataNode->name);
1100 if (iter_data !=
nodeMap.end()) {
1101 switch (iter_data->second) {
1104 use_lod_node =
true;
1109 min_line_length_threshold_node =
true;
1114 min_polygon_area_threshold_node =
true;
1125 std::cout <<
"lod : use lod : " <<
m_useLod <<
" (default)" << std::endl;
1127 std::cout <<
"lod : use lod : " <<
m_useLod << std::endl;
1129 if (!min_line_length_threshold_node)
1134 if (!min_polygon_area_threshold_node)
1150 bool step_node =
false;
1156 for (xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
1157 if (dataNode->type == XML_ELEMENT_NODE) {
1158 std::map<std::string, int>::const_iterator iter_data =
nodeMap.find((
char *)dataNode->name);
1159 if (iter_data !=
nodeMap.end()) {
1160 switch (iter_data->second) {
1176 std::cout <<
"[DEPRECATED] sample : sample_step : " <<
m_ecm.
getSampleStep() <<
" (default)" << std::endl;
1178 std::cout <<
"[DEPRECATED] sample : sample_step : " <<
m_ecm.
getSampleStep() << std::endl;
1180 std::cout <<
" WARNING : This node (sample) is deprecated." << std::endl;
1181 std::cout <<
" It should be moved in the ecm node (ecm : sample)." << std::endl;
1184 #elif !defined(VISP_BUILD_SHARED_LIBS) 1187 void dummy_vpMbtXmlGenericParser(){};
unsigned int m_kltWinSize
Windows size.
unsigned int m_depthDenseSamplingStepX
Sampling step in X.
bool m_hasNearClipping
Is near clipping distance specified?
double m_minLineLengthThreshold
Minimum line length to track a segment when LOD is enabled.
void read_klt(xmlDocPtr doc, xmlNodePtr node)
void setMainTag(const std::string &tag)
void parse(const std::string &filename)
virtual void readMainClass(xmlDocPtr doc, xmlNodePtr node)
void setMaskNumber(const unsigned int &a)
int m_depthNormalPclPlaneEstimationMethod
PCL plane estimation method.
void read_depth_normal_sampling_step(xmlDocPtr doc, xmlNodePtr node)
double m_angleDisappear
Angle to determine if a face disappeared.
void setSampleStep(const double &s)
error that can be emited by ViSP classes.
virtual ~vpMbtXmlGenericParser()
bool m_useLod
If true, the LOD is enabled, otherwise it is not.
double xmlReadDoubleChild(xmlDocPtr doc, xmlNodePtr node)
double m_nearClipping
Near clipping distance.
unsigned int m_depthDenseSamplingStepY
Sampling step in Y.
void writeMainClass(xmlNodePtr node)
unsigned int getMaskSize() const
void read_lod(xmlDocPtr doc, xmlNodePtr node)
void setMu1(const double &mu_1)
void read_depth_normal_PCL(xmlDocPtr doc, xmlNodePtr node)
unsigned int m_kltBlockSize
Block size.
int m_depthNormalPclPlaneEstimationRansacMaxIter
PCL RANSAC maximum number of iterations.
void initPersProjWithoutDistortion(const double px, const double py, const double u0, const double v0)
void read_ecm_range(xmlDocPtr doc, xmlNodePtr node)
double m_kltMinDist
Minimum distance between klt points.
unsigned int m_depthNormalSamplingStepX
Sampling step in X.
void read_camera(xmlDocPtr doc, xmlNodePtr node)
void read_ecm_sample(xmlDocPtr doc, xmlNodePtr node)
unsigned int m_depthNormalSamplingStepY
Sampling step in Y.
double getThreshold() const
void setMaskSize(const unsigned int &a)
double getSampleStep() const
double m_kltQualityValue
Quality of the Klt points.
void read_depth_dense_sampling_step(xmlDocPtr doc, xmlNodePtr node)
bool m_fovClipping
Fov Clipping.
vpMbtFaceDepthNormal::vpFeatureEstimationType m_depthNormalFeatureEstimationMethod
Feature estimation method.
int xmlReadIntChild(xmlDocPtr doc, xmlNodePtr node)
unsigned int getMaskNumber() const
vpCameraParameters m_cam
Camera parameters.
double m_farClipping
Near clipping distance.
double m_minPolygonAreaThreshold
Minimum polygon area to track a face when LOD is enabled.
double m_depthNormalPclPlaneEstimationRansacThreshold
PCL RANSAC threshold.
vpParserType m_parserType
Parser type.
unsigned int xmlReadUnsignedIntChild(xmlDocPtr doc, xmlNodePtr node)
void setMu2(const double &mu_2)
unsigned int m_kltMaskBorder
Border of the mask used on Klt points.
vpMbtXmlGenericParser(const vpParserType &type=EDGE_PARSER)
void setThreshold(const double &t)
unsigned int m_kltPyramidLevels
Number of pyramid levels.
void read_ecm(xmlDocPtr doc, xmlNodePtr node)
void read_sample_deprecated(xmlDocPtr doc, xmlNodePtr node)
double m_kltHarrisParam
Harris free parameters.
void read_ecm_contrast(xmlDocPtr doc, xmlNodePtr node)
void setRange(const unsigned int &r)
void read_ecm_mask(xmlDocPtr doc, xmlNodePtr node)
unsigned int m_kltMaxFeatures
Maximum of Klt features.
void read_depth_normal(xmlDocPtr doc, xmlNodePtr node)
double m_angleAppear
Angle to determine if a face appeared.
vpMe m_ecm
Moving edges parameters.
std::map< std::string, int > nodeMap
unsigned int getRange() const
bool m_hasFarClipping
Is far clipping distance specified?
void read_face(xmlDocPtr doc, xmlNodePtr node)
void read_depth_dense(xmlDocPtr doc, xmlNodePtr node)
void parse(const std::string &filename)