Reputation: 113
Does anyone know what is the simplest way to extract the gray-level depth images of Kinect using OpenCV and C++? any source code in this field?
Upvotes: 0
Views: 1543
Reputation: 4525
You need to do two things (apart from reading about context, depth generator and initialization of Kinect):
Here is how histogram equalization is implemented in openNI2: https://github.com/OpenNI/OpenNI2/blob/master/Samples/Common/OniSampleUtilities.h
Upvotes: 0
Reputation: 1776
The documentation has everything you need. Can't elaborate better than this.
Upvotes: 0
Reputation: 1786
if you use OpenNI SDK, you can simply point to the buffer:
//on setup:
xn::DepthGenerator depthGenerator;
xn::DepthMetaData depthMD;
cv::Mat depthWrapper;
//on update loop,
//after context.WaitAnyUpdateAll();
depthGenerator.GetMetaData(depthMD);
depthWrapper = cv::Mat(depthMD.YRes(), depthMD.XRes(), CV_16UC1, (void*) depthMD.Data());
note that depthWrapper
is const so you need to clone it in order to manipulate it
Upvotes: 1