Openni error opening video stream [closed]

asked 2013-02-11 01:08:29 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I have Ubuntu 12.04 LTS 64bits. Since 1 or 2 month I use ros fuerte. I capture from matlab using the following mex: The first time that i opened stream it work fine, but the second time didn't, I need to restart my computer. To try to solve solve the problem I reinstall ubuntu and install ros groovy. Now the problem is bigger I can not run any time. I try to run Example and I have the following error:

Example Open failed: Bad Parameter sent to the device! Error using mxNiCreateContext Kinect Error

Error in Example (line 10) KinectHandles=mxNiCreateContext(SAMPLE_XML_PATH);

The xml config file doesn't change. The XML code is:

    <License vendor="PrimeSense" key="0KOIk2JeIBYClPWVnMoRKn5cdY4="/>       
<Log writeToConsole="false" writeToFile="false">
    <!-- 0 - Verbose, 1 - Info, 2 - Warning, 3 - Error (default) -->
    <LogLevel value="2"/>
        <Mask name="ALL" on="true"/>
    <Node type="Image" name="Image1">
            <MapOutputMode xRes="640" yRes="480" FPS="30"/>
            <Mirror on="true"/>
    <Node type="Depth" name="Depth1">
            <MapOutputMode xRes="640" yRes="480" FPS="30"/>
            <Mirror on="true"/>
    <Node type="Audio" name="Audio1">


I have done programs that use openni and they also do not run but compile. The source code is the following:

int key;

XnStatus result = XN_STATUS_OK;  
xn::DepthMetaData depthMD;
xn::ImageMetaData imageMD;

IplImage*  imgDepth16u=cvCreateImage(cvSize(640,480),IPL_DEPTH_16U,1);
IplImage* imgRGB8u=cvCreateImage(cvSize(640,480),IPL_DEPTH_8U,3);
IplImage* imageShow=cvCreateImage(cvSize(640,480),IPL_DEPTH_8U,3);
IplImage*  depthShow=cvCreateImage(cvSize(640,480),IPL_DEPTH_8U,1);


xn::Context context; 
result = context.Init(); 
//CheckOpenNIError( result, "initialize context" );  

// creategenerator  
xn::DepthGenerator depthGenerator;  
result = depthGenerator.Create( context ); 
//CheckOpenNIError( result, "Create depth generator" );  
xn::ImageGenerator imageGenerator;
result = imageGenerator.Create( context ); 
//CheckOpenNIError( result, "Create image generator" );

//map mode  
XnMapOutputMode mapMode; 
mapMode.nXRes = 640;  
mapMode.nYRes = 480; 
mapMode.nFPS = 30; 
result = depthGenerator.SetMapOutputMode( mapMode );    
result = imageGenerator.SetMapOutputMode( mapMode );  

//read data

result = context.StartGeneratingAll(); 
while(!(result = context.WaitAndUpdateAll( ))) 
    //get meta data

    //convert to OpenCV output

    cvShowImage("depth", depthShow);
    //delay for update the imshow


I tried also to run roslaunch openni_launch openni.launch and I can not see anything.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2015-10-30 17:51:58.043739