<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Comment Feed for Channel 9 - Kinect Mouse Cursor</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/coding4fun/kinect/Kinect-Mouse-Cursor/RSS"></atom:link>
	<image>
		<url>http://files.channel9.msdn.com/thumbnail/fcbcee6e-35b4-4223-9af7-8670249c8509.png</url>
		<title>Channel 9 - Kinect Mouse Cursor</title>
		<link></link>
	</image>
	<description> Kinect Mouse CursorKinect Mouse Cursor is a demo application that uses the Kinect for Windows SDK and its skeletal tracking features to allow a user to use their hands to control the Windows mouse cursor. This sample demonstrates how to use the Kinect skeletal tracking feature to move the mouse cursor with a user&#39;s hands. By default, the right hand moves the cursor and the left hand controls the left mouse button. Then the left hand is raised, the mouse button is held down.&amp;nbsp; When the left hand is lowered, the mouse button is released. Use the checkbox on the main UI to switch to &amp;quot;left-handed&amp;quot; mode where the hand functions are reversed. Project Information URL: http://channel9.msdn.com/coding4fun/projects/Kinect-Mouse-Cursor Project Download URL: http://kinectmouse.codeplex.com/           Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
            &#39; hook up our events for depth and sekeltal tracking
            AddHandler _runtime.DepthFrameReady, AddressOf _runtime_DepthFrameReady
            AddHandler _runtime.SkeletonFrameReady, AddressOf _runtime_SkeletonFrameReady
            Try

               &#39; tell Kinect we need the depth buffer and skeletal tracking
                _runtime.Initialize(RuntimeOptions.UseDepth Or RuntimeOptions.UseSkeletalTracking)
            Catch ex As Exception
                MessageBox.Show(&amp;quot;Could not initialize Kinect device: &amp;quot; &amp;amp; ex.Message)
            End Try           
            &#39; parameters used to smooth the skeleton data

            _runtime.SkeletonEngine.TransformSmooth = True
            Dim parameters As New TransformSmoothParameters()
            parameters.Smoothing = 0.7f
            parameters.Correction = 0.3f
            parameters.Prediction = 0.4f
            parameters.JitterRadius = 1.0f
            parameters.MaxDeviationRadius = 0.5f
            _runtime.SkeletonEngine.SmoothParameters = parameters
            Try

                &#39; open the depth stream at the proper resolution

                _runtime.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.Depth)
            Catch ex As Exception

                MessageBox.Show(&amp;quot;Could not open depth stream: &amp;quot; &amp;amp; ex.Message)

            End Try

        End Sub  &amp;nbsp; Private Sub _runtime_SkeletonFrameReady(ByVal sender As Object, ByVal e As SkeletonFrameReadyEventArgs)
    For Each sd As SkeletonData In e.SkeletonFrame.Skeletons
        &#39; the first found/tracked skeleton moves the mouse cursor
        If sd.TrackingState = SkeletonTrackingState.Tracked Then
            &#39; make sure both hands are tracked
            If sd.Joints(JointID.HandLeft).TrackingState = JointTrackingState.Tracked AndAlso sd.Joints(JointID.HandRight).TrackingState = JointTrackingState.Tracked Then
                Dim cursorX, cursorY As Integer
                &#39; get the left and right hand Joints
                Dim jointRight As Joint = sd.Joints(JointID.HandRight)
                Dim jointLeft As Joint = sd.Joints(JointID.HandLeft)
                &#39; scale those Joints to the primary screen width and height
                Dim scaledRight As Joint = jointRight.ScaleTo(CInt(Fix(SystemParameters.PrimaryScreenWidth)), CInt(Fix(SystemParameters.PrimaryScreenHeight)), SkeletonMaxX, SkeletonMaxY)
                Dim scaledLeft As Joint = jointLeft.ScaleTo(CInt(Fix(SystemParameters.PrimaryScreenWidth)), CInt(Fix(SystemParameters.PrimaryScreenHeight)), SkeletonMaxX, SkeletonMaxY)

                &#39; figure out the cursor position based on left/right handedness
                If LeftHand.IsChecked.GetValueOrDefault() Then
                    cursorX = CInt(Fix(scaledLeft.Position.X))
                    cursorY = CInt(Fix(scaledLeft.Position.Y))
                Else
                    cursorX = CInt(Fix(scaledRight.Position.X))
                    cursorY = CInt(Fix(scaledRight.Position.Y))
                End If
                Dim leftClick As Boolean                &#39; figure out whether the mouse button is down based on where the opposite hand is

                If (LeftHand.IsChecked.GetValueOrDefault() AndAlso jointRight.Position.Y &amp;gt; ClickThreshold) OrElse ((Not LeftHand.IsChecked.GetValueOrDefault()) AndAlso jointLeft.Position.Y &amp;gt; ClickThreshold) Then
                    leftClick = True
                Else
                    leftClick = False
                End If
                Status.Text = cursorX &amp;amp; &amp;quot;, &amp;quot; &amp;amp; cursorY &amp;amp; &amp;quot;, &amp;quot; &amp;amp; leftClick
                
                NativeMethods.SendMouseInput(cursorX, cursorY, CInt(Fix(SystemParameters.PrimaryScreenWidth)), CInt(Fix(SystemParameters.PrimaryScreenHeight)), leftClick)                Return
            End If
        End If
    Next sd
End Sub
 &amp;nbsp;Contact Information: Blog: http://www.brianpeek.com/ Twitter: @BrianPeek</description>
	<link></link>
	<language>en</language>
	<pubDate>Wed, 22 May 2013 02:36:19 GMT</pubDate>
	<lastBuildDate>Wed, 22 May 2013 02:36:19 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<item>
		<title>Re: Kinect Mouse Cursor</title>
		<description>
			<![CDATA[Hi ,<br><br>  I ahd downlaoded the code and try to execute this some how the Curosr control is not working for me . <br><br>Regards,<br>Ragini.G<p>posted by Ragini</p>]]>
		</description>
		<link>http://channel9.msdn.com/coding4fun/kinect/Kinect-Mouse-Cursor#c634445241290000000</link>
		<pubDate>Fri, 24 Jun 2011 14:55:29 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/coding4fun/kinect/Kinect-Mouse-Cursor#c634445241290000000</guid>
		<dc:creator>Ragini</dc:creator>
	</item>
	<item>
		<title>Re: Kinect Mouse Cursor</title>
		<description>
			<![CDATA[not working for me.<br>&#34;Could not initialize Kinect device&#58; Failed in native DLL....&#34;<br>Warm Regards<p>posted by Orlando</p>]]>
		</description>
		<link>http://channel9.msdn.com/coding4fun/kinect/Kinect-Mouse-Cursor#c634466092390000000</link>
		<pubDate>Mon, 18 Jul 2011 18:07:19 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/coding4fun/kinect/Kinect-Mouse-Cursor#c634466092390000000</guid>
		<dc:creator>Orlando</dc:creator>
	</item>
	<item>
		<title>Re: Kinect Mouse Cursor</title>
		<description>
			<![CDATA[ <p>@<a href="/coding4fun/kinect/Kinect-Mouse-Cursor#c634466092390000000?areaType=Blogs&amp;areaName=Coding4FunKinect">Orlando</a>: Do the samples that come with the Kinect SDK work for you?</p><p>posted by gduncan411</p>]]>
		</description>
		<link>http://channel9.msdn.com/coding4fun/kinect/Kinect-Mouse-Cursor#c634466231250000000</link>
		<pubDate>Mon, 18 Jul 2011 21:58:45 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/coding4fun/kinect/Kinect-Mouse-Cursor#c634466231250000000</guid>
		<dc:creator>gduncan411</dc:creator>
	</item>
	<item>
		<title>Re: Kinect Mouse Cursor</title>
		<description>
			<![CDATA[Can I ask why you defined ClickThreshold as 0.33f&#63;<br>where did the 0.33f come from&#63;<p>posted by Hurenjie</p>]]>
		</description>
		<link>http://channel9.msdn.com/coding4fun/kinect/Kinect-Mouse-Cursor#c634472005370000000</link>
		<pubDate>Mon, 25 Jul 2011 14:22:17 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/coding4fun/kinect/Kinect-Mouse-Cursor#c634472005370000000</guid>
		<dc:creator>Hurenjie</dc:creator>
	</item>
</channel>
</rss>