README.md 3.97 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 [link](http://wiki.ros.org/camera_calibration/Tutorials/MonocularCalibration "here").
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

## 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
Sergi Hernandez's avatar
Sergi Hernandez committed
29
appear as black regions, being the background white.
30
31
32
33
34
35
36
37
38
39
40
41
42

 * ~/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.

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

 * H_window (integer): the desired width of the Hue parameter window. This parameter is defined from 0 to 180.

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

 * S_window (integer): the desired width of the Saturation parameter window. This parameter is defined from 0 to 255.
  
Sergi Hernandez's avatar
Sergi Hernandez committed
51
 * V_center (integer): the desired window center value for the Value parameter. This parameter is defined from 0 to 255.
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90

 * 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