ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

OpenCV4Tegra and ROS - HowTo? (Jetson TK1)

asked 2015-02-07 05:26:17 -0500

Myzhar gravatar image

Hi all,

I'm trying to "force" ROS to see OpenCV4Tegra as the official OpenCV installed on my Jetson TK1 so that cv_bridge does not install libopencv-dev from Ubuntu repo.

I tried to follow the guide posted here https://devtalk.nvidia.com/default/to...

but as you can see I faced a problem that I could not solve until now.

Does anyone succeeded on it?

OpenCV4Tegra has GPU support and it is optimized for Tegra TK1 SoC, so I want to use its power for my algorithms ;)

edit retag flag offensive close merge delete

Comments

which L4T version are you on?

l0g1x gravatar image l0g1x  ( 2015-02-10 11:31:54 -0500 )edit

@l0g1x I'm using the latest 21.2.2 hacked with TheGrinch kernel

Myzhar gravatar image Myzhar  ( 2015-02-10 12:20:10 -0500 )edit
1

I forgot where I read this, but that dummy package works as is for 19.3, and that you have to slightly modify the dummy package for it to work with 21.2 opencv4tegra.

l0g1x gravatar image l0g1x  ( 2015-02-10 14:34:19 -0500 )edit
1

Not next to my board right now, but i will post instruction later on today if i figure it out

l0g1x gravatar image l0g1x  ( 2015-02-10 14:38:02 -0500 )edit

I tried every kind of modifications, but I cannot figure out what I was missing, I'm really curious.

As long as I get the solution I will post it on my guide to configure Jetson TK1 for a robotics application: http://myzharbot.robot-home.it/blog/s...

Myzhar gravatar image Myzhar  ( 2015-02-10 14:54:47 -0500 )edit

Naturally I will be really happy to post a link to "you" (website, blog, ecc) thanking for the help

Myzhar gravatar image Myzhar  ( 2015-02-10 14:56:03 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2015-05-26 00:51:12 -0500

davywb gravatar image

Please refer to the solution here.

https://devtalk.nvidia.com/default/to...

edit flag offensive delete link more
1

answered 2015-02-10 23:32:47 -0500

l0g1x gravatar image

updated 2015-02-12 15:52:28 -0500

Okay so i successfully installed cv-bridge, and can compile some sample code from the cv bridge tutorials, and run the node no problem. There still need to be some modifications, but i made a modified .deb for ros-indigo-cv-bridge and changed around a few things:

First off, the default armhf deb for ros-indigo-cv-bridge sets different lib paths for setting the libraries in the cmake. For example, in the cv_bridgeConfig.cmake inside the .deb:

set(libraries "cv_bridge;/usr/lib/arm-linux-gnueabihf/libopencv_videostab.so;/usr/lib/arm-linux-gnueabihf/libopencv_video.so;.....

needs to instead be

set(libraries "cv_bridge;/usr/lib/libopencv_videostab.so;/usr/lib/libopencv_video.so;....

I took out the /arm-linux-gnueabihf/ out of the path because opencv4tegra libraries are installed in /usr/lib.

To get the cv-bridge debian so i could edit it, i did the following commands:

sudo apt-get install -d ros-indigo-cv-bridge                  ## -d just downloads, not install

cd /var/cache/apt/archives

sudo cp ros-indigo-cv-bridge_1.11.6-0trusty-20141201-2058-+0000_armhf.deb ~/Downloads

cd ~/Downloads

mkdir ros-indigo-cv-bridge-extracted

sudo dpkg-deb -R ros-indigo-cv-bridge_1.11.6-0trusty-20141201-2058-+0000_armhf.deb ros-indigo-cv-bridge-extracted

All dpkg-deb -Rdoes is extracts the .deb WITH the DEBIAN folder so that you can edit the DEBIAN/control file. In the control file, i deleted a few things: libopencv-dev, libopencv-python, libopencv-core2.4, libopencv-imgproc2.4, since these were all already installed by opencv4tegra debian.

Once i edited all those things, i think built the package like so:

sudo dpkg-deb -b ros-indigo-cv-bridge-extracted ros-indigo-cv-bridge-tegra_1.11.6-l0g1x-2.deb

and then finally just use sudo dpkg -i ros-indigo-cv-bridge-tegra_1.11.6-l0g1x-2.deb to install it.

I dont think i missed any steps, but attached is where the .deb file i made is. Just use dpkg -i to install it (after CUDA and opencv4tegra have been installed)

It would be nice if the ros arm buildfarm actually had a cv-bridge debian for the jetson.. maybe?

EDIT1: I wanted to clarify when i edit the DEBIAN/control file; when i say i "removed" libopencv-dev, libopencv-python, libopencv-core2.4, libopencv-imgproc2.4, all the re-movement does is remove what dependencies the package installer should check for;

EX) if there is a dependency listed in the control file, and the package manager sees that it is not installed on the system it will try to install that dependency (separately, like as its own .deb file). So since we know that libopencv-dev, libopencv-python, libopencv-core2.4, libopencv-imgproc2.4 is already installed from the opencv4tegra .deb , we can remove them from the 'Depends:' line in DEBIAN/control

EDIT 2: Steps to take if you just download the .deb i made:

sudo dpkg -i <my_file>.deb

sudo apt-get update

sudo apt-get install libopencv4tegra libopencv4tegra-dev

EDIT 3: The modified cv-bridge.deb i made is only a quick fix/hack. I am currently working on making a permanent fix by modifying just the oepncv4tegra.deb, so that you wont have to use the quick fix cv-bridge hack and can update cv-bridge whenever with apt-get upgrade. Should have this done within the next day or two. For now i have rearranged things around so opencv4tegra libs actually in fact ... (more)

edit flag offensive delete link more

Comments

1

Great work... I'm going to test your deb file. Only a doubt: cv_bridge depends only on libopencv-dev, libopencv-python, libopencv-core2.4 and libopencv-imgproc2.4? Nothing from the otther OpenCV modules?

Myzhar gravatar image Myzhar  ( 2015-02-11 09:05:12 -0500 )edit
1

i dont believe i saw anything about opencv modules listed in the DEBIAN/control file, there are a few other packages the cv bridge relies on but only anything opencv related, i took out (i will try to correct it later rather then remove the listed dependencies)

l0g1x gravatar image l0g1x  ( 2015-02-11 09:26:11 -0500 )edit

@l0g1x you modified the deb file to remove the dependencies on "standard OpenCV"... let's make the next step: let's add dependencies on opencv4tegra-repo_l4t, opencv4tegra and opencv4tegra-dev. In this way we are sure to install it correctly. Don't you think?

Myzhar gravatar image Myzhar  ( 2015-02-12 01:23:30 -0500 )edit

@l0g1x I followed your guide and create my own deb since you need to change the versione of the library to prevent apt-get to update it with ros-indigo-cv-bridge from repository. So for cv-bridge we are ok... but there are a lot of other packages under ROS that relies on OpenCV...

Myzhar gravatar image Myzhar  ( 2015-02-12 12:09:13 -0500 )edit

... so we must create a fake "deb" for each one of them :-| Try for example sudo apt-get install ros-indigo-rgbd-launch ros-indigo-openni2-camera ros-indigo-openni2-launch we must to find a way to tell to apt-get that OpenCV is installed.

Myzhar gravatar image Myzhar  ( 2015-02-12 12:11:05 -0500 )edit

The list of packages to be modified is the following: Actually the list of packages to be hacked is the following: ros-indigo-cv-bridge ros-indigo-depth-image-proc ros-indigo-image-geometry ros-indigo-image-proc ros-indigo-openni2-launch ros-indigo-rgbd-launch

Myzhar gravatar image Myzhar  ( 2015-02-12 12:55:53 -0500 )edit

ros-indigo-rqt-common-plugins ros-indigo-rqt-image-view
ros-indigo-rqt-robot-plugins ros-indigo-rqt-rviz ros-indigo-rviz

Myzhar gravatar image Myzhar  ( 2015-02-12 12:56:01 -0500 )edit

yup, i was well aware of this. The fix i put up is only a quick hack that did the job in order to just use opencv. It will most definetely break if you update. Im working on a more permanent fix now, where only thing that will have to be modified is the opencv4tegra.deb, not the cv-bridge deb

l0g1x gravatar image l0g1x  ( 2015-02-12 15:45:26 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-02-07 05:26:17 -0500

Seen: 5,154 times

Last updated: Feb 12 '15