Jetson TK1: OpenCV and ROS

Thank you @linuxdev

ROS is a good environment and allows to create a robotic system starting from zero without to worry about the base infrastructure…

I’m going to bring my robot to GTC2015, I hope to find someone that can help us to solve the issue with OpenCV there ^_^

I’ve been through all sorts of issues getting opencv samples to compile on the jetson. I basically had to just build the whole opencv libary and run it against opencv4tegra in the end…

I’m looking at ways to go about dealing with several opencv dependencies for my robot and I came across this discussion. I was curious what the status of the reply from the package manager was?

Regarding my last comment, ros still thinks to look in usr/lib for the opencv libraries, but they aren’t there. Instead they are in /usr/lib/arm-linux-gnueabihf. I installed L0g1x’s fix, but the packages we are using are looking for the opencv libraries in usr/lib, thus giving me an error that they can’t find them. Not sure how to fix this. I thought that the opencv4tegra installed them in usr/lib?

Sorry ive been MIA for a bit, @jbrown, im not sure what packages you are using (please mention) and why it cant find the opencv libraries in /usr/lib since opencv4tegra actually does install into /usr/lib (which it shouldnt, it should install into /usr/lib/arm-linux-gnueabihf , just like the native ros arm opencv install does). My fix accounted for the incorrect path set by the opencv4tegra library, when it should actually be the other way around: The opencv4tegra deb should be modified to be install all the opencv4tegra libraries into /usr/lib/arm-linux-gnueabihf instead of /usr/lib. The issue of an update overwriting the tegra opencv libs will still then exists if you update opencv through a ros update.

It’s okay. Good to see ya back! We have some custom packages looking in usr/lib for opencv. We are redoing our vision code, so for now, I think I might be okay. It works on our main robot, now I just need to get it to work on our Jetson board. The (new) problem we are having now is that we have some functions that depend on opencv libraries 2.4.11, and ros is linking the 2.4.8 libraries. I think we have a fix for this, I have yet to try it. If it works, I will post it here for posterity.

Has anybody had any problems with the fisheye function? I am. It should work with opencv 2.4.11, but ros is throwing fits.

Hi L0g1x, you mentioned contacting the opencv4tegra package maintainer. If you haven’t done so yet, can you please summarize the problem and possibly the ideal solution, and I’ll pass it on to them.

@jbrown its probably linking to 2.4.8 because the opencv4tegra version is 2.4.8.3 (http://developer.download.nvidia.com/embedded/OpenCV/L4T_21.1/README.txt) . I have some time today to look more into this issue now that my school load isnt to hard at the moment. However, im not sure regardless of the fix i make that you will be able to use any 2.4.11 functions if you want to use opencv4tegra, since its on 2.4.8.3 as i mentioned above.

The problem currently is that opencv4tegra contain’s packages that install the modified nvidia opencv libs and names them differently then the native opencv libs.
For example:

Nvidia - libopencv4tegra, libopencv4tegra-dev
Native - libopencv, libopencv-dev

This causes a issue for users who use packages that specify in their DEBIAN/control that they depend on libopencv (one package example would be all the ROS computer vision related packages, well at least the ones that use OpenCV).

Inevitably, i know its difficult to not name the modified opencv4tegra libraries different from the native opencv libs to prevent from an upstream opencv update overwriting the opencv4tegra lib modifications. I have a few ideas about a way to possibly fix this that im currently trying out at this moment, but I would also like to hear the input of the opencv4tegra package maintainer on what his thoughts are on dealing with this issue.

Will post a update on my progress within the next few hours.

(if all goes as i plan, then i think the fix will work on both 19.x and 21.x, although i have to verify if its just the 21.x opencv4tegra that has the lib names changed)

Hi guys,

I spoke with the OpenCV4Tegra maintainer, and he said there is a temporary work-around you can use for now:

  1. Install ROS
  2. Remove public OpenCV packages within ROS
  3. Install OpenCV4Tegra
  4. Install ROS again

ROS will then work and use the OpenCV4Tegra optimizations. We will try to fix the problem in the next release to enable smooth package replacement without ROS removal.

When he says “remove” how should the opencv that ROS (step 1) installs, be removed without telling apt-get that “libopencv” has been uninstalled…? This will basically cause step 4 to overwrite everything done in step 3 because when you “install ROS” for the second time (im also not sure what you mean by this) then apt-get will see that “libopencv” is not installed, since you removed it in step 2.

Would anyone happen to know how opencv4tegra gets updated? If it gets updated? do you use apt-get upgrade or do you manually install a new debian? Seems like it only gets updated every time there is a new L4T release…

OpenCV4Tegra is an NVIDIA-only library and so it only gets updated with L4T releases or if you update it manually (downloading OpenCV4Tegra packages from the NVIDIA website). I haven’t tried the suggested ROS work-around above, but if you try it and it fails then let me know and I’ll get more details from them.

I tried this workaround a few time ago. When you reinstall ROS (step too generic… which ros???) it removes opencv4tegra and install again OpenCV from ubuntu repo saying that there is a conflict with OpenCV lib files

Hello Guys

Is there any progress on this topic?

I successfully used the modified deb file, but for my application I need to install a lot more packages each of which needs OPENCV (i.e. imgproc)

What would I need to do, to create my own .deb files for each package?

Best regards
Gerald

A solution to this issue.

Great work. I think that it is the right solution to the problem!!!

Hi,

After reading through this thread, and also reading through the thread @ the link posted by davyweb (“A solution to this issue”), the issue still persists for me after attempting davywb’s suggestion multiple times. The result is the same, where packages installed after the modified debs for opencv4tegra REMOVE opencv4tegra and install opencv packages in its place.

My first question: Has anyone actually had success in getting past this problem with davywb’s suggestion? You can read the post @ his link he mentions to get more detail from my side of this issue.

Thanks

Yesterday I installed Jetpack v2.0 on my Jetson TX1, then I installed ROS (following the same guide as for the Jetson TK1) and now everything seems to work great with OpenCV.

I have not tried to install the new Jetpack on my Jetson TK1, but since it is the same software I believe that it will work great also on it.

Hi guys,

I am not sure if this is the correct thread but I am also facing some difficulties making ros image transports and cv brige to work on the jetson TK1.

My OS verion is Linux tegra-ubuntu 3.10.40 and ROS version is indigo.

I have been using opencv without any issues, specially with CAFFE framework.
I have also followed some tutorials in the jetson (for sanity check) and everything is working allright
Right now I have tried to follow the image transports tutorials (image_transport/Tutorials/PublishingImages - ROS Wiki) but when I run catkin_make I am obtaining this error:
" No rule to make target /usr/lib/arm-linux-gnueabihf/libopencv_videostab.so.2.4.8', needed by /home/ubuntu/image_transport_ws/devel/lib/image_transport_tutorial/my_publisher’. Stop."

Do you any suggestion on what might be causing this? Is it a linking problem?
Thanks in advance

Hi

Please make sure your libopencv-videostab2.4 have been installed well.
You could refer below topic to confirm that:
[url]https://devtalk.nvidia.com/default/topic/900926/post/4745417/#4745417[/url]

Thanks

hey,
I am trying to view the depth map using zed ROS wrapper program but I am getting an error.
I followed the Jetsonhacks tutorial on youtube and also the steps on GitHub but I can’t get the depth map
what may be the problem?

this is the steps that I did:

ubuntu@tegra-ubuntu:~$ mkdir catkin_ws
ubuntu@tegra-ubuntu:~$ cd catkin_ws
ubuntu@tegra-ubuntu:~/catkin_ws$ ls
ubuntu@tegra-ubuntu:~/catkin_ws$ mkdir src
ubuntu@tegra-ubuntu:~/catkin_ws$ cd src
ubuntu@tegra-ubuntu:~/catkin_ws/src$ catkin_init_workspace
Creating symlink "/home/ubuntu/catkin_ws/src/CMakeLists.txt" pointing to "/opt/ros/indigo/share/catkin/cmake/toplevel.cmake"
ubuntu@tegra-ubuntu:~/catkin_ws/src$ ls
CMakeLists.txt
ubuntu@tegra-ubuntu:~/catkin_ws/src$ cd ..
ubuntu@tegra-ubuntu:~/catkin_ws$ ls
src
ubuntu@tegra-ubuntu:~/catkin_ws$ catkin_make
Base path: /home/ubuntu/catkin_ws
Source space: /home/ubuntu/catkin_ws/src
Build space: /home/ubuntu/catkin_ws/build
Devel space: /home/ubuntu/catkin_ws/devel
Install space: /home/ubuntu/catkin_ws/install
####
#### Running command: "cmake /home/ubuntu/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/ubuntu/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/ubuntu/catkin_ws/install -G Unix Makefiles" in "/home/ubuntu/catkin_ws/build"
####
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Using CATKIN_DEVEL_PREFIX: /home/ubuntu/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/indigo
-- This workspace overlays: /opt/ros/indigo
-- Found PythonInterp: /usr/bin/python (found version "2.7.6")
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/ubuntu/catkin_ws/build/test_results
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE 
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.6.16
-- BUILD_SHARED_LIBS is on
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/catkin_ws/build
####
#### Running command: "make -j4 -l4" in "/home/ubuntu/catkin_ws/build"
####
ubuntu@tegra-ubuntu:~/catkin_ws$ ls devel
env.sh  lib  setup.bash  setup.sh  _setup_util.py  setup.zsh
ubuntu@tegra-ubuntu:~/catkin_ws$ ls build
catkin            catkin_make.cache  cmake_install.cmake  Makefile
catkin_generated  CMakeCache.txt     CTestTestfile.cmake  test_results
CATKIN_IGNORE     CMakeFiles         gtest
ubuntu@tegra-ubuntu:~/catkin_ws$ source devel/setup.bash
ubuntu@tegra-ubuntu:~/catkin_ws$ echo ROS_PACKAGE_PATH
ROS_PACKAGE_PATH
ubuntu@tegra-ubuntu:~/catkin_ws$ source ./devel/setup.bash
ubuntu@tegra-ubuntu:~/catkin_ws$ roslaunch zed_wrapper zed.launch
... logging to /home/ubuntu/.ros/log/67617d7a-e9f0-11e5-a565-00044b49101a/roslaunch-tegra-ubuntu-15234.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://tegra-ubuntu:38918/

SUMMARY
========

PARAMETERS
 * /camera/zed_wrapper_node/cloud_frame_id: /zed_optical_frame
 * /camera/zed_wrapper_node/depth_cam_info_topic: depth/camera_info
 * /camera/zed_wrapper_node/depth_frame_id: /zed_optical_frame
 * /camera/zed_wrapper_node/depth_topic: depth/image_rect_...
 * /camera/zed_wrapper_node/frame_rate: 30
 * /camera/zed_wrapper_node/left_cam_info_topic: left/camera_info
 * /camera/zed_wrapper_node/left_frame_id: /zed_optical_frame
 * /camera/zed_wrapper_node/left_topic: left/image_rect_c...
 * /camera/zed_wrapper_node/point_cloud_topic: point_cloud/cloud
 * /camera/zed_wrapper_node/quality: 2
 * /camera/zed_wrapper_node/resolution: 2
 * /camera/zed_wrapper_node/rgb_cam_info_topic: rgb/camera_info
 * /camera/zed_wrapper_node/rgb_frame_id: /zed_optical_frame
 * /camera/zed_wrapper_node/rgb_topic: rgb/image_rect_color
 * /camera/zed_wrapper_node/right_cam_info_topic: right/camera_info
 * /camera/zed_wrapper_node/right_frame_id: /zed_optical_frame
 * /camera/zed_wrapper_node/right_topic: right/image_rect_...
 * /camera/zed_wrapper_node/sensing_mode: 1
 * /rosdistro: indigo
 * /rosversion: 1.11.16

NODES
  /camera/
    zed_wrapper_node (zed_wrapper/zed_wrapper_node)
  /
    zed_base_link1 (tf/static_transform_publisher)
    zed_base_link2 (tf/static_transform_publisher)

auto-starting new master
process[master]: started with pid [15245]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 67617d7a-e9f0-11e5-a565-00044b49101a
process[rosout-1]: started with pid [15258]
started core service [/rosout]
ERROR: cannot launch node of type [tf/static_transform_publisher]: tf
ROS path [0]=/opt/ros/indigo/share/ros
ROS path [1]=/home/ubuntu/catkin_ws/src
ROS path [2]=/opt/ros/indigo/share
ROS path [3]=/opt/ros/indigo/stacks
ERROR: cannot launch node of type [tf/static_transform_publisher]: tf
ROS path [0]=/opt/ros/indigo/share/ros
ROS path [1]=/home/ubuntu/catkin_ws/src
ROS path [2]=/opt/ros/indigo/share
ROS path [3]=/opt/ros/indigo/stacks
ERROR: cannot launch node of type [zed_wrapper/zed_wrapper_node]: can't locate node [zed_wrapper_node] in package [zed_wrapper]