-
This genom3 module is based on the ROS package called find_object_2d (http://wiki.ros.org/find_object_2d). It is absolutely necessary to install it before proceeding.
-
To install find_object_2d, open a new terminal and type:
sudo apt-get install ros-indigo-find-object-2d
-
Clone this repository and compile the genom3 module. To do so, enter the following commands:
genom3 skeleton -l c++ -i objectdetection.gen ./bootstrap.sh mkdir build cd build ../configure --prefix=$ROBOTPKG_BASE --with-templates=ros/server,ros/client/c make make install
-
Go to the directory where find_object_2d was installed:
roscd find_object_2d/
-
Create a file called
stereo.launch
in the launch directory where find_object_2d was installed and include the following:<launch> <!-- Nodes --> <group ns="find_objects_2d_Left"> <node name="find_object_2d" pkg="find_object_2d" type="find_object_2d" output="screen"> <remap from="image" to="/stereo/left/image_rect_color"/> <param name="gui" value="false" type="bool"/> <param name="session_path" value="/home/USER_PATH/objectdetection/sessionOBJECTS.bin" type="str"/> </node> </group> <group ns="find_objects_2d_Right"> <node name="find_object_2d" pkg="find_object_2d" type="find_object_2d" output="screen"> <remap from="image" to="/stereo/right/image_rect_color"/> <param name="gui" value="false" type="bool"/> <param name="session_path" value="/home/USER_PATH/objectdetection/sessionOBJECTS.bin" type="str"/> </node> </group> </launch>
-
Modify
image
if needed andsession_path
accordingly to your setup (after finishing step 8). -
Run ros
roscore &
-
"Learn" all the objects that you want to detect.
-
Check that your (mono) camera is publishing its output to a ros topic (sensor_msgs/Image message).
-
Considering that your camera publishes to /stereo/left/image_rect_color, launch the find_object_2d gui, keeping in mind that the image topic has to be remapped accordingly to your settings.
rosrun find_object_2d find_object_2d image:=/stereo/left/image_rect_color
-
On the GUI, check that nextObjID under 'General' is set to 0.
-
Go to Edit->'Add object from scene...'
-
When you are satisfied with the position of the object in the scene, click 'Take picture'.
-
With the mouse, select the region of the object you want to detect (it's better that it contains a large number of keypoints to have a robust detection afterwards), click next and then end.
-
It is recommended to follow steps 7.iv and 7.vi for each object from several angles and distances.
-
Save the session by going to file->save session. Check that the name has to be *.bin. This saves all the objects learned in previous steps.
-
Once all the objects have been 'learned' (preferably from different angles and distances), create one text file (*.txt) per object and include in each one the ID number captured by the GUI for each angle. For example, if the captured images for object named 'phone' go from 0 to 2 and for 'fan' go from 3 to 5, then:
phone.txt should look like this: 0 1 2 fan.txt should look like this: 3 4 5
Keep in mind that in each file, only one ID per line should be written and there should not be an empty line at the end.
-
All the .txt files have to be saved in the same folder.
-
Edit stereo.launch so it complies with your setting:
-
Check that the two image topics remaps are according to your left and right topics from your cameras.
-
Change the session_path parameters for both nodes to match the path to your session file (*.bin) saved in step 8.
-
Launch the stereo.launch file. It will start two instances of the find_object_2d (without the GUI)
roslaunch find_object_2d stereo.launch
-
Run the genom3 module
objectdetection-ros -b
-
Run genomix
genomixd &
-
Start TCL
eltclsh
-
Load objecdetection module
package require genomix ::genomix::connect genomix1 load objectdetection
-
Connect the necessary ports (Keep in mind that CameraL and CameraR have to comply with your cameras's setting)
::objectdetection::connect_port RightCameraParameters /stereo/right/camera_info ::objectdetection::connect_port CameraL /stereo/left/image_rect_color ::objectdetection::connect_port inObjectsL find_objects_2d_Left/objectsStamped ::objectdetection::connect_port CameraR /stereo/right/image_rect_color ::objectdetection::connect_port inObjectsR find_objects_2d_Right/objectsStamped
-
Run the detection activity
::objectdetection::Start {objectPath /path_to/objects/textfiles/}
-
Notifications
You must be signed in to change notification settings - Fork 0
License
TWOEARS/object-detection
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published