0
$\begingroup$

Rosanswers logo

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/topic/779315/jetson-tk1-opencv-and-ros/

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 ;)


Originally posted by Myzhar on ROS Answers with karma: 541 on 2015-02-07

Post score: 1


Original comments

Comment by l0g1x on 2015-02-10:
which L4T version are you on?

Comment by Myzhar on 2015-02-10:
@l0g1x I'm using the latest 21.2.2 hacked with TheGrinch kernel

Comment by l0g1x on 2015-02-10:
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.

Comment by l0g1x on 2015-02-10:
Not next to my board right now, but i will post instruction later on today if i figure it out

Comment by Myzhar on 2015-02-10:
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/software/configuration-nvidia-jetson-tk1/

Comment by Myzhar on 2015-02-10:
Naturally I will be really happy to post a link to "you" (website, blog, ecc) thanking for the help

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Please refer to the solution here.

https://devtalk.nvidia.com/default/topic/835118/embedded-systems/incorrect-configuration-in-opencv4tegra-debian-packages-and-solution


Originally posted by davywb with karma: 26 on 2015-05-26

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$
0
$\begingroup$

Rosanswers logo

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 go in the /usr/lib/arm-linux-gnueabihf/ folder where they should be. Im trying to see if i can get this to work without a dummy package, but if there isnt another way, the dummy package will be included inside the opencv4tegra-modified.deb so that it will automatically install with everything.


Originally posted by l0g1x with karma: 1526 on 2015-02-11

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by Myzhar on 2015-02-11:
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?

Comment by l0g1x on 2015-02-11:
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)

Comment by Myzhar on 2015-02-12:
@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?

Comment by Myzhar on 2015-02-12:
@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...

Comment by Myzhar on 2015-02-12:
... 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.

Comment by Myzhar on 2015-02-12:
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

Comment by Myzhar on 2015-02-12:
ros-indigo-rqt-common-plugins ros-indigo-rqt-image-view
ros-indigo-rqt-robot-plugins ros-indigo-rqt-rviz ros-indigo-rviz

Comment by l0g1x on 2015-02-12:
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

Comment by Myzhar on 2015-02-12:
I think this can be the right way and it can be submitted as a possible solution to NVidia developers. I'm trying to understand how to manipulate it... The only way is to call it like "original" OpenCV with a version and a date a little major...

Comment by sam26 on 2017-03-31:
Hi! I have installed ros-kinetic-desktop and I find that my cv-bridge doesn't depend on any of the public opencv packages. These packages are in cache but not installed with ROS. I am looking to run a cv application in ros to check if the system opencv packages are compatible with ROS.

Comment by sam26 on 2017-03-31:
Any help on how I can go about it. Install opencv packages manually? If yes, what exactly are the packages to be installed. Post installation, how do I ensure that the version of opencv packages in my system are working with ROS ( any simple sample application I can run ) Thank you in advance

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.