- Joined
- Jun 27, 2006
- Messages
- 23,048
- Thread Author
- #1
This video covers how to set up your development environment. You may find it easier to follow along by downloading the Link Removed.
Visual Studio:
Visual Basic / C# – In the Add Reference dialog, switch to the .NET tab, click the Component Name header to sort references alphabetically, then scroll down to select Microsoft.Research.Kinect and click OK
Link Removed
[h=2]Add a using statement[/h]Within your project, you can now add a using statement to reference the Kinect namespaces:
C#
using Microsoft.Research.Kinect.Nui;using Microsoft.Research.Kinect.Audio;Visual Basic
Imports Microsoft.Research.Kinect.NuiImports Microsoft.Research.Kinect.Audio[h=3]Optional: Using the Coding4Fun Kinect Toolkit[/h]Go to Link Removed and download the latest version of the Coding4Fun Kinect Toolkit. This library is filled with useful items to help with a variety of tasks, such as converting the data from the Kinect to a data array or Bitmap.
Depending on if you are building a WPF or Windows Form application, we have two different DLLs:
// if you're using WPFusing Coding4Fun.Kinect.WPF;// if you're using WinFormsusing Coding4Fun.Kinect.WinForm;Visual Basic
' if you're using WPFImports Coding4Fun.Kinect.WPF' if you're using WinFormsImports Coding4Fun.Kinect.WinForm[h=1]Initializing and Uninitializing the runtime[/h]For NUI, we have to initialize and uninitialize the runtime. In our examples, we typically will initialize on the Loaded event on the Window and we'll uninitialize on the Closed event. Depending on what needs to be done, the Initialize method on the runtime will be tweaked though the concepts stay the same.
[h=3]Create the Window_Loaded event[/h]Go to the properties window (F4), select the MainWindow, select the Events tab, and double click on the Loaded event to create the Window_Loaded event
Link Removed
[h=3][/h][h=3]Initializing the runtime[/h]Create a new variable outside of the Window_Loaded event to reference the Kinect runtime:
C#
Runtime nui = new Runtime();
Visual Basic
Private nui As New RuntimeIn the Window_Loaded event, initialize the runtime with the options you want to use. For this example, set RuntimeOptions.UseColor to use the RGB camera:
C#
nui.Initialize(RuntimeOptions.UseColor);
Visual Basic
nui.Initialize(RuntimeOptions.UseColor)RuntimeOptions is a Flag enumeration, this means you can set multiple options as parameters in the Initialize method by separating them with the pipe "|" character (the "or" operator) in c# or the "Or" operator in Visual Basic. The example below sets the runtime to use the color camera, a depth camera, and skeletal tracking:
C#
nui.Initialize(RuntimeOptions.UseColor | RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking );
Visual Basic
nui.Initialize(RuntimeOptions.UseColor Or RuntimeOptions.UseDepthAndPlayerIndex Or RuntimeOptions.UseSkeletalTracking)[h=3]Uninitializing the Runtime[/h]Remember that when you are done using the Kinect Runtime, you should call the Uninitialize method. For a WPF application, you would typically do this in the Windows_Closed event:
C#
nui.Uninitialize();
Visual Basic
nui.Uninitialize() Link Removed
Link Removed
- [Link Removed] Sample Requirements
- [Link Removed] Starting the Demo
- [Link Removed] Adding References
- [Link Removed] Coding4Fun Kinect Library
- [Link Removed] Initializing the Kinect Runtime
- [Link Removed] Uninitializing the Kinect Runtime
Visual Studio:
- Link Removed of the demo in the appropriate programming language or Link Removed
- Link Removed or later version
- Link Removed
Note: If you have a 64-bit PC, you must still download the x86 versions of the Speech Runtime and SDK (below)
- Link Removed (x86 edition)
- Microsoft Kinect Speech Platform (US-English version)
- Link Removed(x86 edition)
- In this task, you’ll create a new Visual Studio 2010 project and add references to the correct libraries
- Start Visual Studio 2010 (Express Editions or higher)
- Select File –> New Project –> Windows Presentation Foundation and set the name for your project
Link Removed
- C# – From the Solution Explorer, right click on References and select Add Reference as shown below
- Visual Basic – From the Solution Explorer, right click on the project name and select Add Reference as shown below
Visual Basic / C# – In the Add Reference dialog, switch to the .NET tab, click the Component Name header to sort references alphabetically, then scroll down to select Microsoft.Research.Kinect and click OK
Link Removed
[h=2]Add a using statement[/h]Within your project, you can now add a using statement to reference the Kinect namespaces:
C#
using Microsoft.Research.Kinect.Nui;using Microsoft.Research.Kinect.Audio;Visual Basic
Imports Microsoft.Research.Kinect.NuiImports Microsoft.Research.Kinect.Audio[h=3]Optional: Using the Coding4Fun Kinect Toolkit[/h]Go to Link Removed and download the latest version of the Coding4Fun Kinect Toolkit. This library is filled with useful items to help with a variety of tasks, such as converting the data from the Kinect to a data array or Bitmap.
Depending on if you are building a WPF or Windows Form application, we have two different DLLs:
- WPF Applications: use the Coding4Fun.Kinect.Wpf.dll
- Windows Form Applications: use the Coding4Fun.Kinect.WinForm.dll
// if you're using WPFusing Coding4Fun.Kinect.WPF;// if you're using WinFormsusing Coding4Fun.Kinect.WinForm;Visual Basic
' if you're using WPFImports Coding4Fun.Kinect.WPF' if you're using WinFormsImports Coding4Fun.Kinect.WinForm[h=1]Initializing and Uninitializing the runtime[/h]For NUI, we have to initialize and uninitialize the runtime. In our examples, we typically will initialize on the Loaded event on the Window and we'll uninitialize on the Closed event. Depending on what needs to be done, the Initialize method on the runtime will be tweaked though the concepts stay the same.
[h=3]Create the Window_Loaded event[/h]Go to the properties window (F4), select the MainWindow, select the Events tab, and double click on the Loaded event to create the Window_Loaded event
Link Removed
[h=3][/h][h=3]Initializing the runtime[/h]Create a new variable outside of the Window_Loaded event to reference the Kinect runtime:
C#
Runtime nui = new Runtime();
Visual Basic
Private nui As New RuntimeIn the Window_Loaded event, initialize the runtime with the options you want to use. For this example, set RuntimeOptions.UseColor to use the RGB camera:
C#
nui.Initialize(RuntimeOptions.UseColor);
Visual Basic
nui.Initialize(RuntimeOptions.UseColor)RuntimeOptions is a Flag enumeration, this means you can set multiple options as parameters in the Initialize method by separating them with the pipe "|" character (the "or" operator) in c# or the "Or" operator in Visual Basic. The example below sets the runtime to use the color camera, a depth camera, and skeletal tracking:
C#
nui.Initialize(RuntimeOptions.UseColor | RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking );
Visual Basic
nui.Initialize(RuntimeOptions.UseColor Or RuntimeOptions.UseDepthAndPlayerIndex Or RuntimeOptions.UseSkeletalTracking)[h=3]Uninitializing the Runtime[/h]Remember that when you are done using the Kinect Runtime, you should call the Uninitialize method. For a WPF application, you would typically do this in the Windows_Closed event:
C#
nui.Uninitialize();
Visual Basic
nui.Uninitialize() Link Removed
Link Removed