For those who aren’t already aware, TKinect was updated on the SVN repository on Friday 14th January 2011. It now includes a means of determining the real distance of any point on the Depth image…
begin
Caption := Format('Center: %dmm', [Kinect1[0].MotionTracker.Depth[320, 240].Z_MM]);
end;
The code sample above shows how to retrieve the distance between your Kinect controller and whatever is focused in the exact center of the frame… 320 represents the exact center of the frame horizontally (X axis), whilst 240 represents the exact center of the frame vertically (Y axis). The Z_MM property presents the Range to Target at the aforementioned co-ordinates in millimeters. Please keep in mind that whilst the value is in millimeters, the precision of depth values provided by the Kinect reduces over distance. I can state with certainty that my tests here confirm precision over 3.2 meters of around 1 centimeter… more than sufficient for the types of usage envisioned for the Kinect controller.
Illustrating the changes…
The image to the left (click on it for a full-size version) shows the current state of my TKinect demo. I have censored the RGB image to continue my legacy of not having a single identifiable image of myself on the Internet. From left-to-right, top-to-bottom, the form contains the following… The (slightly) processed Depth image which, at present, displays a Fuchsia blob for the nearest point, and a Red blob for the farthest.
To its immediate right are some basic controls and displays: Device Selection ComboBox, LED Color ComboBox, the Up and Down buttons alter the vertical alignment of the Kinect’s motor, the Play/Stop buttons (Motion Track, Accelerometer, RGB Cam, Depth Cam) will soon be put into use and do exactly what the glyphs suggest. Beneath the Play/Stop buttons there are two TSlider controls side-by-side… the one on the left allows you to specify the Minimum Tracking Range, the one to its immediate right – imaginatively enough – allows you to specify the Maximum Tracking Range….
Ranges are another new introduction to TKinect… they are destined to be used by the integrated Motion Tracking Subsystem. When one or more ranges are specified, TKinect will ignore all points of data outside of those ranges… this makes Motion Tracking more accurate and – more importantly – better optimized.
Below the Range controls (Bottom-Left) you can see the standard Kinect Depth Buffer rendered on a TBitmap32 canvas (TImage32 from the Graphics32 library). To the right, hidden by the black censored box as explained earlier, is the RGB camera output (a normal, unaltered RGB feed from the Kinect’s regular webcam).
What happens next?
Well, the next stage of TKinect’s development is the introduction of Geometry Extraction for the Motion Tracking Subsystem. Ostensibly, this means that TKinect will analyze each Depth frame and create an Array of Object Geometries (individual – distinct – objects within the field of view) in order to enable precise tracking of them independently.
A Frame Buffer (already introduced) stores the current frame along with n previous frames (minimum of two). Each time a new frame is processed, it is compared (using as as-yet incomplete algorithm) with the previous frames in the buffer to determine where each Object is, how fast (on the X, Y, and Z axis respectively) it is moving, and where the Object is likely to be over any given period of time (Prediction).
Once this is completed, TKinect will embody virtually everything you would need to produce a Motion Controlled System for both two- and three-dimensional applications.
I would, again, like to thank Embarcadero for their generous sponsorship of this project, as well as my co-developer on this aspect of TKinect, Aleks. It must be acknowledged that TKinect would be but a shadow of its intended self without their collective support.



January 14, 2011 at 9:06 pm
One of the coolest software development projects I have seen in a while, and it is all written in Delphi. Gotta love it.
March 4, 2012 at 6:40 pm
Hello Simon,
Could you send me the source code, please?
Best regards,
Daniel
March 5, 2012 at 8:35 am
The original TKinect code is available on the SVN, as is the start of “TKinect2″ (the latter using the official Kinect SDK).
These codebases are both deprecated, with the GeNUI project (the new name of TKinect) in development to support the Kinect and ALL PrimeSense devices.