Ask Your Question
0

Install OpenCV3 under Indigo on Ubuntu 14.04

asked 2018-07-18 04:12:31 -0500

-LD- gravatar image

updated 2018-07-18 06:50:03 -0500

Hello,

I want to use a node for detecting markers that is depending on OpenCV3. Since ROS Indigo has only openCV2.4.8 preinstaleld the downloaded node fails on "catkin_make". I was searching for an easy way to install OpenVC3, but since i'm new to linux and ROS i wasn't able to install it.

Basically i guess this is what i need for my project:

http://sauravag.com/2015/03/how-to-tracking-aruco-marker-using-a-usb-webcam-and-ro/

Step 2:
git clone https://github.com/pal-robotics/aruco_ros.git
-> Cloning into 'aruco_ros'...
-> remote: Counting objects: 558, done.
-> remote: Total 558 (delta 0), reused 0 (delta 0), pack-reused 558
-> Receiving objects: 100% (558/558), 407.44 KiB | 0 bytes/s, done.
-> Resolving deltas: 100% (307/307), done.
-> Checking connectivity... done.

So far everything seems to be ok. The folder has been created and is also filled with lots of files. But than :

step 4: 
catkin_make install
-> ...
-> (lots of lines without any error)
-> ...
-> CMake Error at aruco_ros/aruco/CMakeLists.txt:6 (find_package):
->     Could not find a configuration file for package "OpenCV" that is 
->     compatible with requested version "3".
-> The following configuration files were considered but not accepted:
->     /usr/share/OpenCV/OpenCVConfig.cmake, version: 2.4.8

Tried to do an update (apt-get update) and tried again with same result. So i just tried the next tutorial here:

http://external-camera-tf.readthedocs...

But already the first line failes:

sudo apt-get install ros-indigo-opencv3
-> Reading package lists... Done
-> Building dependency tree       
-> Reading state information... Done
-> E: Unable to locate package ros-indigo-opencv3

So it seems like there is no easy way to get OpenCV3 running under ROS Indigo with Ubuntu 14.04 (trusty), right? Or am i missing something? Because on other posts, people only complain about the problems after they installed the additional version like here and also here. So it must be possible to get it working (even if maybe not by an easy way)

Does anybody know how? Anybody reading this using OpenCV3 (maybe even with the marker detection) and is still knowing what steps has been done?

Thanks to everybody taking some time to read through this.

.

.

.

Update1: Ok, following the tutorial of the second link pavel92 suggested and a few dozens of hundreds of lines in the terminal later the installation seems to be complete. I saw a few warnings but no error at the end. As i now try to catkin_make i get something different:

/home/(username)/catkin_ws/src/aruco_ros/aruco/src/aruco/cvdrawingutils.cpp:172:82: 
error: ‘CV_AA’ was not declared in this scope
         cv::line(Image,imagePoints[i],imagePoints[i+4],Scalar(0,0,255,255),1,CV_AA);

this seems to be the case for: CV_AA (9x), CV_BGR2GRAY (1x) , assert (3x) (13x errors total)

At least for the first two they seem to be defines (?).

In the makefile (@: /home/(username)/catkin_ws/src/aruco_ros/aruco) all the suggestions by pavel92 are already included:

cmake_minimum_required(VERSION 2.8.3)
project(aruco)
find_package(catkin)

find_package(OpenCV 3 REQUIRED)     <-----

catkin_package(
  INCLUDE_DIRS include
  LIBRARIES aruco
)

include_directories(
  include
  ${catkin_INCLUDE_DIRS}
  ${OpenCV_INCLUDE_DIRS}       <-----
)

add_library ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2018-07-18 04:40:22 -0500

pavel92 gravatar image

This and this step by step tutorials show how to install OpenCV3 on Ubuntu 14.04.
You can build OpenCV3 from source and include the following in your CMakeLists.txt:

find_package(OpenCV 3 REQUIRED)

include_directories(
  include
  ${catkin_INCLUDE_DIRS}
  ${OpenCV_INCLUDE_DIRS}
)

target_link_libraries(foo_node
  ${catkin_LIBRARIES}
  ${OpenCV_LIBS}
)

You can recompile cv_bridge against OpenCV3 in the workspace. Just clone cv_bridge in your workspace.

edit flag offensive delete link more

Comments

Thanks for the links. I feared that i have to get OpenCV working separated first and than telling ROS where to find it. At the other hand the second link seems to be fairly easy. Will try it right away.

-LD- gravatar image-LD- ( 2018-07-18 04:52:33 -0500 )edit

Almost worked perfectly. I updates my original post. May i please you to read through it? Maybe you know an answer for the new error? But anyway, thanks for the links and your time.

-LD- gravatar image-LD- ( 2018-07-18 06:58:19 -0500 )edit

Try changing CV_AA for cv::CV_AA

Martin Peris gravatar imageMartin Peris ( 2018-07-18 18:08:51 -0500 )edit

Do you have the header, #include <opencv2/imgproc.hpp> included?

CV_AA and CV_BGR2GRAY are defined in OpenCV2.4. In OpenCV3.4 is LINE_AA and CV_BGR2GRAY is cv::COLOR_BGR2GRAY. A lot of constants have changed there, like most of the CV_ prefixes were changed to cv:: namespace.

pavel92 gravatar imagepavel92 ( 2018-07-19 02:23:18 -0500 )edit

Let me know if this solved your problem

pavel92 gravatar imagepavel92 ( 2018-07-20 05:58:33 -0500 )edit

Sorry, i don't have access to the PC with the programs all the time. Next time will be Monday. I will write an update then.

-LD- gravatar image-LD- ( 2018-07-20 10:44:42 -0500 )edit

Ok, seems like the errors i'm currently dealing with don't have anything in common with the original question. Yes, all errors were caused by the openCV2.4.8 defines. Still weird since the lib was asking for 3.0, but at least i could simply change them (just as you pointed out).

-LD- gravatar image-LD- ( 2018-07-24 10:33:02 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-07-18 04:12:31 -0500

Seen: 827 times

Last updated: Jul 18 '18