Ask Your Question

Run Asus Xtion with HighGUI - HOWTO?!

asked 2013-10-01 07:32:01 -0500

MikeStrike gravatar image

updated 2013-10-01 07:36:35 -0500

berak gravatar image


I am trying to make the Asus Xtion pro live work with my computer. I am using ubuntu 12.04 with Opencv I have been trying this for quite some time now but I cannot make it work.

I downloaded the the tools from a. PrimeSense Software Package : 1. OpenNI Framework (Version 2. Sensor DDK (version 3. NITE (version 4. USB driver (version

Then I followed the installation instructions and tried to run the Xtion in NiViewer, which works fine. After that I wanted to make the example code on run.

But when I try to run the code, I get the the error Message "Can not open a capture object", which is cause by

if( isVideoReading ) filename );
    else );

    cout << "done." << endl;

    if( !capture.isOpened() )
        cout << "Can not open a capture object." << endl;
        return -1;

This is what is mentioned in 2. on How can I change the CMake variables in Codeblocks? I have no CMakeLists.txt as I just created an empty project and added a .cpp file.


edit retag flag offensive close merge delete


first, make a quick test, to see if openni support was built into your cv libs:

cout << cv::getBuildInformation() << endl;

if not so, you have to rebuild opencv using cmake. like in 2.

" I have no CMakeLists.txt as I just created an empty project and added a .cpp file."

yea, all that is about rebuilding opencv, not your test-program

berak gravatar imageberak ( 2013-10-01 07:44:08 -0500 )edit

Thanks for the quick reply! BuildInformation() gave me the following: with getBuildInformation()

Video I/O: OpenNI: NO OpenNI PrimeSensor Modules: NO

sorry for the stupid question, but does that mean it is not supported or just no activated? And when I reinstall opencv, do I have to uninstall the current version first or can I just rebuild it using cmake?

MikeStrike gravatar imageMikeStrike ( 2013-10-01 08:08:04 -0500 )edit

"does that mean is is not supported or just no activated?" - not activated, you'll have to rebuild.

"do I have to uninstall the current version first ?" if you did not build it yourself, - probably.

berak gravatar imageberak ( 2013-10-01 08:16:46 -0500 )edit

thank you very much! It works now :).

MikeStrike gravatar imageMikeStrike ( 2013-10-02 08:38:43 -0500 )edit

hey, cool ;)

berak gravatar imageberak ( 2013-10-02 08:47:10 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2015-07-27 11:04:14 -0500

lakehanne gravatar image

Put this debugging line, cout << cv::getBuildInformation() << endl;, in your code, right before

if( !capture.isOpened() )
    cout << "Can not open a capture object." << endl;
    return -1;

That will let you know if your opencv is installed with openni. If switches,

OpenNI:                      YES (ver 1.5.4, build 0)
OpenNI PrimeSensor Modules:  YES (/usr/lib/

are NO in your case, then you might want to consider recompiling your opencv modules with the cmake flag -D WITH_OPENNI=ON.


edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2013-10-01 07:32:01 -0500

Seen: 1,789 times

Last updated: May 19 '14