diff --git a/cfg/BlobDetector.cfg b/cfg/BlobDetector.cfg index fff635837eb0a58fe4f7613e60a2afe5f9d2f747..d184edb4effd5a70bc21fee54f28158533d28f53 100755 --- a/cfg/BlobDetector.cfg +++ b/cfg/BlobDetector.cfg @@ -41,7 +41,7 @@ gen = ParameterGenerator() #gen.add("velocity_scale_factor", double_t, 0, "Maximum velocity scale factor", 0.5, 0.0, 1.0) gen.add("get_filter", bool_t, 0, "Get current filter coeficients", False) gen.add("color_id", str_t, 0, "ID of the color", "") -gen.add("H_center", int_t, 0, "Hue window center", 90, 0, 180) +gen.add("H_center", int_t, 0, "Hue window center", 0, 0, 360) gen.add("H_window", int_t, 0, "Hue window width", 180, 0, 180) gen.add("S_center", int_t, 0, "Saturation window center", 128, 0, 256) gen.add("S_window", int_t, 0, "Saturation window width", 255, 0, 256) diff --git a/config/blue.yaml b/config/blue.yaml new file mode 100644 index 0000000000000000000000000000000000000000..aa0f35c372e31647a7c8fdcd47e79c1447561114 --- /dev/null +++ b/config/blue.yaml @@ -0,0 +1,9 @@ +color_id: blue +H_center: 240 +H_window: 10 +S_center: 255 +S_window: 10 +V_center: 102 +V_window: 10 +max_area: 100000 +min_area: 10 diff --git a/config/green.yaml b/config/green.yaml new file mode 100644 index 0000000000000000000000000000000000000000..05eee865293e549854c14e1271e1fc9114937611 --- /dev/null +++ b/config/green.yaml @@ -0,0 +1,9 @@ +color_id: green +H_center: 120 +H_window: 10 +S_center: 255 +S_window: 10 +V_center: 102 +V_window: 10 +max_area: 100000 +min_area: 10 diff --git a/config/red.yaml b/config/red.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6f10fda2bd7b7c732a019f3e1c0ce8aae2523a5d --- /dev/null +++ b/config/red.yaml @@ -0,0 +1,9 @@ +color_id: red +H_center: 0 +H_window: 10 +S_center: 255 +S_window: 10 +V_center: 102 +V_window: 10 +max_area: 100000 +min_area: 10 diff --git a/config/yellow.yaml b/config/yellow.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9981fdd7b325cc364f80c50e3f713d93a23bc5a4 --- /dev/null +++ b/config/yellow.yaml @@ -0,0 +1,9 @@ +color_id: yellow +H_center: 60 +H_window: 10 +S_center: 255 +S_window: 10 +V_center: 102 +V_window: 10 +max_area: 100000 +min_area: 10 diff --git a/package.xml b/package.xml index 221eb2e08d184d0017b1785a82cf45be32fe71d1..02f4ccd83e84e854a5db3c696d0524a9789463c3 100644 --- a/package.xml +++ b/package.xml @@ -43,14 +43,14 @@ <build_depend>iri_base_algorithm</build_depend> <build_depend>sensor_msgs</build_depend> <build_depend>image_transport</build_depend> - <build_depend>OpenCV</build_depend> + <!--<build_depend>OpenCV</build_depend>--> <build_depend>nodelet</build_depend> <build_depend>cv_bridge</build_depend> <build_depend>message_generation</build_depend> <run_depend>iri_base_algorithm</run_depend> <run_depend>sensor_msgs</run_depend> <run_depend>image_transport</run_depend> - <run_depend>OpenCV</run_depend> + <!--<run_depend>OpenCV</run_depend>--> <run_depend>nodelet</run_depend> <run_depend>cv_bridge</run_depend> <run_depend>message_runtime</run_depend> diff --git a/src/blob_detector_alg.cpp b/src/blob_detector_alg.cpp index 49f8f620d505fc836912efe4a36f0e62ceae982a..92565a6f115ef73e68068571342c3579911fdf0b 100644 --- a/src/blob_detector_alg.cpp +++ b/src/blob_detector_alg.cpp @@ -54,6 +54,7 @@ void BlobDetectorAlgorithm::config_update(Config& new_cfg, uint32_t level) this->v_max=this->config_.V_center+this->config_.V_window/2; this->params.minArea = this->config_.min_area; this->params.maxArea = this->config_.max_area; + ROS_INFO("Color_id: %s: H(%d,%d),S(%d,%d),V(%d,%d)", this->config_.color_id.c_str(), this->h_min, this->h_max, this->s_min, this->s_max, this->v_min, this->v_max); } this->unlock(); @@ -104,10 +105,10 @@ void BlobDetectorAlgorithm::get_filter(iri_blob_detector::hsv_filter &filter) this->lock(); filter.hue_center=(this->h_min+this->h_max); filter.hue_window=(this->h_max-this->h_min)*2; - filter.saturation_center=(this->h_min+this->s_max)/2; - filter.saturation_window=(this->h_max-this->s_min); - filter.value_center=(this->h_min+this->v_max)/2; - filter.value_window=(this->h_max-this->v_min); + filter.saturation_center=(this->s_min+this->s_max)/2; + filter.saturation_window=(this->s_max-this->s_min); + filter.value_center=(this->v_min+this->v_max)/2; + filter.value_window=(this->v_max-this->v_min); filter.blob_min_size=this->params.minArea; filter.blob_max_size=this->params.maxArea; this->unlock();