README.md 4.86 KB
Newer Older
1
2
# Description

Sergi Hernandez's avatar
Sergi Hernandez committed
3
This ROS node implements the BlobDetector provided in OpenCV. Each input image is transformed to the HSV color
4
5
6
7
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.

Sergi Hernandez's avatar
Sergi Hernandez committed
8
9
10
A nodelete version is also provided to reduce the overhead of sending the images from one node to another in the
same computer.

11
This ROS node does not require the camera to be calibrated, however it is highly recommended. Follow the calibration 
Sergi Hernandez's avatar
Sergi Hernandez committed
12
procedure presented [here](http://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration "ROS monocular calibration page").
13
14
15
16
17

## subscribers

This node subscribes to the following topics:

Sergi Hernandez's avatar
Sergi Hernandez committed
18
 * **~/image_in/camera_info** (sensor_msgs/CameraInfo.msg): provides the calibration information for the camera.
19

Sergi Hernandez's avatar
Sergi Hernandez committed
20
 * **~/image_in/image_raw** (sensor_msgs/Image.msg): The input image itself. 
21
22
23
24
25

## publishers

This node publishes the following topics:

Sergi Hernandez's avatar
Sergi Hernandez committed
26
 * **~/image_out/camera_info** (sensor_msgs/CameraInfo.msg): the same camera information message received.
27
	
Sergi Hernandez's avatar
Sergi Hernandez committed
28
 * **~/image_out/image_raw** (sensor_msgs/Image.msg): a black and white image with the segmented regions. The segmented blobs will
Sergi Hernandez's avatar
Sergi Hernandez committed
29
appear as black regions, being the background white.
30

Sergi Hernandez's avatar
Sergi Hernandez committed
31
 * **~/blobs** (iri_blob_detector/blob_array.msg): a list of all the connected regions that comply with the desired 
32
33
parameters. The information provided for each blob is:

Sergi Hernandez's avatar
Sergi Hernandez committed
34
    **id** (string): the identifier of each blob is build from the color_id parameter and the index of the blob.
Sergi Hernandez's avatar
Sergi Hernandez committed
35
    
Sergi Hernandez's avatar
Sergi Hernandez committed
36
    **center_x** (unsigned int): position in pixels of the center of the blob in the image (x axis).
Sergi Hernandez's avatar
Sergi Hernandez committed
37
    
Sergi Hernandez's avatar
Sergi Hernandez committed
38
    **center_y** (unsigned int): position in pixels of the center of the blob in the image (y axis).  
Sergi Hernandez's avatar
Sergi Hernandez committed
39
    
Sergi Hernandez's avatar
Sergi Hernandez committed
40
    **size** (float): Size of the blob in pixels.
41

42
43
44
45
46
47
48
49
50
## services

This node provides the following service clients:

 * ** ~/set_filter (iri_blob_detector/set_hsv_filter.srv): A service to change on-line the color parameters used by the node to filter the input images. 
All parameters are updated when this service is called. 

 * ** ~/get_filter (iri_blob_detector/get_hsv_filter.srv): A service to get the current color parameters used by the node to filter the input images.

51
52
53
54
## parameters

This node has the following parameters. These parameters can be modified with the dynamic reconfigure tool.

Sergi Hernandez's avatar
Sergi Hernandez committed
55
 * **H_center** (integer): the desired window center value for the Hue parameter. This parameter is defined from 0 to 180.
56

Sergi Hernandez's avatar
Sergi Hernandez committed
57
 * **H_window** (integer): the desired width of the Hue parameter window. This parameter is defined from 0 to 180.
58

Sergi Hernandez's avatar
Sergi Hernandez committed
59
 * **S_center** (integer): the desired window center value for the Saturation parameter. This parameter is defined from 0 to 255.
60

Sergi Hernandez's avatar
Sergi Hernandez committed
61
 * **S_window** (integer): the desired width of the Saturation parameter window. This parameter is defined from 0 to 255.
62
  
Sergi Hernandez's avatar
Sergi Hernandez committed
63
 * **V_center** (integer): the desired window center value for the Value parameter. This parameter is defined from 0 to 255.
64

Sergi Hernandez's avatar
Sergi Hernandez committed
65
 * **V_window** (integer): the desired width of the Value parameter window. This parameter is defined from 0 to 255.
66

Sergi Hernandez's avatar
Sergi Hernandez committed
67
 * **color_id** (string): the identifier of the color segmented. This name is used for the blob identifier.
68
  
Sergi Hernandez's avatar
Sergi Hernandez committed
69
 * **max_area** (integer): the maximum area in pixels of the desired regions.
70
 
Sergi Hernandez's avatar
Sergi Hernandez committed
71
 * **min_area** (integer): the minimum area in pixels of the desired regions.
72
73
74
75
76
77
78
79
80

# Dependencies

This node has the following dependencies:

 * OpenCV (at least version 3.0)

 * boost

81
82
All these dependencies should be already available with a standard ROS installation.

83
84
# How to use it

85
86
87
88
89
90
91
92
93
94
95
96
Download the node inside a catkin workspace:

 git clone https://gitlab.iri.upc.edu/seat_adc/iri_blob_detector.git

Build the node:

 roscd

 cd ..

 catkin_make --only-pkg-with-deps iri_blob_detector

97
98
This node provides two launch files:

99
 * **blob_detector.launch**: this file loads the default parameters from ./config/default_params.yaml and launches the blob detector 
100
101
102
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.

103
 * **blob_detector_sim.launch**: this file loads the default parameters from ./config/default_params.yaml and launches the blob detector
104
105
node, but expects the model car simulator to be already running.

106
You can use the [iri_color_calibration](https://gitlab.iri.upc.edu/seat_adc/iri_color_calibration "IRI color calibration tool") ROS node to easily generate new yaml configuration files for this node.
107
108
109
110
111
112
113
114

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