Part of a collection of Kinect hacks and tools by Mike Bourgeous.
kinradar displays a colored ASCII-art radar-like distance view, simulating an overhead and/or side view of the room. The intensity of each ASCII-art pixel is determined by the strength of the reflected signal at that distance (i.e. the number of depth samples falling within that pixel's corresponding 3D volume). The considered vertical area of the image can be restricted.
A depth sample's corresponding location in 3D space is calculated by assuming a 70 degree horizontal field of view, resulting in the following formula for X:
x_world = (320 - x_image) * tan(35) * z / 320
You will need libfreenect from the OpenKinect project to compile kinradar.
Compiling and Running
$ make # Show a basic radar display $ ./kinradar # Show a high-res display $ xterm -fs 6 -fa 'Bitstream Vera Sans Mono' -geometry 257x92 -e ./kinradar -g 256 -G 88
Usage: ./kinradar [-gG divisions] [-yY pixels] [-zZ distance] [-hv] Use any of: g - Set horizontal grid divisions G - Set vertical grid divisions y - Set top of active area in screen pixels (inclusive) (0-479) Y - Set bottom of active area in screen pixels (exclusive) (0-480) z - Set near clipping plane in meters (default 0.5) Z - Set far clipping plane in meters (default 6.0) h - Show horizontal (overhead) view only v - Show vertical (side) view only Press Ctrl-C (or send SIGINT) to quit.
kinradar looks a lot better at larger sizes (at least 96 wide) and when in motion. The static image here doesn't do it justice, nor can you see the colors.
$ ./kinradar -Z 7 -h kinradar.c:151: depth(): time: 1576792434 frame: 1255 top: 0 bottom: 480 kinradar.c:153: depth(): popmax: 6808 out: 11% / \ / \ / +\. / %88. +\ /+888-+ \ / 8+888 \ / \ / -88888%\ / +8888888888- . \ /--. -. \ /... \ / . \ / - \ / \ / \ / \ / \. / .\ /-. .8\ / .---. 8 \ /-%+%+-...-888% .. .8 \ /..++++%+--. + ..8%%%+%888%%8%++++--. + \ / . % ---++-+--+++-+++%%+ -. \ / . - \ / .. . \ / .. \ / \ / . \ / \ / . \ / .. \ / -. ... \
(C)2011 Mike Bourgeous, licensed under GPLv2 or later