Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "ellipses_nodelet.h"
00032 #include "ellipses_nodelet_defaults.h"
00033
00034 using namespace tuw;
00035
00036 EllipsesDetectionNode::ParametersNode::ParametersNode()
00037 : Parameters()
00038 , node("~")
00039 , node_name(node.getNamespace())
00040 , debug_freeze(TUW_ELLIPSES_NODE_DEFAULT_DEBUG_FREEZE)
00041 , show_camera_image(TUW_ELLIPSES_NODE_DEFAULT_SHOW_CAMERA_IMAGE)
00042 , show_camera_image_waitkey(TUW_ELLIPSES_NODE_DEFAULT_SHOW_CAMERA_IMAGE_WAITKEY)
00043 , image_skip(TUW_ELLIPSES_NODE_DEFAULT_IMAGE_SKIP)
00044 , skip_second_tf(TUW_ELLIPSES_NODE_DEFAULT_SKIP_SECOND_TF)
00045 , tf_prefix(node_name)
00046 {
00047 node.getParam("debug_freeze", debug_freeze);
00048 ROS_INFO("%s - debug_freeze: %s", node_name.c_str(), (debug_freeze ? "true" : "false"));
00049 node.getParam("show_camera_image", show_camera_image);
00050 ROS_INFO("%s - show_camera_image: %s", node_name.c_str(), (show_camera_image ? "true" : "false"));
00051 node.getParam("show_camera_image_waitkey", show_camera_image_waitkey);
00052 ROS_INFO("%s - show_camera_image_waitkey: %i", node_name.c_str(), show_camera_image_waitkey);
00053 node.getParam("image_skip", image_skip);
00054 ROS_INFO("%s - image_skip: %i", node_name.c_str(), image_skip);
00055 node.param<std::string>("tf_prefix", tf_prefix, node_name);
00056 ROS_INFO("%s: tf_prefix: %s", node_name.c_str(), tf_prefix.c_str());
00057 node.getParam("skip_second_tf", skip_second_tf);
00058 ROS_INFO("%s - skip_second_tf: %s", node_name.c_str(), (skip_second_tf ? "true" : "false"));
00059
00060 reconfigureFnc_ = boost::bind(&EllipsesDetectionNode::ParametersNode::callbackParameters, this , _1, _2);
00061 reconfigureServer_.setCallback(reconfigureFnc_);
00062
00063
00064 }
00065
00066
00067 void EllipsesDetectionNode::ParametersNode::callbackParameters (tuw_ellipses::EllipsesDetectionConfig &config, uint32_t level ) {
00068 int kernal_sizes[] = {1, 3, 5, 7};
00069 show_camera_image = config.show_camera_image;
00070 show_camera_image_waitkey = config.show_camera_image_waitkey;
00071 debug = config.debug;
00072 distorted_input = config.distorted_input;
00073 debug_freeze = config.debug_freeze;
00074 image_skip = config.image_skip;
00075 edge_detection = (EdgeDetection) config.edge_detection;
00076 threshold_edge_detection1 = config.threshold_edge_detection1;
00077 threshold_edge_detection2 = config.threshold_edge_detection2;
00078 if(config.kernel_size_edge_detection > 7) kernel_size_edge_detection = 7;
00079 else if(config.kernel_size_edge_detection < 3) kernel_size_edge_detection = 3;
00080 else if(config.kernel_size_edge_detection % 2) kernel_size_edge_detection = config.kernel_size_edge_detection;
00081 else kernel_size_edge_detection = config.kernel_size_edge_detection+1;
00082 edge_linking = (EdgeLinking) config.edge_linking;
00083 threshold_contour_min_points = config.threshold_contour_min_points;
00084 threshold_polygon = config.threshold_polygon;
00085 filter_convex = config.filter_convex;
00086 ellipse_redefinement = config.ellipse_redefinement;
00087 threshold_rotated_rect_ratio = config.threshold_rotated_rect_ratio;
00088 filter_contour_mean = config.filter_contour_mean;
00089 threshold_min_radius = config.threshold_min_radius;
00090 threshold_max_radius = config.threshold_max_radius;
00091 filter_rings = config.filter_rings;
00092 threshold_ring_center = config.threshold_ring_center;
00093 threshold_ring_ratio = config.threshold_ring_ratio;
00094 pose_estimation = (PoseEstimation) config.pose_estimation;
00095 circle_diameter = config.circle_diameter;
00096 skip_second_tf = config.skip_second_tf;
00097
00098 }