This project is read-only.
Here goes a little code snippet for ensuring your color and depths streams will be synchronized. It was taken (and properly adapted here) from the sample program GreenScreen, bundled with the last Kinect Developer Toolkit (v.1.5.2).

bool isNSync = false;

// Depth is 30 fps.  For any given combination of FPS, we should ensure we are within half a frame of the more frequent of the two.  
// But depth is always the greater (or equal) of the two, so just use depth FPS.
const int depthFps = 30;
const int halfADepthFrameMs = (1000 / depthFps) / 2;

// If the color frame is more than half a depth frame ahead of the depth frame we have,
// then we should wait for another depth frame.  Otherwise, just go with what we have.
if (m_colorTimeStamp.QuadPart - m_depthTimeStamp.QuadPart > halfADepthFrameMs)
    isNSync = true;
And remember to save the timestamp when you process your frames, like this:

hr = m_pNuiSensor->NuiImageStreamGetNextFrame(m_pColorStreamHandle, 0, &imageFrame);
m_colorTimeStamp = imageFrame.liTimeStamp;

A notable remark is this note from Kinect SDK v1.5 Release Notes:
Depth and color frames are now kept in sync. The Kinect for Windows runtime continuously monitors the depth and color streams and ensures that there is minimal drift between them.
It leads us to think they already do the kind of processing I showed you on the snippet. Nonetheless, this code is still present in the GreenScreen example up to the 1.5.2 release, so I think a good rule of thumb is to still use that - clearly there's will be no performance impact in your application.

Last edited Mar 14, 2013 at 6:06 PM by cmdalbem, version 6


No comments yet.