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

kinect: Use ROS+openCV and openCV without ROS same time

asked 2013-02-02 08:56:11 -0500

HanSolow gravatar image


I discovered the following problem for my delelopments:

Sometimes I need to develop kinect-applications with ROS (and openCV) and sometimes I just need openCV for my apps (no use of ROS this time).

Working with ROS+openCV+kinect works fine, but when I change to openCV-dev. only I can't get any connection to the kinect-cam.

For using openCV directly with the kinect I have to recompile openCV with the flag "with_openni" set to 1 (http: //

After doing so, for example I tried this file here:

https: //

Result when ROS (and the included openCV) is installed :

This program demonstrates usage of depth sensors (Kinect, XtionPRO,...). The user gets some of the supported output images.

All supported output map types: 1.) Data given from depth generator OPENNI_DEPTH_MAP - depth values in mm (CV_16UC1)
OPENNI_DISPARITY_MAP - disparity in pixels (CV_8UC1)
OPENNI_DISPARITY_MAP_32F - disparity in pixels (CV_32FC1)
OPENNI_VALID_DEPTH_MASK - mask of valid pixels (not ocluded, not shaded etc.) (CV_8UC1) 2.) Data given from RGB image generator OPENNI_BGR_IMAGE
- color image (CV_8UC3) OPENNI_GRAY_IMAGE - gray image (CV_8UC1)

Device opening ... done. Can not open a capture object.

When I uninstall ROS and the openCV comming along with it, the example linked above works just fine. - When only ROS/opencv or openCV standalone are installed each program works for itself, But with both installed using the kinect with opencv directly does not work.

Do you have any suggentions how to solve this issue?

My OS: Ubuntu 12.04.01 x64


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-10-06 16:02:53 -0500

tfoote gravatar image

Newer versions of ROS now use the system version of OpenCV. You can replace or upgrade that version, but if you do so any package built on top of it will need to be rebuilt from source.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-02-02 08:56:11 -0500

Seen: 518 times

Last updated: Oct 06 '14