Difference between revisions of "Objects recognition and position calculation (webcam)"

From robotica.unileon.es
Jump to: navigation, search
(Installation of OpenCV)
(Utilization of a new OpenCV version in ROS Electric)
Line 17: Line 17:
 
===Utilization of a new OpenCV version in ROS Electric===
 
===Utilization of a new OpenCV version in ROS Electric===
  
The previous ''package'' needs in order to compile the [http://opencv.org/ OpenCV] version 2.4.3 or higher, but [http://wiki.ros.org/ ROS] Electric has the [http://opencv.org/ OpenCV] version 2.3.1. We will install the [http://opencv.org/ OpenCV] version 2.4.3, configure the ''package'' [http://wiki.ros.org/cv_bridge?distro=electric cv_bridge] and modify the ''package'' [http://code.google.com/p/find-object/ find_object_2d].
+
The previous ''package'' needs in order to compile the [http://opencv.org/ OpenCV] version 2.4.3 or higher, but [http://wiki.ros.org/ ROS] Electric has the [http://opencv.org/ OpenCV] version 2.3.1. We will install the [http://opencv.org/ OpenCV] version 2.4.3, modify the ''package'' [http://wiki.ros.org/cv_bridge?distro=electric cv_bridge] and modify the ''package'' [http://code.google.com/p/find-object/ find_object_2d].
  
 
====Installation of OpenCV====
 
====Installation of OpenCV====

Revision as of 17:21, 30 December 2013

< go back to main

Objects recognition

We have used the package find_object_2d which has been develop by Mathieu Labbé (Université de Sherbrooke). The program can recognizes objects in the scene using an image of the object. The program has a graphical user interface which allow to capture an image of the scene and save it.

Screenshot find_object_2d

In the screenshot that is shown above, we can see how the recognized object is within a boundary box which coincide with the corners of the object image.

The program provides several data of each found object in the scene. We will use the next data:

  • Width of the object image (number of pixels).
  • Height of the object image (number of pixels).
  • Position of the corners of the object image in the scene.

Utilization of a new OpenCV version in ROS Electric

The previous package needs in order to compile the OpenCV version 2.4.3 or higher, but ROS Electric has the OpenCV version 2.3.1. We will install the OpenCV version 2.4.3, modify the package cv_bridge and modify the package find_object_2d.

Installation of OpenCV

First we will download the OpenCV version 2.4.3 by the official web. We will extract the content of the downloaded file in the personal folder. We will execute the next commands in a terminal in order to update the ubuntu packages:

sudo apt-get update
sudo apt-get upgrade

When the update/upgrade finish, we will place in the OpenCV folder and execute the next commands in a terminal in order to compile:

mkdir build
cd build
cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
make
sudo make install

< go back to main