From 63e951c4640e75c6897c08282cbd6b24234fc71e Mon Sep 17 00:00:00 2001
From: Sergi Hernandez Juan <shernand@iri.upc.edu>
Date: Wed, 13 Jun 2018 17:54:02 +0200
Subject: [PATCH] Changed the range of the Hue parameters to (0,180). Commented
 out the vendor, product and serial parameters of the usb_cam node to take the
 first compatible USB camera found.

---
 .README.mk.swp              | Bin 0 -> 16384 bytes
 README.mk                   |  87 ++++++++++++++++++++++++++++++++++++
 cfg/BlobDetector.cfg        |   4 +-
 launch/blob_detector.launch |   4 +-
 4 files changed, 91 insertions(+), 4 deletions(-)
 create mode 100644 .README.mk.swp
 create mode 100644 README.mk

diff --git a/.README.mk.swp b/.README.mk.swp
new file mode 100644
index 0000000000000000000000000000000000000000..8aa0ba1a6cdd75205cb6f12bafd3bbfdfe065d49
GIT binary patch
literal 16384
zcmeI3ON<;>6^1JzJdB;hBCx-<K^Z$U-S*ffmg5-N9w#0o%g7TCv9R4#SKscwxVoxc
zw`v}UI6NdE3QG_HHi?u7Snw1qSO6=K0umrVC=rB*5DQqvJVYQ1_|C1WevHRsPsWNM
zs+NAYyXrp9{qH&Fo^z_ExqE*0q`J4Z&*QVz^L}>!w)g$x?)TjCwkglEU7bXJ)RJ3k
zeP&P3?m4i3trq#c%jJM|tNpYd_~}IxH5P3nvpT8UB&eIjG@4=DY_xQ$gEUU+r;i_*
zIeEO+yLkQKs}>al6$95|AWPd*2X6QFPVd<*O?GVGrtW&nnQOJKu2&3H3{(tM3{(tM
z3{(tM3{(tM47>&zNc*>XkFu^?i?vM_-?yyzeqHhVp5mMGfcuo~il5b2#X!YC#X!YC
z#X!YC#X!YC#X!YC#X!YC#X!Zt{~!ZCPxoJVgXewujR?o{|1$so>z$r=1$+!_1<%~!
zc^?HI0h_^<+dc0^@CWdF@J;XyFawT(e{J!+m%v}ZpTYOR_rQC>8Stykp7#`Z64b#<
zZ}z-@f=_@Q;JceV?^ED$@Cf)2*b43hPrS+VJ_{zm-9ThN%k_EiZZHe(2Zz9JF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VBg%3w}us|84Lskbrq`2D}5j9ekZ!{%hbqa1d+))u&>hVxVH+HO{~~YlX0}
z&K@_Ry7>Pw>6%h*oVGQGr&_Y{8RE6dzSo=nrk0gAFxdvWu2ueCZCIBBB(Y7hNF|rj
zMxJ^t7`?dSCl5%B?T7xd3xvtdhWSJ$HCK08VsNPtxUk;pJoF}5&q9|<N)TKG%`RUh
zw;=-=nSHd<AkvKd_PkRO@vRKuqI`mNWR945Qt?-q?#5~bi&7+sCxfmZk%h$(rNF$0
zq<%$MO}S|p+#=c8ICG_ua&SqST_D;h(+4Tx4YCe~*S<9*4}(%{1c}RjFI=VSSBBcG
zLRM4rJozFuCP~vvee&!)h?eIZ^e2rjYVcANb2*G3Qa^5ys^lcN%-Ln}<sYCn=ur#(
zEDE|(Y-1)@5~esqYz>Rl%Y50F;iB`>S*@N|d+J4lhHGGJZY7ck<YN};>KK8fM2Jq&
zBN!yXQkQe7&7@2p67Rdo7s##RWK!~iR>orv8J9n$HGViIPf-FaGnX=xbPABh9nCtD
zVS<y{CVSHx>`75Q%jL~iFG>DDUD_t0#BpZsXeq7KGEmGW&kx$JC{ajjmu;$hH8tBN
zRTGsRBl=Y)S&h{W%4as|Vq9#DTc|4=ln-J=gWWS21dn4YPh)l!S(uujgcG8;sVYk0
zYHw}#&e18Zt|qoL864%U!03FQnUM=_a8g&QN!njo?=4eWcMo#&a$s5DDz~|)FQL*R
zC@JykW0k40%yR={xxsP+zD}`Dtiv@dot0Dp@_LQbcd#TF9X@(<CNM1bVarH8zn+rw
uiqv{tMdv}0dwv5o_7wsYs~vcTHOlK!WtIB=ItuI~b%o&!dH;1x?EM!{;pFoG

literal 0
HcmV?d00001

diff --git a/README.mk b/README.mk
new file mode 100644
index 0000000..3f0d730
--- /dev/null
+++ b/README.mk
@@ -0,0 +1,87 @@
+# Description
+
+This ROS node implements the BlobDetector provided in OpenCV. Each input image is trasformed to the HSV color
+space and then filtered with the desired maximum and minimum values for the Hue, Saturation and Value parameters. 
+Then all the connected regions within a desired maximum and minimum sizes are detected and published. The 
+segmented image is also published.
+
+This ROS node does not require the camera to be calibrated, however it is highly recommended. Follow the calibration 
+procedure presented here.
+
+## subscribers
+
+This node subscribes to the following topics:
+
+ * ~/image_in/camera_info (sensor_msgs/CameraInfo.msg): provides the calibration information for the camera.
+
+ * ~/image_in/image_raw (sensor_msgs/Image.msg): The input image itself. 
+
+## publishers
+
+This node publishes the following topics:
+
+ * ~/image_out/camera_info (sensor_msgs/CameraInfo.msg): the same camera information message received.
+	
+ * ~/image_out/image_raw (sensor_msgs/Image.msg): a black and white image with the segmented regions. The segmented blobs will
+appear as balck regions, being the background white.
+
+ * ~/blobs (iri_blob_detector/blob_array.msg): a list of all the connected regions that comply with the desired 
+parameters. The information provided for each blob is:
+
+    ** id (string): the identifier of each blob is build from the color_id parameter and the index of the blob.
+    ** center_x (unsigned int): position in pixels of the center of the blob in the image (x axis).
+    ** center_y (unsigned int): position in pixels of the center of the blob in the image (y axis).  
+    ** size (float): Size of the blob in pixels.
+
+## parameters
+
+This node has the following parameters. These parameters can be modified with the dynamic reconfigure tool.
+
+ * H_center (integer): the desierd window center value for the Hue parameter. This parameter is defined from 0 to 180.
+
+ * H_window (integer): the desired width of the Hue parameter window. This parameter is defined from 0 to 180.
+
+ * S_center (integer): the desierd window center value for the Saturation parameter. This parameter is defined from 0 to 255.
+
+ * S_window (integer): the desired width of the Saturation parameter window. This parameter is defined from 0 to 255.
+  
+ * V_center (integer): the desierd window center value for the Value parameter. This parameter is defined from 0 to 255.
+
+ * V_window (integer): the desired width of the Value parameter window. This parameter is defined from 0 to 255.
+
+ * color_id (string): the identifier of the color segmented. This name is used for the blob identifier.
+  
+ * max_area (integer): the maximum area in pixels of the desired regions.
+ 
+ * min_area (integer): the minimum area in pixels of the desired regions.
+
+# Dependencies
+
+This node has the following dependencies:
+
+ * OpenCV (at least version 3.0)
+
+ * boost
+
+# How to use it
+
+This node provides two launch files:
+
+ * blob_detector.launch: this file load the default parameters from ./config/default_params.yaml and launches the blob detector 
+node together with the usb_cam ROS node. This launch file will use the first USB camera compatible found in the system. If a 
+specific camera is desired, fill in the vendor, product and serial parameters for the desired camera.
+
+ * blob_detector_sim.launch: this file load the default parameters from ./config/default_params.yaml and launches the blob detector
+node, but expects the model car simulator to be already running.
+
+You can use the iri_color_calibration ROS node to easily generate new yaml configuration files for this node.
+
+Once the node is running, use the dynamic reconfigure ROS tool to change online the blob detector parameters:
+
+ * rosrun rqt_reconfigure rqt_reconfigure
+
+Display the output image using the ROS tools to see the result of the segmentation:
+
+ * rosrun rqt_image_view rqt_image_view
+
+
diff --git a/cfg/BlobDetector.cfg b/cfg/BlobDetector.cfg
index 6773391..fff6358 100755
--- a/cfg/BlobDetector.cfg
+++ b/cfg/BlobDetector.cfg
@@ -41,8 +41,8 @@ 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",              150,      0,    360)
-gen.add("H_window",                int_t,  0,                                  "Hue window width",               100,      0,    360)
+gen.add("H_center",                int_t,  0,                                  "Hue window center",              90,       0,    180)
+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)
 gen.add("V_center",                int_t,  0,                                  "Value window center",            128,      0,    256)
diff --git a/launch/blob_detector.launch b/launch/blob_detector.launch
index 9562a8c..501979e 100644
--- a/launch/blob_detector.launch
+++ b/launch/blob_detector.launch
@@ -6,9 +6,9 @@
   <group ns="usb_cam">
     <node pkg="libuvc_camera" type="camera_node" name="mycam">
       <!-- Parameters used to find the camera -->
-      <param name="vendor" value="0x046d"/>
+<!--      <param name="vendor" value="0x046d"/>
       <param name="product" value="0x0802"/>
-      <param name="serial" value="BEE76360"/>
+      <param name="serial" value="BEE76360"/>-->
       <!-- If the above parameters aren't unique, choose the first match: -->
       <param name="index" value="0"/>
 
-- 
GitLab