Using Kinect with Opencv 3.0.0
Hello I am trying to get disparity maps from a Microsoft kinect for xbox 360. I have opencv 3.0.0 and openni2 with libfreenect installed. When I run my code
#include "opencv2/opencv.hpp"
using namespace cv;
int main(int, char**){
VideoCapture capture( CAP_OPENNI2 );
namedWindow("win",1);
for(;;){
Mat depthMap;
capture >> depthMap;
imshow("win",depthMap);
if( waitKey( 30 ) >= 0 ) break;
}
return 0;
}
My kinect starts projecting the IR pattern but then I get a bunch of errors
OpenNI2-FreenectDriver: Using libfreenect v0.5.3
OpenNI2-FreenectDriver: Found device freenect://0
OpenNI2-FreenectDriver: Opening device freenect://0
[Stream 70] Negotiated packet size 1920
write_register: 0x0105 <= 0x00
write_register: 0x0006 <= 0x00
write_register: 0x0012 <= 0x03
write_register: 0x0013 <= 0x01
write_register: 0x0014 <= 0x1e
write_register: 0x0006 <= 0x02
write_register: 0x0017 <= 0x00
[Stream 80] Negotiated packet size 1920
write_register: 0x000c <= 0x00
write_register: 0x000d <= 0x01
write_register: 0x000e <= 0x1e
write_register: 0x0005 <= 0x01
[Stream 70] Lost 2 total packets in 0 frames (inf lppf)
[Stream 70] Lost 5 total packets in 0 frames (inf lppf)
write_register: 0x0047 <= 0x00
OpenNI2-FreenectDriver: (ERROR) Unexpected size for XN_STREAM_PROPERTY_ZERO_PLANE_DISTANCE
OpenCV Error: Unspecified error (CvCapture_OpenNI2::readCamerasParams : Could not read virtual plane distance! ) in readCamerasParams, file /home/ubuntu/opencv-3.0.0/modules/videoio/src/cap_openni2.cpp, line 379 terminate called after throwing an instance of 'cv::Exception' what(): /home/ubuntu/opencv-3.0.0/modules/videoio/src/cap_openni2.cpp:379: error: (-2) CvCapture_OpenNI2::readCamerasParams : Could not read virtual plane distance! in function readCamerasParams
Aborted