Note: This tutorial assumes that you have completed the previous tutorials: This tutorial assumes that you have completed the previous tutorials: Building a Database From a Set of Images.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Detecting Objects

Description: This tutorial describes how to use ODUfinder in order to detect objects in the camera images

Tutorial Level: BEGINNER

Database Files

You should now have all images in a image_data directory and all database files (images.tree, images.documents, images.weights) in a database directory. Note that we need the image files only for visualization and not for the actual detection process. If we don't want to visualize the results we won't need the image_data directory anymore.

Parameters

Create a new launch file detect_objects.launch with a text editor of your choice with the following content:

   1 <launch>
   2   <node  pkg="objects_of_daily_use_finder" type="odu_finder_node" name="odu_finder" output="screen">
   3 
   4     <param  name="command" type="string" value="/load" />
   5     <param  name="database_location" type="string" value="<PATH_TO_DATABASE>/database/" />
   6     <param  name="images_for_visualization_directory" type="string" value="<PATH_TO_IMAGES>/image_data/" />
   7 
   8     <param  name="image_topic" type="string" value="/narrow_stereo/left/image_rect" />
   9     <param  name="template_topic" type="string" value="found_template" />
  10 
  11     <param  name="enable_visualization" type="int" value="1" />
  12     <param  name="enable_clustering" type="int" value="1" />
  13 
  14     <!-- Optional Parametes -->
  15     <param  name="votes_count" type="int" value="10" />
  16 
  17   </node>
  18 </launch>

where <PATH_TO_DATABASE> and <PATH_TO_IMAGES> are the paths to the database and image_data directories. There are several other parameters that control the detection process:

  • image_topic - specifies the ROS topic where the camera images are received. You can use /narrow_stereo/left/image_rect if you are working with a PR2 robot or any other topic with a type of Image otherwise.

  • template_topic - the ROS topic where information about the best match in database is published.

  • enable_visualization - set to 1 if you want a visualization of the camera image and the template found in the database.

  • enable_clustering - set to 1 if you want to activate the clustering in feature space. This helps a lot for detecting multiple objects in the camera image.

  • votes_count - specifies the count N of best matches that should be retrieved from the database

Starting the detection

We can now start the detection process by launching the detect_objects.launch file:

$ roslaunch detect_objects.launch

After the database files are loaded the ROS node will start to listen to the specified topic (/narrow_stereo/left/image_rect in this case) for images and as soon as one is received it will be processed and information about the corresponding object from the database will be published on the output topic (/odu_finder/found_template in this case). Additionally since the enable_visualization parameter is set to 1, the camera image will be visualized along with the best match from the database.

ExampleDetection.jpg

Wiki: objects_of_daily_use_finder/Tutorials/DetectingObjects (last edited 2012-03-13 08:38:49 by Sara)