Ask Your Question

Revision history [back]

OpenCV 2.4.9 + Asus Xtion Pro Live

I'm trying to use a Xtion Pro Live Sensor with opencv ver. 2.4.9 for processing images. I'm using Visual Studio 2010 on Win7 64 Bit, however i'm building 32 Bit projects on VC2010 (Can I do this with the Asus Camera or do I need to use 64 Bit applications?). I installed the drivers on the CD (Primesense,Nite, OpenNI 1.5.4) and the Xtion Pro Live is also shown in the device manager as "Primesense 1080". Using the sample "NiSimpleViewer" works, however when I'm using my own code with opencv (Code below), I cant get a connection to the sensor (returns NULL).

include "cv.h"

include "highgui.h"

include "iostream"

include "stdio.h"

using namespace cv; using namespace std;

int main(){

CvCapture* capture = cvCaptureFromCAM(CV_CAP_OPENNI_ASUS);
CvCapture* test = cvCreateCameraCapture(CV_CAP_OPENNI_ASUS);
for(int i=0; i<1000;i++){
VideoCapture cap(i);
if(cap.isOpened()){
    printf("Device opened");
    int save = i;
    }
}

waitKey(300);
if (capture){
    cout<<"Device opened";
}
waitKey(300);

cvReleaseCapture( &capture );
cvDestroyWindow( "Example" );

}

As you can see, I also tried with a for loop, to check all possibilities (as -1 and 0 didn't work).