0

I have a OpenCV project written with OpenCV 2.4.6 (Without OpenNI) in Visual studio 2012.

Project uses integrated webcam but now I want to use Kinect camera for RGB frames instead of webcam.

  1. Is it possible to use Kinect prime sense camera without using OpenNI installed?
  2. Do I need to install OpenNI and link it to OpenCV and all stuff just to use RGB camera from Prime sense device?

Currently I am writing following code:

VideoCapture capture(CV_CAP_OPENNI); // I have tried with capture(0), capture(1)

if(!(capture.isOpened())){
    cout << "OPENCV:Cannot open the WebCamera" << endl;
    return -1;
}

And result is that it's not able to open capture and it fails here. I am new to all this and please explain if I need to install anything or include anything? I have already installed Prime sense drivers. Thanks.

2 Answers2

2

You can read data from the Kinect sensor using any of these 3 methods,

  1. Microsoft Kinect for Windows SDK
  2. OpenKinect's libfreenect API
  3. OpenNI + OpenKinect

For further reference, I would like to direct you to this topic: How to take kinect video image and depth image with openCV c++?

HTH

Community
  • 1
  • 1
scap3y
  • 1,188
  • 10
  • 27
  • Thanks for link. but is there not any way to treat prime sense cam as web cam and it should work? – UnresolvedSymbols Nov 21 '13 at 20:12
  • No, because the data format coming from Kinect and a normal camera are completely different. You will need a reader class that can read the image properly. – scap3y Nov 21 '13 at 20:13
0
  1. NO ( if you're trying VideoCapture capture(CV_CAP_OPENNI); it just depends on that. there's libfreenect or such as well, but that's another story.. )

  2. YES ( that's why it failed, probably ) .

also check: cout << cv::getBuildInformation(); to see, if your opencv libs were build with openni support:

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

you'll have to rebuild opencv from src(with openni sdk installed) , if the answer is 'no' there

berak
  • 39,159
  • 9
  • 91
  • 89
  • Thanks for your answer. I will have to install openNI! – UnresolvedSymbols Nov 21 '13 at 20:17
  • again, @scap3y's answer's worth considering, too. if you already got any of the other frameworks installed, it's more a matter of making a cv::Mat from *their* capture method, instead of using VideoCapture – berak Nov 21 '13 at 20:23