I have built opencv with OpenNI support to grab (rgb and depth) images directly from the kinect. I am using the Kinect for windows version with the near mode feature.
I use the PrimeSense driver for the kinect.
Unfortunately, the depth images shows some errors: Some objects are duplicated in the depth image. The rgb image is fine.
I suspect that it may have to do with the near mode feature not being enabled. Is there a way to do this using opencv?
I use the following code to grab and display both the rgb and the depth image:
while(1)
{
Mat depthImage;
Mat bgrImage;
capture.grab();
capture.retrieve(depthImage, CV_CAP_OPENNI_DEPTH_MAP );
capture.retrieve(bgrImage, CV_CAP_OPENNI_BGR_IMAGE );
namedWindow("depth", 1);
namedWindow("bgr", 1);
imshow("depth", depthImage);
imshow("bgr", bgrImage);
if (waitKey(30) >= 0) break;
}
Any hints are greatly appreciated :)