README.md 4.08 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

## parameters

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

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

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

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

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

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

Sergi Hernandez's avatar
Sergi Hernandez committed
58
 * **color_id** (string): the identifier of the color segmented. This name is used for the blob identifier.
59
  
Sergi Hernandez's avatar
Sergi Hernandez committed
60
 * **max_area** (integer): the maximum area in pixels of the desired regions.
61
 
Sergi Hernandez's avatar
Sergi Hernandez committed
62
 * **min_area** (integer): the minimum area in pixels of the desired regions.
63
64
65
66
67
68
69
70
71
72
73
74
75

# Dependencies

This node has the following dependencies:

 * OpenCV (at least version 3.0)

 * boost

# How to use it

This node provides two launch files:

Sergi Hernandez's avatar
Sergi Hernandez committed
76
 * **blob_detector.launch**: this file load the default parameters from ./config/default_params.yaml and launches the blob detector 
77
78
79
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.

Sergi Hernandez's avatar
Sergi Hernandez committed
80
 * **blob_detector_sim.launch**: this file load the default parameters from ./config/default_params.yaml and launches the blob detector
81
82
83
84
85
86
87
88
89
90
91
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