<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TupperBot.com</title>
	<atom:link href="http://www.tupperbot.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.tupperbot.com</link>
	<description>Invent the present; design the future.</description>
	<lastBuildDate>Sun, 15 Apr 2012 03:57:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Kinect: Simple way to get the Depth Stream (Source Code)</title>
		<link>http://www.tupperbot.com/?p=133</link>
		<comments>http://www.tupperbot.com/?p=133#comments</comments>
		<pubDate>Mon, 13 Feb 2012 00:46:59 +0000</pubDate>
		<dc:creator>Mif</dc:creator>
				<category><![CDATA[Kinect]]></category>
		<category><![CDATA[Kinect SDK]]></category>
		<category><![CDATA[Programacion]]></category>
		<category><![CDATA[Source coce]]></category>

		<guid isPermaLink="false">http://www.tupperbot.com/?p=133</guid>
		<description><![CDATA[On February 1st, Microsoft released the first official version of the Kinect SDK and It is better than ever!
If you are starting to play with this cool &#8220;toy&#8221;, you are probably finding many problems in your way. I have been struggling with WPF and its way to paint stuff on the screen for a while [...]]]></description>
			<content:encoded><![CDATA[<p>On February 1st, Microsoft released the first official version of the Kinect SDK and It is better than ever!</p>
<p>If you are starting to play with this cool &#8220;toy&#8221;, you are probably finding many problems in your way. I have been struggling with WPF and its way to paint stuff on the screen for a while now, and these two things are quite basic when we talk about the Kinect.</p>
<p>So this afternoon, my friend <a href="http://www.jesusdc.com/" target="_blank">Jesús Domínguez</a> gave me a call asking me for my old Kinect projects. He just bought a new Kinect and wanted to use the latest SDK.</p>
<p style="text-align: left; ">I have been always interested in this device, so we spent this cold afternoon trying to simplify Microsoft&#8217;s code in order to give you the <strong>simplest</strong>, <strong>shortest</strong>, and <strong>easiest</strong> source code you can use to get the <strong>Depth stream</strong> from the Kinect.<br />
<a rel="attachment wp-att-134" href="http://www.tupperbot.com/?attachment_id=134"><img class="aligncenter size-full wp-image-134" title="Captura" src="http://www.tupperbot.com/wp-content/uploads/2012/02/Captura.png" alt="Captura" width="522" height="400" /></a><span id="more-133"></span>You can download the full source code from this link:</p>
<p style="text-align: left; "><a href="http://www.tupperbot.es/download/WPFKinectTest.zip" target="_blank"><strong>DOWNLOAD SOURCE CODE</strong></a></p>
<p style="text-align: left; ">Here is all source code explained:</p>
<p style="text-align: left; ">
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:gray;mso-ansi-language:EN-US" lang="EN-US">///</span><span style="font-size:9.5pt;font-family:Consolas;color:green;mso-ansi-language: EN-US" lang="EN-US">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US">Kinect Depth Example<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US">Date: February 12th, 2012<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US">Authors:<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US"> &#8211; Jesus Dominguez:<br />
</span><span style="color: gray; font-family: Consolas; font-size: 9.5pt; ">/// <a href="http://www.jesusdc.com/">www.jesusdc.com<br />
</a>///<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US"> &#8211; Angel Hernandez:<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US"> <a href="http://twitter.com/mifulapirus" target="_blank">@mifulapirus</a><br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US"> <a href="http://www.tupperbot.com" target="_blank">www.tupperbot.com</a><br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US">All code is based on the Kinect Explorer Example.<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US">Summary:<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US">This is just a simplification of the Explorer Example code that comes<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US">with the final version of the Kinect SDK released by Microsoft in February.<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US">This example shows the minimum code required to get the depth image drawn in a WPF program.<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US">It is for sure not a perfect and super safe code, but it is just intended to show how to do<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US">this in a simple way.<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: gray; " lang="EN-US">///</span><span style="font-size: 9.5pt; font-family: Consolas; color: green; " lang="EN-US">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;mso-ansi-language:EN-US" lang="EN-US">using</span><span style="font-size:9.5pt;font-family:Consolas;mso-ansi-language:EN-US" lang="EN-US"> System;<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; " lang="EN-US">using</span><span style="font-size: 9.5pt; font-family: Consolas; " lang="EN-US"> System.Collections.Generic;<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; " lang="EN-US">using</span><span style="font-size: 9.5pt; font-family: Consolas; " lang="EN-US"> System.Windows;<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; " lang="EN-US">using</span><span style="font-size: 9.5pt; font-family: Consolas; " lang="EN-US"> System.Windows.Controls;<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; " lang="EN-US">using</span><span style="font-size: 9.5pt; font-family: Consolas; " lang="EN-US"> System.Windows.Data;<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; " lang="EN-US">using</span><span style="font-size: 9.5pt; font-family: Consolas; " lang="EN-US"> System.Windows.Input;<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; " lang="EN-US">using</span><span style="font-size: 9.5pt; font-family: Consolas; " lang="EN-US"> System.Windows.Media;<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; " lang="EN-US">using</span><span style="font-size: 9.5pt; font-family: Consolas; " lang="EN-US"> System.Windows.Media.Imaging;<br />
</span><span style="font-size: 9.5pt; font-family: Consolas; color: blue; " lang="EN-US">using</span><span style="font-size: 9.5pt; font-family: Consolas; " lang="EN-US"> Microsoft.Kinect;</span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size: 9.5pt; font-family: Consolas; color: blue; " lang="EN-US">namespace</span><span style="font-size: 9.5pt; font-family: Consolas; " lang="EN-US"> WPFKinectTest<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; ">{<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; color: gray; "> ///</span><span style="font-family: Consolas; font-size: 9.5pt; color: green; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: gray; ">&lt;summary&gt;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: gray; ">///</span><span style="font-family: Consolas; font-size: 9.5pt; color: green; "> Interaction logic for Window1.xaml<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: gray; ">///</span><span style="font-family: Consolas; font-size: 9.5pt; color: green; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: gray; ">&lt;/summary&gt;</span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;mso-ansi-language:EN-US" lang="EN-US"> <span style="color:blue">public</span> <span style="color:blue">partial</span> <span style="color:blue">class</span> <span style="color:#2B91AF">Window1</span> : <span style="color:#2B91AF">Window<br />
</span></span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">{<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//Declare some global variables<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">private</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">short</span><span style="font-family: Consolas; font-size: 9.5pt; ">[] pixelData;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">private</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">byte</span><span style="font-family: Consolas; font-size: 9.5pt; ">[] depthFrame32;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "><br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//The bitmap that will contain the actual converted depth into an image<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">private</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: #2b91af; ">WriteableBitmap</span><span style="font-family: Consolas; font-size: 9.5pt; "> outputBitmap;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">private</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">static</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">readonly</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">int</span><span style="font-family: Consolas; font-size: 9.5pt; "> Bgr32BytesPerPixel = (</span><span style="font-family: Consolas; font-size: 9.5pt; color: #2b91af; ">PixelFormats</span><span style="font-family: Consolas; font-size: 9.5pt; ">.Bgr32.BitsPerPixel + 7) / 8;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "><br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//Format of the last Depth Image.<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//This changes when you first run the program or whenever you minimize the window<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">private</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: #2b91af; ">DepthImageFormat</span><span style="font-family: Consolas; font-size: 9.5pt; "> lastImageFormat;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "><br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//Identify each color layer on the R G B<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">private</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">const</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">int</span><span style="font-family: Consolas; font-size: 9.5pt; "> RedIndex = 2;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">private</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">const</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">int</span><span style="font-family: Consolas; font-size: 9.5pt; "> GreenIndex = 1;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">private</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">const</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">int</span><span style="font-family: Consolas; font-size: 9.5pt; "> BlueIndex = 0;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "><br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//Declare our Kinect Sensor!<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; color: #2b91af; "> KinectSensor</span><span style="font-family: Consolas; font-size: 9.5pt; "> kinectSensor;</span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">public</span><span style="font-family: Consolas; font-size: 9.5pt; "> Window1()<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">{<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">InitializeComponent();</span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//Select the first kinect found<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">kinectSensor = </span><span style="font-family: Consolas; font-size: 9.5pt; color: #2b91af; ">KinectSensor</span><span style="font-family: Consolas; font-size: 9.5pt; ">.KinectSensors[0];</span><span style="font-family: Consolas; font-size: 9.5pt; "><br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//Set up the depth stream to be the largest possible<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">kinectSensor.DepthStream.Enable(</span><span style="font-family: Consolas; font-size: 9.5pt; color: #2b91af; ">DepthImageFormat</span><span style="font-family: Consolas; font-size: 9.5pt; ">.Resolution640&#215;480Fps30);</span><span style="font-family: Consolas; font-size: 9.5pt; "><br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//Initialize the Kinect Sensor<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">kinectSensor.Start();<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//Subscribe to an event that will be triggered every time a new frame is ready<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">kinectSensor.DepthFrameReady += </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">new</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: #2b91af; ">EventHandler</span><span style="font-family: Consolas; font-size: 9.5pt; ">&lt;</span><span style="font-family: Consolas; font-size: 9.5pt; color: #2b91af; ">DepthImageFrameReadyEventArgs</span><span style="font-family: Consolas; font-size: 9.5pt; ">&gt;(DepthImageReady);<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//Read the elevation value of the Kinect and assign it to the slider so it doesn&#8217;t look weird when the program starts<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">slider1.Value = kinectSensor.ElevationAngle;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">}<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "><br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: gray; ">///</span><span style="font-family: Consolas; font-size: 9.5pt; color: green; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: gray; ">&lt;summary&gt;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: gray; ">///</span><span style="font-family: Consolas; font-size: 9.5pt; color: green; "> DepthImageReady:<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: gray; ">///</span><span style="font-family: Consolas; font-size: 9.5pt; color: green; "> This function will be called every time a new depth frame is ready<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: gray; ">///</span><span style="font-family: Consolas; font-size: 9.5pt; color: green; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: gray; ">&lt;/summary&gt;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">private</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">void</span><span style="font-family: Consolas; font-size: 9.5pt; "> DepthImageReady(</span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">object</span><span style="font-family: Consolas; font-size: 9.5pt; "> sender, </span><span style="font-family: Consolas; font-size: 9.5pt; color: #2b91af; ">DepthImageFrameReadyEventArgs</span><span style="font-family: Consolas; font-size: 9.5pt; "> e)<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">{<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">using</span><span style="font-family: Consolas; font-size: 9.5pt; "> (</span><span style="font-family: Consolas; font-size: 9.5pt; color: #2b91af; ">DepthImageFrame</span><span style="font-family: Consolas; font-size: 9.5pt; "> imageFrame = e.OpenDepthImageFrame())<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">{<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//We expect this to be always true since we are coming from a triggered event<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">if</span><span style="font-family: Consolas; font-size: 9.5pt; "> (imageFrame != </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">null</span><span style="font-family: Consolas; font-size: 9.5pt; ">)<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">{<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//Check if the format of the image has changed.<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//This always happens when you run the program for the first time and every time you minimize the window<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">bool</span><span style="font-family: Consolas; font-size: 9.5pt; "> NewFormat = </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">this</span><span style="font-family: Consolas; font-size: 9.5pt; ">.lastImageFormat != imageFrame.Format;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "><br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">if</span><span style="font-family: Consolas; font-size: 9.5pt; "> (NewFormat)<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">{<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//Update the image to the new format<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">this</span><span style="font-family: Consolas; font-size: 9.5pt; ">.pixelData = </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">new</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">short</span><span style="font-family: Consolas; font-size: 9.5pt; ">[imageFrame.PixelDataLength];<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">this</span><span style="font-family: Consolas; font-size: 9.5pt; ">.depthFrame32 = </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">new</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">byte</span><span style="font-family: Consolas; font-size: 9.5pt; ">[imageFrame.Width * imageFrame.Height * Bgr32BytesPerPixel];<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "><br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//Create the new Bitmap<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">this</span><span style="font-family: Consolas; font-size: 9.5pt; ">.outputBitmap = </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">new</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: #2b91af; ">WriteableBitmap</span><span style="font-family: Consolas; font-size: 9.5pt; ">(<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">imageFrame.Width,<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">imageFrame.Height,<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">96,</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">// DpiX<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">96,</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">// DpiY<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: #2b91af; ">PixelFormats</span><span style="font-family: Consolas; font-size: 9.5pt; ">.Bgr32,<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">null</span><span style="font-family: Consolas; font-size: 9.5pt; ">);<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">this</span><span style="font-family: Consolas; font-size: 9.5pt; ">.kinectDepthImage.Source = </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">this</span><span style="font-family: Consolas; font-size: 9.5pt; ">.outputBitmap;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">}</span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;mso-ansi-language:EN-US" lang="EN-US"> <span style="color:green">//Copy the stream to its short version<br />
</span></span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">imageFrame.CopyPixelDataTo(</span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">this</span><span style="font-family: Consolas; font-size: 9.5pt; ">.pixelData);</span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//Convert the pixel data into its RGB Version.<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//Here is where the magic happens<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">byte</span><span style="font-family: Consolas; font-size: 9.5pt; ">[] convertedDepthBits = </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">this</span><span style="font-family: Consolas; font-size: 9.5pt; ">.ConvertDepthFrame(</span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">this</span><span style="font-family: Consolas; font-size: 9.5pt; ">.pixelData, ((</span><span style="font-family: Consolas; font-size: 9.5pt; color: #2b91af; ">KinectSensor</span><span style="font-family: Consolas; font-size: 9.5pt; ">)sender).DepthStream);<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "><br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//Copy the RGB matrix to the bitmap to make it visible<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">this</span><span style="font-family: Consolas; font-size: 9.5pt; ">.outputBitmap.WritePixels(<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">new</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: #2b91af; ">Int32Rect</span><span style="font-family: Consolas; font-size: 9.5pt; ">(0, 0, imageFrame.Width, imageFrame.Height),<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">convertedDepthBits,<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">imageFrame.Width * Bgr32BytesPerPixel,<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">0);</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;mso-ansi-language:EN-US" lang="EN-US"> <span style="color:green">//Update the Format<br />
</span></span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">this</span><span style="font-family: Consolas; font-size: 9.5pt; ">.lastImageFormat = imageFrame.Format;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">}<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: green; ">//Since we are coming from a triggered event, we are not expecting anything here, at least for this short tutorial<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: blue; ">else</span><span style="font-family: Consolas; font-size: 9.5pt; "> { }<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">}<br />
</span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; ">}</span></p>
<p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal;mso-layout-grid-align:none;text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;mso-ansi-language:EN-US" lang="EN-US"> </span><span style="font-family: Consolas; font-size: 9.5pt; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: gray; ">///</span><span style="font-family: Consolas; font-size: 9.5pt; color: green; "> </span><span style="font-family: Consolas; font-size: 9.5pt; color: gray; ">&lt;summary&gt;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:gray">///</span><span style="color:green"> ConvertDepthFrame:<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:gray">///</span><span style="color:green"> Converts the depth frame into its RGB version taking out all the player information and leaving only the depth.<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:gray">///</span><span style="color:green"> </span><span style="color:gray">&lt;/summary&gt;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">private</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">byte</span><span style="font-family: Consolas; font-size: 9.5pt;">[] ConvertDepthFrame(</span><span style="color:blue">short</span><span style="font-family: Consolas; font-size: 9.5pt;">[] depthFrame, </span><span style="color:#2B91AF">DepthImageStream</span><span style="font-family: Consolas; font-size: 9.5pt;"> depthStream)<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> {<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//Run through the depth frame making the correlation between the two arrays<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">for</span><span style="font-family: Consolas; font-size: 9.5pt;"> (</span><span style="color:blue">int</span><span style="font-family: Consolas; font-size: 9.5pt;"> i16 = 0, i32 = 0; i16 &lt; depthFrame.Length &amp;&amp; i32 &lt; </span><span style="color:blue">this</span><span style="font-family: Consolas; font-size: 9.5pt;">.depthFrame32.Length; i16++, i32 += 4)<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> {<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//We don&#8217;t care about player&#8217;s information here, so we are just going to rule it out by shifting the value.<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">int</span><span style="font-family: Consolas; font-size: 9.5pt;"> realDepth = depthFrame[i16] &gt;&gt; </span><span style="color:#2B91AF">DepthImageFrame</span><span style="font-family: Consolas; font-size: 9.5pt;">.PlayerIndexBitmaskWidth;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"><br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//We are left with 13 bits of depth information that we need to convert into an 8 bit number for each pixel.<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//There are hundreds of ways to do this. This is just the simplest one.<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//Lets create a byte variable called Distance.<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//We will assign this variable a number that will come from the conversion of those 13 bits.<br />
</span><span style="font-size:9.5pt;font-family:Consolas;mso-ansi-language:EN-US" lang="EN-US"> </span><span style="font-size:9.5pt; font-family:Consolas;color:blue">byte</span><span style="font-size:9.5pt; font-family:Consolas"> Distance = 0;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"><br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//XBox Kinects (default) are limited between 800mm and 4096mm.<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">int</span><span style="font-family: Consolas; font-size: 9.5pt;"> MinimumDistance = 800;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">int</span><span style="font-family: Consolas; font-size: 9.5pt;"> MaximumDistance = 4096;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"><br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//XBox Kinects (default) are not reliable closer to 800mm, so let&#8217;s take those useless measurements out.<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//If the distance on this pixel is bigger than 800mm, we will paint it in its equivalent gray<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">if</span><span style="font-family: Consolas; font-size: 9.5pt;"> (realDepth &gt; MinimumDistance)<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> {<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//Convert the realDepth into the 0 to 255 range for our actual distance.<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//Use only one of the following Distance assignments<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//White = Far<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//Black = Close<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//Distance = (byte)(((realDepth &#8211; MinimumDistance) * 255 / (MaximumDistance-MinimumDistance)));<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"><br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//White = Close<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//Black = Far<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> Distance = (</span><span style="color:blue">byte</span><span style="font-family: Consolas; font-size: 9.5pt;">)(255-((realDepth &#8211; MinimumDistance) * 255 / (MaximumDistance &#8211; MinimumDistance)));<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"><br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//Use the distance to paint each layer (R G &amp; B) of the current pixel.<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//Painting R, G and B with the same color will make it go from black to gray<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">this</span><span style="font-family: Consolas; font-size: 9.5pt;">.depthFrame32[i32 + RedIndex] = (</span><span style="color:blue">byte</span><span style="font-family: Consolas; font-size: 9.5pt;">)(Distance);<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">this</span><span style="font-family: Consolas; font-size: 9.5pt;">.depthFrame32[i32 + GreenIndex] = (</span><span style="color:blue">byte</span><span style="font-family: Consolas; font-size: 9.5pt;">)(Distance);<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">this</span><span style="font-family: Consolas; font-size: 9.5pt;">.depthFrame32[i32 + BlueIndex] = (</span><span style="color:blue">byte</span><span style="font-family: Consolas; font-size: 9.5pt;">)(Distance);<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> }<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"><br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//If we are closer than 800mm, the just paint it red so we know this pixel is not giving a good value<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">else<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> {<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">this</span><span style="font-family: Consolas; font-size: 9.5pt;">.depthFrame32[i32 + RedIndex] = 150;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">this</span><span style="font-family: Consolas; font-size: 9.5pt;">.depthFrame32[i32 + GreenIndex] = 0;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">this</span><span style="font-family: Consolas; font-size: 9.5pt;">.depthFrame32[i32 + BlueIndex] = 0;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> }<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> }<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//Now that we are done painting the pixels, we can return the byte array to be painted<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">return</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">this</span><span style="font-family: Consolas; font-size: 9.5pt;">.depthFrame32;<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> }<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"><br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//If you move the wheel of your mouse after the slider got the focus, you will move the motor of the kinect.<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//We have to be very careful doing this since the kinect might get unresponsive if we send this command too fast.<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">private</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">void</span><span style="font-family: Consolas; font-size: 9.5pt;"> slider1_MouseWheel(</span><span style="color: blue">object</span><span style="font-family: Consolas; font-size: 9.5pt;"> sender, </span><span style="color:#2B91AF">MouseWheelEventArgs</span><span style="font-family: Consolas; font-size: 9.5pt;"> e)<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> {<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//Calculate the new value based on the wheel movement<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">if</span><span style="font-family: Consolas; font-size: 9.5pt;"> (e.Delta &gt; 0) { slider1.Value = slider1.Value + 5; }<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:blue">else</span><span style="font-family: Consolas; font-size: 9.5pt;"> { slider1.Value = slider1.Value &#8211; 5; }<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> </span><span style="color:green">//Send the new elevation value to our Kinect<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> kinectSensor.ElevationAngle = (</span><span style="color:blue">int</span><span style="font-family: Consolas; font-size: 9.5pt;">)slider1.Value;<br />
</span><span style="font-size:9.5pt;font-family:Consolas;mso-ansi-language:EN-US" lang="EN-US"> </span><span style="font-size:9.5pt; font-family:Consolas">}<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;"> }<br />
</span><span style="font-family: Consolas; font-size: 9.5pt;">}<br />
</span></p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///Kinect Depth Example</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///Date: February 12th, 2012</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///Authors:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">/// &#8211; Jesus Dominguez:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">/// &#8211; Angel Hernandez:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///     @mifulapirus</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///     www.tupperbot.com</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///All code is based on the Kinect Explorer Example.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///Summary:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///This is just a simplification of the Explorer Example code that comes</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///with the final version of the Kinect SDK released by Microsoft in February.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///This example shows the minimum code required to get the depth image drawn in a WPF program.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///It is for sure not a perfect and super safe code, but it is just intended to show how to do</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///this in a simple way.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">///&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">using System;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">using System.Collections.Generic;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">using System.Windows;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">using System.Windows.Controls;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">using System.Windows.Data;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">using System.Windows.Input;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">using System.Windows.Media;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">using System.Windows.Media.Imaging;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">using Microsoft.Kinect;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">namespace WPFKinectTest</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">/// &lt;summary&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">/// Interaction logic for Window1.xaml</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">/// &lt;/summary&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">public partial class Window1 : Window</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Declare some global variables</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">private short[] pixelData;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">private byte[] depthFrame32;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//The bitmap that will contain the actual converted depth into an image</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">private WriteableBitmap outputBitmap;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">private static readonly int Bgr32BytesPerPixel = (PixelFormats.Bgr32.BitsPerPixel + 7) / 8;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Format of the last Depth Image.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//This changes when you first run the program or whenever you minimize the window</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">private DepthImageFormat lastImageFormat;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Identify each color layer on the R G B</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">private const int RedIndex = 2;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">private const int GreenIndex = 1;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">private const int BlueIndex = 0;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Declare our Kinect Sensor!</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">KinectSensor kinectSensor;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">public Window1()</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">InitializeComponent();</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Select the first kinect found</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">kinectSensor = KinectSensor.KinectSensors[0];</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Set up the depth stream to be the largest possible</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">kinectSensor.DepthStream.Enable(DepthImageFormat.Resolution640&#215;480Fps30);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Initialize the Kinect Sensor</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">kinectSensor.Start();</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Subscribe to an event that will be triggered every time a new frame is ready</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">kinectSensor.DepthFrameReady += new EventHandler&lt;DepthImageFrameReadyEventArgs&gt;(DepthImageReady);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Read the elevation value of the Kinect and assign it to the slider so it doesn&#8217;t look weird when the program starts</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">slider1.Value = kinectSensor.ElevationAngle;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">/// &lt;summary&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">/// DepthImageReady:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">/// This function will be called every time a new depth frame is ready</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">/// &lt;/summary&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">private void DepthImageReady(object sender, DepthImageFrameReadyEventArgs e)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">using (DepthImageFrame imageFrame = e.OpenDepthImageFrame())</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>//We expect this to be always true since we are coming from a triggered event</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">if (imageFrame != null)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Check if the format of the image has changed.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//This always happens when you run the program for the first time and every time you minimize the window</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">bool NewFormat = this.lastImageFormat != imageFrame.Format;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">if (NewFormat)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Update the image to the new format</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">this.pixelData = new short[imageFrame.PixelDataLength];</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">this.depthFrame32 = new byte[imageFrame.Width * imageFrame.Height * Bgr32BytesPerPixel];</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Create the new Bitmap</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">this.outputBitmap = new WriteableBitmap(</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">imageFrame.Width,</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">imageFrame.Height,</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">96,  // DpiX</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">96,  // DpiY</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">PixelFormats.Bgr32,</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">null);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">this.kinectDepthImage.Source = this.outputBitmap;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Copy the stream to its short version</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">imageFrame.CopyPixelDataTo(this.pixelData);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Convert the pixel data into its RGB Version.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Here is where the magic happens</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">byte[] convertedDepthBits = this.ConvertDepthFrame(this.pixelData, ((KinectSensor)sender).DepthStream);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span></div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Copy the RGB matrix to the bitmap to make it visible</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>this.outputBitmap.WritePixels(</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">new Int32Rect(0, 0, imageFrame.Width, imageFrame.Height),</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">convertedDepthBits,</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">imageFrame.Width * Bgr32BytesPerPixel,</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">0);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Update the Format</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">this.lastImageFormat = imageFrame.Format;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Since we are coming from a triggered event, we are not expecting anything here, at least for this short tutorial.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">else { }</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">/// &lt;summary&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">/// ConvertDepthFrame:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">/// Converts the depth frame into its RGB version taking out all the player information and leaving only the depth.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">/// &lt;/summary&gt;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">private byte[] ConvertDepthFrame(short[] depthFrame, DepthImageStream depthStream)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Run through the depth frame making the correlation between the two arrays</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">for (int i16 = 0, i32 = 0; i16 &lt; depthFrame.Length &amp;&amp; i32 &lt; this.depthFrame32.Length; i16++, i32 += 4)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//We don&#8217;t care about player&#8217;s information here, so we are just going to rule it out by shifting the value.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">int realDepth = depthFrame[i16] &gt;&gt; DepthImageFrame.PlayerIndexBitmaskWidth;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//We are left with 13 bits of depth information that we need to convert into an 8 bit number for each pixel.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//There are hundreds of ways to do this. This is just the simplest one.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Lets create a byte variable called Distance.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//We will assign this variable a number that will come from the conversion of those 13 bits.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">byte Distance = 0;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//XBox Kinects (default) are limited between 800mm and 4096mm.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">int MinimumDistance = 800;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">int MaximumDistance = 4096;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//XBox Kinects (default) are not reliable closer to 800mm, so let&#8217;s take those useless measurements out.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//If the distance on this pixel is bigger than 800mm, we will paint it in its equivalent gray</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">if (realDepth &gt; MinimumDistance)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Convert the realDepth into the 0 to 255 range for our actual distance.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Use only one of the following Distance assignments</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//White = Far</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Black = Close</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Distance = (byte)(((realDepth &#8211; MinimumDistance) * 255 / (MaximumDistance-MinimumDistance)));</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//White = Close</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Black = Far</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Distance = (byte)(255-((realDepth &#8211; MinimumDistance) * 255 / (MaximumDistance &#8211; MinimumDistance)));</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Use the distance to paint each layer (R G &amp; B) of the current pixel.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Painting R, G and B with the same color will make it go from black to gray</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">this.depthFrame32[i32 + RedIndex] = (byte)(Distance);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">this.depthFrame32[i32 + GreenIndex] = (byte)(Distance);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">this.depthFrame32[i32 + BlueIndex] = (byte)(Distance);</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//If we are closer than 800mm, the just paint it red so we know this pixel is not giving a good value</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">else</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">this.depthFrame32[i32 + RedIndex] = 150;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">this.depthFrame32[i32 + GreenIndex] = 0;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">this.depthFrame32[i32 + BlueIndex] = 0;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Now that we are done painting the pixels, we can return the byte array to be painted</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">return this.depthFrame32;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//If you move the wheel of your mouse after the slider got the focus, you will move the motor of the kinect.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//We have to be very careful doing this since the kinect might get unresponsive if we send this command too fast.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">private void slider1_MouseWheel(object sender, MouseWheelEventArgs e)</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">{</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Calculate the new value based on the wheel movement</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">if (e.Delta &gt; 0) { slider1.Value = slider1.Value + 5; }</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">else { slider1.Value = slider1.Value &#8211; 5; }</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">//Send the new elevation value to our Kinect</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">kinectSensor.ElevationAngle = (int)slider1.Value;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 29px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">}</div>
]]></content:encoded>
			<wfw:commentRss>http://www.tupperbot.com/?feed=rss2&amp;p=133</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TVE News</title>
		<link>http://www.tupperbot.com/?p=129</link>
		<comments>http://www.tupperbot.com/?p=129#comments</comments>
		<pubDate>Mon, 16 Jan 2012 17:49:16 +0000</pubDate>
		<dc:creator>Mif</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.tupperbot.com/?p=129</guid>
		<description><![CDATA[This is a small report made by TVE, the Spanish National TV, in Campus Party Europe where Angel Hernandez talks a little bit about robotics.

Click here to see the original video.
]]></description>
			<content:encoded><![CDATA[<p>This is a small report made by TVE, the Spanish National TV, in Campus Party Europe where Angel Hernandez talks a little bit about robotics.</p>
<p style="text-align: center;"><a href="http://www.rtve.es/mediateca/videos/20100415/arranca-campus-party-madrid/746130.shtml?s1=noticias&amp;s2=tecnologia&amp;s3=&amp;s4=#"><img class="aligncenter size-full wp-image-43" title="TVE" src="http://robomadness.com/blog/wp-content/uploads/2010/05/TVE.jpg" alt="" width="487" height="356" /></a></p>
<p style="text-align: center;"><a href="http://www.rtve.es/mediateca/videos/20100415/arranca-campus-party-madrid/746130.shtml?s1=noticias&amp;s2=tecnologia&amp;s3=&amp;s4=#">Click here to see the original video.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tupperbot.com/?feed=rss2&amp;p=129</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another article about us!</title>
		<link>http://www.tupperbot.com/?p=123</link>
		<comments>http://www.tupperbot.com/?p=123#comments</comments>
		<pubDate>Sun, 05 Sep 2010 13:06:36 +0000</pubDate>
		<dc:creator>Mif</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.tupperbot.com/?p=123</guid>
		<description><![CDATA[Moments like this make you feel you are doing the right thing. SLU, one more time wanted to write an article about us and our progress.
 
In few days I will start posting all the articles that were written this summer.
]]></description>
			<content:encoded><![CDATA[<p>Moments like this make you feel you are doing the right thing. <a href="http://spain.slu.edu/" target="_blank">SLU</a>, one more time wanted to write <a href="http://spain.slu.edu/news/new_0029.html" target="_blank">an article about us and our progress</a>.</p>
<p><a href="http://www.tupperbot.com/wp-content/uploads/2010/09/Untitled.jpg"><img style="border-bottom: 0px; border-left: 0px; width: auto; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="Untitled" border="0" alt="Untitled" src="http://www.tupperbot.com/wp-content/uploads/2010/09/Untitled_thumb.jpg" width="506" height="402" /></a> </p>
<p>In few days I will start posting all the articles that were written this summer.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tupperbot.com/?feed=rss2&amp;p=123</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RFID reader. First Project</title>
		<link>http://www.tupperbot.com/?p=119</link>
		<comments>http://www.tupperbot.com/?p=119#comments</comments>
		<pubDate>Sun, 05 Sep 2010 04:21:26 +0000</pubDate>
		<dc:creator>Mif</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.tupperbot.com/?p=119</guid>
		<description><![CDATA[Another very productive night!
Here is an RFID project I started tonight. This is still very simple, but I made it just to start playing with this technology.


WPvideo 1.10


Download!

As you can see on the video, I used an Skypic, to read the information coming from the RFID reader. I just made a custom board to hold [...]]]></description>
			<content:encoded><![CDATA[<p>Another very productive night!</p>
<p>Here is an RFID project I started tonight. This is still very simple, but I made it just to start playing with this technology.</p>
<p align="center">
<div class="wpv_videoc">
<div class="wpv_self"><a href="http://www.skarcha.com/wp-plugins/wpvideo/">WPvideo 1.10</a></div>
<div class="wpv_video"><object data="http://www.youtube.com/v/59DOPQr5Fnk" type="application/x-shockwave-flash" width="100%" height="100%"><param name="movie" value="http://www.youtube.com/v/59DOPQr5Fnk"></param></object></div>
<div class="wpv_titleauthor"></div>
<div class="wpv_download"><a target="_blank" href="http://downthisvideo.com/?url=http://www.youtube.com/watch?v=59DOPQr5Fnk">Download!</a></div>
</div>
<p>As you can see on the video, I used an <a href="http://www.iearobotics.com/proyectos/skypic/skypic.html" target="_blank">Skypic</a>, to read the information coming from the RFID reader. I just made a custom board to hold the electronics of the cheap RFID reader and bought six different RFID tags.</p>
<p><a href="http://www.tupperbot.com/wp-content/uploads/2010/09/Untitled5.jpg"><img style="border-right-width: 0px; width: auto; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Untitled-5" border="0" alt="Untitled-5" src="http://www.tupperbot.com/wp-content/uploads/2010/09/Untitled5_thumb.jpg" width="504" height="444" /></a> </p>
<p>The RFID reader uses the antenna to read the passive tag and sends the ID information and some other data through its UART. After that, the <a href="http://www.iearobotics.com/proyectos/skypic/skypic.html" target="_blank">Skypic</a> filters the Tag ID, and sends it to the computer using a standard header that I always use. On the computer, I made a little program that listens to the <a href="http://www.iearobotics.com/proyectos/skypic/skypic.html" target="_blank">Skypic</a>, and looks for the Tag ID on a Database. If the Tag ID exists on the Database it loads all the information about the tag (i.e. picture and final numbers).</p>
<p><a href="http://www.tupperbot.com/wp-content/uploads/2010/09/Untitled3.jpg"><img style="border-right-width: 0px; width: 275px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Untitled-3" border="0" alt="Untitled-3" src="http://www.tupperbot.com/wp-content/uploads/2010/09/Untitled3_thumb.jpg" width="281" height="252" /></a> </p>
<p>Shortly I will start playing with this interesting technology and hopefully I will develop something a little more complex than this <img src='http://www.tupperbot.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.tupperbot.com/?feed=rss2&amp;p=119</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Chronos ez430 + .NET + Robotic RC car</title>
		<link>http://www.tupperbot.com/?p=114</link>
		<comments>http://www.tupperbot.com/?p=114#comments</comments>
		<pubDate>Sat, 04 Sep 2010 04:47:03 +0000</pubDate>
		<dc:creator>Mif</dc:creator>
				<category><![CDATA[Chronos ez430]]></category>

		<guid isPermaLink="false">http://www.tupperbot.com/?p=114</guid>
		<description><![CDATA[
Finally I made something cool with my new “Toy” tonight.

WPvideo 1.10


Download!

I took the Chronos ez430, create a new menu to not modify its firmware, made a program in Visual Studio, debugged a little bit the communication systems on my Robot… and voilà! 
On my previous post I gave the code to make the Chronos ez430 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tupperbot.com/wp-content/uploads/2010/09/Untitled2.jpg"><img style="border-right-width: 0px; width: auto; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Untitled-2" border="0" alt="Untitled-2" src="http://www.tupperbot.com/wp-content/uploads/2010/09/Untitled2_thumb.jpg" width="228" height="240" /></a></p>
<p>Finally I made something cool with my new “Toy” tonight.</p>
<div class="wpv_videoc">
<div class="wpv_self"><a href="http://www.skarcha.com/wp-plugins/wpvideo/">WPvideo 1.10</a></div>
<div class="wpv_video"><object data="http://www.youtube.com/v/DfffM5-XYOs" type="application/x-shockwave-flash" width="100%" height="100%"><param name="movie" value="http://www.youtube.com/v/DfffM5-XYOs"></param></object></div>
<div class="wpv_titleauthor"></div>
<div class="wpv_download"><a target="_blank" href="http://downthisvideo.com/?url=http://www.youtube.com/watch?v=DfffM5-XYOs">Download!</a></div>
</div>
<p>I took the Chronos ez430, create a new menu to not modify its firmware, made a program in Visual Studio, debugged a little bit the communication systems on my Robot… and voilà! </p>
<p>On my previous post I gave the code to make the Chronos ez430 talk to your computer using Visual Studio, so all I’ve done is get that same program, transform all the ugly raw data and convert it into nice values for my robot (an RC car with some sensors, a radio and two SkyPics)</p>
<p>Here is a picture of how the software looks like now:</p>
<p><a href="http://www.tupperbot.com/wp-content/uploads/2010/09/Untitled4.jpg"><img style="border-right-width: 0px; width: 541px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Untitled-4" border="0" alt="Untitled-4" src="http://www.tupperbot.com/wp-content/uploads/2010/09/Untitled4_thumb.jpg" width="547" height="271" /></a>&#160; Once that was done, I started playing a little bit with my old and unstable communications system on my new robot and I made it work in a very efficient and stable way, so it is still not too easy to control, but at least it’s possible!</p>
<p>This is the robot running indoors (e.g. crashing against walls):</p>
<p>
<div class="wpv_videoc">
<div class="wpv_self"><a href="http://www.skarcha.com/wp-plugins/wpvideo/">WPvideo 1.10</a></div>
<div class="wpv_video"><object data="http://www.youtube.com/v/dHkAxQxH-rM" type="application/x-shockwave-flash" width="100%" height="100%"><param name="movie" value="http://www.youtube.com/v/dHkAxQxH-rM"></param></object></div>
<div class="wpv_titleauthor"></div>
<div class="wpv_download"><a target="_blank" href="http://downthisvideo.com/?url=http://www.youtube.com/watch?v=dHkAxQxH-rM">Download!</a></div>
</div>
<p>The software for this project is not very clean since I made all this in four hors more or less, but if you want to do something like this, and need help or code, just leave me a comment or send me an email.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tupperbot.com/?feed=rss2&amp;p=114</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Chronos ez430 and Visual Studio .Net</title>
		<link>http://www.tupperbot.com/?p=105</link>
		<comments>http://www.tupperbot.com/?p=105#comments</comments>
		<pubDate>Fri, 03 Sep 2010 23:02:04 +0000</pubDate>
		<dc:creator>Mif</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.tupperbot.com/?p=105</guid>
		<description><![CDATA[I have been looking around and fighting with some libraries for a couple of days to get the watch to send data to the computer… After some help from TI’s forum I finally got it running on Visual Studio .Net writing a quick code in Visual Basic and using the eZ430_Chronos_Net.dll made by Tobias Gärtner.

I [...]]]></description>
			<content:encoded><![CDATA[<p>I have been looking around and fighting with some libraries for a couple of days to get the watch to send data to the computer… After some help from <a href="http://e2e.ti.com/support/microcontrollers/msp43016-bit_ultra-low_power_mcus/f/166/t/61997.aspx" target="_blank">TI’s forum</a> I finally got it running on Visual Studio .Net writing a quick code in Visual Basic and using the <a href="http://sourceforge.net/projects/ez430chronosnet/files/" target="_blank">eZ430_Chronos_Net.dll</a> made by Tobias Gärtner.</p>
<p><a href="http://www.tupperbot.es/download/ez430-VB-NET.zip"><img style="border-bottom: 0px; border-left: 0px; width: 213px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="Untitled-2" border="0" alt="Untitled-2" src="http://www.tupperbot.com/wp-content/uploads/2010/09/Untitled2.gif" width="207" height="297" /></a></p>
<p>I hate all those places where you have to look around to get code and register to download everything, so if you want to download the source code, simply<strong><font size="4"> </font></strong><a href="http://www.tupperbot.es/download/ez430-VB-NET.zip"><strong><font size="4">click here</font></strong></a> and start playing with it.</p>
<p>Follow this steps to make this work:</p>
<p>1. Plug the CC1111 AP   <br /><a href="http://www.tupperbot.com/wp-content/uploads/2010/09/cc11111.gif"><img style="border-bottom: 0px; border-left: 0px; width: 125px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="cc1111" border="0" alt="cc1111" align="left" src="http://www.tupperbot.com/wp-content/uploads/2010/09/cc1111_thumb1.gif" width="131" height="120" /></a> </p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>&#160;</p>
<p>2. Open the program you just downloaded. there should be a .exe in the bin folder.</p>
<p>3. Click Connect</p>
<p>4. Start the Chronos ez430 in ACC mode.</p>
<p>5. and voilà! </p>
<p>I hope this helps people trying to figure out how to “talk to the device using Visual Studio. If you have any questions just leave a comment or send me an email.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tupperbot.com/?feed=rss2&amp;p=105</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Chronos ez430. I just got it!</title>
		<link>http://www.tupperbot.com/?p=100</link>
		<comments>http://www.tupperbot.com/?p=100#comments</comments>
		<pubDate>Thu, 02 Sep 2010 16:14:00 +0000</pubDate>
		<dc:creator>Mif</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.tupperbot.com/?p=100</guid>
		<description><![CDATA[ 
I recently got this new amazing device. Probably you haven’t heard much about it, so just to start, let me give you a brief description of this&#160; “watch”:

3 Axis accelerometer
Pressure Sensor
Temperature Sensor
Battery Voltage Sensor
The CC430F6137 with a &#60;1 GHz wireless transceiver integrated

So you get the all that in a watch-like gadget, plus:

ez430 USB Programming [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.tupperbot.com/wp-content/uploads/2010/09/Reloj_ez430.png"><img style="border-bottom: 0px; border-left: 0px; width: auto; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="Reloj_ez430" border="0" alt="Reloj_ez430" src="http://www.tupperbot.com/wp-content/uploads/2010/09/Reloj_ez430_thumb.png" width="210" height="244" /></a> </p>
<p>I recently got this new amazing device. Probably you haven’t heard much about it, so just to start, let me give you a brief description of this&#160; “watch”:</p>
<ul>
<li>3 Axis accelerometer</li>
<li>Pressure Sensor</li>
<li>Temperature Sensor</li>
<li>Battery Voltage Sensor</li>
<li>The <a href="http://focus.ti.com/docs/prod/folders/print/cc430f6137.html" target="_blank">CC430F6137</a> with a &lt;1 GHz wireless transceiver integrated</li>
</ul>
<p>So you get the all that in a watch-like gadget, plus:</p>
<ul>
<li>ez430 USB Programming and debugging interface</li>
<li>CC1111 USB RF AP</li>
<li>Mini Phillips Screwdriver</li>
<li>2 extra screws</li>
<li>CR2032 Lithium Battery</li>
</ul>
<p>But the best of all this is that you can get all this for only $49!! (Okay, I look like one of those guys selling vacuum cleaners on TV… Haha!)</p>
<p>I still didn’t have enough time to play with it, but My first Project will be to get all that data on the computer using any Visual Studio Language.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tupperbot.com/?feed=rss2&amp;p=100</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>We are getting famous on the Internet</title>
		<link>http://www.tupperbot.com/?p=96</link>
		<comments>http://www.tupperbot.com/?p=96#comments</comments>
		<pubDate>Mon, 03 May 2010 22:25:28 +0000</pubDate>
		<dc:creator>Mif</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.tupperbot.com/?p=96</guid>
		<description><![CDATA[Everyone in Saint Louis University is being really supportive and excited about the medals we got last week in RoboGames, so little by little they are publishing some news.
The first one was SLU’s official wesite in USA:
 
Right after that initial release, Jesus and I got an email from SLU Madrid asking if we minded [...]]]></description>
			<content:encoded><![CDATA[<p>Everyone in <a href="http://parks.slu.edu" target="_blank">Saint Louis University</a> is being really supportive and excited about the medals we got last week in <a href="http://robogames.net" target="_blank">RoboGames</a>, so little by little they are publishing some news.</p>
<p>The first one was <a href="http://parks.slu.edu/news-events/news/2010/04/28/robogames-2010/" target="_blank">SLU’s official wesite</a> in USA:</p>
<p><a href="http://www.tupperbot.com/wp-content/uploads/2010/05/Parks1.jpg"><img style="border-right-width: 0px; width: 647px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Parks" border="0" alt="Parks" src="http://www.tupperbot.com/wp-content/uploads/2010/05/Parks_thumb1.jpg" width="653" height="460" /></a> </p>
<p>Right after that initial release, <a href="http://www.jesusdc.com" target="_blank">Jesus</a> and I got an email from <a href="http://madrid.slu.edu" target="_blank">SLU Madrid</a> asking if we minded them publishing in their own website about our story. Of course we are happy if they do it, so here it is:</p>
<p><a href="http://www.tupperbot.com/wp-content/uploads/2010/05/SLUMadridnewsCropped1.png"><img style="border-right-width: 0px; width: 649px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="SLU Madrid news Cropped" border="0" alt="SLU Madrid news Cropped" src="http://www.tupperbot.com/wp-content/uploads/2010/05/SLUMadridnewsCropped_thumb1.png" width="655" height="382" /></a> </p>
<p>We also made it to&#160; <a href="http://tupperbot.es/download/publications/Billiken_News_-_SLU_Madrid_Campus.pdf">SLU Madrid’s newspaper</a>&#160; and someone told us that our picture is now the desktop background in the computers at the labs in <a href="http://madrid.slu.edu" target="_blank">SLU Madrid</a>, but I will not believe that till I see it with my own eyes… hahaha</p>
<p>Well, we are not “Oprah”, but this is a good way to start, isn’t it?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tupperbot.com/?feed=rss2&amp;p=96</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More about CampusBot on TV</title>
		<link>http://www.tupperbot.com/?p=85</link>
		<comments>http://www.tupperbot.com/?p=85#comments</comments>
		<pubDate>Mon, 03 May 2010 00:49:59 +0000</pubDate>
		<dc:creator>Mif</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.tupperbot.com/?p=85</guid>
		<description><![CDATA[Little by little I’m running into more videos about the robotics area in Campus Party. I know some of you will disagree with what I’m saying here, so I’m willing to talk about it with you if you want.
Link to the original video on TVE’s website.
]]></description>
			<content:encoded><![CDATA[<p>Little by little I’m running into more videos about the robotics area in Campus Party. I know some of you will disagree with what I’m saying here, so I’m willing to talk about it with you if you want.</p>
<p><a href="http://www.rtve.es/mediateca/videos/20100415/ministra-ciencia-inaugurado-esta-manana-madrid-campus-party/745814.shtml">Link to the original video on TVE’s website.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tupperbot.com/?feed=rss2&amp;p=85</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Televisi&#243;n Espa&#241;ola in Campus Party Europe</title>
		<link>http://www.tupperbot.com/?p=84</link>
		<comments>http://www.tupperbot.com/?p=84#comments</comments>
		<pubDate>Wed, 28 Apr 2010 22:31:33 +0000</pubDate>
		<dc:creator>Mif</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.tupperbot.com/?p=84</guid>
		<description><![CDATA[This is a small report made by TVE, the Spanish National TV, in Campus Party Europe where I talk a little bit about robotics.
Click here to see the original video.
]]></description>
			<content:encoded><![CDATA[<p>This is a small report made by TVE, the Spanish National TV, in Campus Party Europe where I talk a little bit about robotics.</p>
<p><a href="http://www.rtve.es/mediateca/videos/20100415/arranca-campus-party-madrid/746130.shtml?s1=noticias&amp;s2=tecnologia&amp;s3=&amp;s4=#">Click here to see the original video.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tupperbot.com/?feed=rss2&amp;p=84</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

