Difference between revisions of "OpenCV Installation"

From wikidb
Jump to: navigation, search
(ihr_opencv)
 
(23 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
= OpenCV 2.4 =
 +
 +
= Jade =
 +
OpenCV 2.4
 +
 +
== Install ==
 +
 +
  apt-get install ros-jade-vision-opencv
 +
  sudo apt-get install opencv-doc
 +
 +
== Source ==
 +
 +
Needed for samples
 +
  git clone https://github.com/Itseez/opencv
 +
 +
== Links ==
 +
 +
* [http://wiki.ros.org/vision_opencv ROS OpenCV]
 +
* [http://docs.opencv.org/doc/tutorials/tutorials.html OpenCV tutorials]
 +
* [https://github.com/Itseez/opencv/tree/2.4/samples/cpp Sample code]
 +
* [https://github.com/Itseez/opencv/blob/2.4/samples/cpp/camshiftdemo.cpp CamShift Demo]
 +
* [https://fossies.org/dox/opencv-3.0.0/camshiftdemo_8cpp.html CamShift File Reference]
 +
 +
---------------------
 +
---------------------
 +
---------------------
 +
 +
= Electric =
 +
 +
2012 on FitPC.
 +
 
=== I Heart Robotics ===
 
=== I Heart Robotics ===
  
 
[http://www.ros.org/news/2010/08/i-heart-robotics-vision-for-robotics-tutorials.html I Heart Robotics] installation instructions and tutorials.
 
[http://www.ros.org/news/2010/08/i-heart-robotics-vision-for-robotics-tutorials.html I Heart Robotics] installation instructions and tutorials.
 +
 +
=== usb_cam Driver ===
 +
 +
==== Installation ====
 +
 +
Install the usb_cam drivers for ROS.
  
 
As root
 
As root
Line 12: Line 49:
 
cd usb_cam
 
cd usb_cam
 
</pre>
 
</pre>
Remove the <rosdep name="libswscale-dev"/> line from manifest.xml. A check of Synaptic shows it is there and the following step will fail if this line is present.
+
Remove the <rosdep name="libswscale-dev"/> line from manifest.xml. A check of Synaptic shows libswscale-dev is there. However, the following step will fail if this line is present.
 
<pre>
 
<pre>
 
rosdep install usb_cam
 
rosdep install usb_cam
 
rosmake usb_cam
 
rosmake usb_cam
 
</pre>
 
</pre>
 +
 +
==== Webcam View Test ====
  
 
In user space create usb_cam.launch with the following content.
 
In user space create usb_cam.launch with the following content.
Line 39: Line 78:
 
roslaunch usb_cam.launch
 
roslaunch usb_cam.launch
 
</pre>
 
</pre>
 +
 +
[[Image:Usb_cam02.jpg]]
  
 
=== ihr_opencv ===
 
=== ihr_opencv ===
 +
 +
==== Installation ====
  
 
Install the OpenCV vision library using packages from I Heart Robotics.
 
Install the OpenCV vision library using packages from I Heart Robotics.
Line 57: Line 100:
 
</pre>
 
</pre>
  
 +
Reindex the two oranges files. Otherwise, you'll get an error message that the two_oranges.bag file is unindexed.
 +
 +
<pre>
 +
root@tabor:bags# cd /opt/ros/electric/stacks/iheart-ros-pkg/ihr_demos/ihr_demo_bags/bags
 +
root@tabor:bags# rosbag reindex two_oranges.bag
 +
two_oranges.bag                            100%            19.8 MB 00:00   
 +
two_oranges.bag                            100%            19.8 MB 00:00 
 +
</pre> 
 +
 +
==== Canned Image Test ====
 
From users space.
 
From users space.
  
 
<pre>
 
<pre>
  
eepp@tabor:~/ros_workspace/webcam$ roslaunch /opt/ros/electric/stacks/iheart-ros-pkg/ihr_demos/ihr_demo_bags/launch/demo.launch  
+
eepp@tabor:~/ros_workspace/webcam$ roslaunch /opt/ros/electric/stacks/iheart-ros-pkg/ihr_demos/
 +
              ihr_demo_bags/launch/demo.launch  
 +
</pre>
 +
 
 +
It will display the following canned image.
 +
 
 +
[[Image:two_oranges.jpg]]
 +
 
 +
==== Live OpenCV Test ====
 +
To test OpenCV live enter the following. It will detect oranges in the display field of the webcam.
 +
 
 +
<pre>
 +
eepp@tabor:~/ros_workspace$ roslaunch /opt/ros/electric/stacks/iheart-ros-pkg/ihr_demos/
 +
ihr_opencv/launch/live_hough.launch
 +
</pre>
 +
 
 +
What follows is an example image.
 +
 
 +
[[Image:Detected_orange07.jpg]]
 +
 
 +
The terminal will also display status information along with the coordinates and radius of the detected
 +
orange.
 +
 
 +
<pre>
 +
15 frames/sec at 1336967181.169897841
 +
[ INFO] [1336967181.398723572]: x: 73 y: 201 r: 24
 +
[ INFO] [1336967181.498611975]: x: 72 y: 200 r: 23
 +
[ INFO] [1336967181.672332369]: x: 70 y: 196 r: 20
 +
[ INFO] [1336967181.892526277]: x: 68 y: 200 r: 24
 +
[ INFO] [1336967182.093009586]: x: 71 y: 195 r: 22
 +
14 frames/sec at 1336967182.115750742
 +
[ INFO] [1336967182.372296473]: x: 73 y: 195 r: 22
 +
[ INFO] [1336967182.600016483]: x: 75 y: 195 r: 22
 +
16 frames/sec at 1336967183.182737183
 +
15 frames/sec at 1336967184.179627852
 
</pre>
 
</pre>

Latest revision as of 13:12, 4 November 2015

OpenCV 2.4

Jade

OpenCV 2.4

Install

 apt-get install ros-jade-vision-opencv
 sudo apt-get install opencv-doc

Source

Needed for samples

 git clone https://github.com/Itseez/opencv

Links




Electric

2012 on FitPC.

I Heart Robotics

I Heart Robotics installation instructions and tutorials.

usb_cam Driver

Installation

Install the usb_cam drivers for ROS.

As root

cd /opt/ros/electric/stacks
svn co https://bosch-ros-pkg.svn.sourceforge.net/svnroot/bosch-ros-pkg
source ../setup.sh 
cp -r bosch-ros-pkg/trunk/stacks/bosch_drivers/usb_cam .
cd usb_cam

Remove the <rosdep name="libswscale-dev"/> line from manifest.xml. A check of Synaptic shows libswscale-dev is there. However, the following step will fail if this line is present.

rosdep install usb_cam
rosmake usb_cam

Webcam View Test

In user space create usb_cam.launch with the following content.

<launch>
  <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" >
    <param name="video_device" value="/dev/video0" />
    <param name="image_width" value="320" />
    <param name="image_height" value="240" />
    <param name="pixel_format" value="mjpeg" />
    <param name="camera_frame_id" value="usb_cam" />
    <param name="io_method" value="mmap"/>
  </node>
  <node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
    <remap from="image" to="/usb_cam/image_raw"/>
  </node>
</launch>

Then execute it.

roslaunch usb_cam.launch

Usb cam02.jpg

ihr_opencv

Installation

Install the OpenCV vision library using packages from I Heart Robotics.

Install git-core with Synaptic.

Then install opencv as root.

cd /opt/ros/electric/stacks/
git clone git://github.com/IHeartRobotics/iheart-ros-pkg.git
source ../setup.sh 
cd iheart-ros-pkg/ihr_demos/ihr_opencv/
rosdep install ihr_opencv
rosmake ihr_opencv

Reindex the two oranges files. Otherwise, you'll get an error message that the two_oranges.bag file is unindexed.

root@tabor:bags# cd /opt/ros/electric/stacks/iheart-ros-pkg/ihr_demos/ihr_demo_bags/bags
root@tabor:bags# rosbag reindex two_oranges.bag 
two_oranges.bag                             100%             19.8 MB 00:00     
two_oranges.bag                             100%             19.8 MB 00:00  

Canned Image Test

From users space.


eepp@tabor:~/ros_workspace/webcam$ roslaunch /opt/ros/electric/stacks/iheart-ros-pkg/ihr_demos/
              ihr_demo_bags/launch/demo.launch 

It will display the following canned image.

Two oranges.jpg

Live OpenCV Test

To test OpenCV live enter the following. It will detect oranges in the display field of the webcam.

eepp@tabor:~/ros_workspace$ roslaunch /opt/ros/electric/stacks/iheart-ros-pkg/ihr_demos/
ihr_opencv/launch/live_hough.launch

What follows is an example image.

Detected orange07.jpg

The terminal will also display status information along with the coordinates and radius of the detected orange.

15 frames/sec at 1336967181.169897841
[ INFO] [1336967181.398723572]: x: 73 y: 201 r: 24
[ INFO] [1336967181.498611975]: x: 72 y: 200 r: 23
[ INFO] [1336967181.672332369]: x: 70 y: 196 r: 20
[ INFO] [1336967181.892526277]: x: 68 y: 200 r: 24
[ INFO] [1336967182.093009586]: x: 71 y: 195 r: 22
14 frames/sec at 1336967182.115750742
[ INFO] [1336967182.372296473]: x: 73 y: 195 r: 22
[ INFO] [1336967182.600016483]: x: 75 y: 195 r: 22
16 frames/sec at 1336967183.182737183
15 frames/sec at 1336967184.179627852