Update(master): un peu de ménage

master
Louis DUFOUR 1 year ago
parent 9e35c1f37f
commit 0cac88bbe2

@ -1,15 +0,0 @@
<Application
x:Class="Microsoft.Samples.Kinect.BodyBasics.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.Samples.Kinect.BodyBasics">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

@ -1,119 +0,0 @@
//------------------------------------------------------------------------------
// <copyright file="App.xaml.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
namespace Microsoft.Samples.Kinect.BodyBasics
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used when the application is launched to open a specific file, to display
/// search results, and so forth.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
// Set the default language
rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
rootFrame.NavigationFailed += OnNavigationFailed;
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
{
throw new Exception("Failed to create initial page");
}
}
// Ensure the current window is active
Window.Current.Activate();
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 B

@ -1,121 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{F90CC85F-30CB-4214-8D5E-42F597C2783A}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BodyBasics_XAML</RootNamespace>
<AssemblyName>BodyBasics-XAML</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>BodyBasics-XAML_TemporaryKey.pfx</PackageCertificateKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<None Include="BodyBasics-XAML_TemporaryKey.pfx" />
<PRIResource Include="Resources.resw" />
</ItemGroup>
<ItemGroup>
<Content Include="Assets\Logo.png" />
<Content Include="Assets\SmallLogo.png" />
<Content Include="Assets\SplashScreen.scale-100.png" />
<Content Include="Assets\SplashScreen.scale-140.png" />
<Content Include="Assets\SplashScreen.scale-180.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Images\Kinect.ico" />
<Content Include="Images\Logo.png" />
<Content Include="Images\Status.png" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="Common\StandardStyles.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<SDKReference Include="Microsoft.VCLibs, Version=11.0">
<Name>Microsoft Visual C++ Runtime Package</Name>
</SDKReference>
<SDKReference Include="WindowsPreview.Kinect, Version=2.0">
<Name>WindowsPreview.Kinect</Name>
</SDKReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '11.0' ">
<VisualStudioVersion>11.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

@ -1,30 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BodyBasics-XAML", "BodyBasics-XAML.csproj", "{F90CC85F-30CB-4214-8D5E-42F597C2783A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F90CC85F-30CB-4214-8D5E-42F597C2783A}.Debug|x64.ActiveCfg = Debug|x64
{F90CC85F-30CB-4214-8D5E-42F597C2783A}.Debug|x64.Build.0 = Debug|x64
{F90CC85F-30CB-4214-8D5E-42F597C2783A}.Debug|x64.Deploy.0 = Debug|x64
{F90CC85F-30CB-4214-8D5E-42F597C2783A}.Debug|x86.ActiveCfg = Debug|x86
{F90CC85F-30CB-4214-8D5E-42F597C2783A}.Debug|x86.Build.0 = Debug|x86
{F90CC85F-30CB-4214-8D5E-42F597C2783A}.Debug|x86.Deploy.0 = Debug|x86
{F90CC85F-30CB-4214-8D5E-42F597C2783A}.Release|x64.ActiveCfg = Release|x64
{F90CC85F-30CB-4214-8D5E-42F597C2783A}.Release|x64.Build.0 = Release|x64
{F90CC85F-30CB-4214-8D5E-42F597C2783A}.Release|x64.Deploy.0 = Release|x64
{F90CC85F-30CB-4214-8D5E-42F597C2783A}.Release|x86.ActiveCfg = Release|x86
{F90CC85F-30CB-4214-8D5E-42F597C2783A}.Release|x86.Build.0 = Release|x86
{F90CC85F-30CB-4214-8D5E-42F597C2783A}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

@ -1,39 +0,0 @@
<Page
x:Class="Microsoft.Samples.Kinect.BodyBasics.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.Samples.Kinect.BodyBasics"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Unloaded="MainPage_Unloaded"
>
<Page.Resources>
<SolidColorBrush x:Key="MediumGreyBrush" Color="#ff6e6e6e" />
<SolidColorBrush x:Key="KinectPurpleBrush" Color="#ff52318f" />
<SolidColorBrush x:Key="KinectBlueBrush" Color="#ff00BCF2" />
</Page.Resources>
<Grid Background="White" Margin="10 0 10 0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Image Source="Images/Logo.png" Stretch="Fill" Height="32" Width="81" Margin="10 10 0 5"
Grid.Row="0" HorizontalAlignment="Left"/>
<Image Source="Images/Status.png" Stretch="None" HorizontalAlignment="Center"
Margin="0 0 0 5" Grid.Row="0"/>
<TextBlock Margin="0,0,10,10" VerticalAlignment="Bottom" HorizontalAlignment="Right" Foreground="{StaticResource MediumGreyBrush}" FontFamily="Segoe UI" FontSize="18"
Grid.Row="0">Body Basics</TextBlock>
<Viewbox Grid.Row="1" HorizontalAlignment="Center">
<Grid x:Name="DisplayGrid" Background="Black" Width="512" Height="414"/>
</Viewbox>
<StackPanel Grid.Row="2" HorizontalAlignment="Stretch" Name="statusBar" VerticalAlignment="Bottom" Background="White">
<TextBlock Text="{Binding StatusText}" Foreground="Black"/>
</StackPanel>
</Grid>
</Page>

@ -1,817 +0,0 @@
//------------------------------------------------------------------------------
// <copyright file="MainPage.xaml.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Windows.ApplicationModel.Resources;
using Windows.Foundation;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Shapes;
using WindowsPreview.Kinect;
namespace Microsoft.Samples.Kinect.BodyBasics
{
/// <summary>
/// Main page for sample
/// </summary>
public sealed partial class MainPage : Page, INotifyPropertyChanged
{
/// <summary>
/// Resource loader for string resources
/// </summary>
#if WIN81ORLATER
private ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView("Resources");
#else
private ResourceLoader resourceLoader = new ResourceLoader("Resources");
#endif
/// <summary>
/// Radius of drawn hand circles
/// </summary>
private const double HighConfidenceHandSize = 40;
/// <summary>
/// Radius of drawn hand circles
/// </summary>
private const double LowConfidenceHandSize = 20;
/// <summary>
/// Thickness of drawn joint lines
/// </summary>
private const double JointThickness = 8.0;
/// <summary>
/// Thickness of seen bone lines
/// </summary>
private const double TrackedBoneThickness = 4.0;
/// <summary>
/// Thickness of inferred joint lines
/// </summary>
private const double InferredBoneThickness = 1.0;
/// <summary>
/// Thickness of clip edge rectangles
/// </summary>
private const double ClipBoundsThickness = 5;
/// <summary>
/// Constant for clamping Z values of camera space points from being negative
/// </summary>
private const float InferredZPositionClamp = 0.1f;
/// <summary>
/// Active Kinect sensor
/// </summary>
private KinectSensor kinectSensor = null;
/// <summary>
/// Coordinate mapper to map one type of point to another
/// </summary>
private CoordinateMapper coordinateMapper = null;
/// <summary>
/// Reader for body frames
/// </summary>
private BodyFrameReader bodyFrameReader = null;
/// <summary>
/// Array for the bodies
/// </summary>
private Body[] bodies = null;
/// <summary>
/// Current status text to display
/// </summary>
private string statusText = null;
/// <summary>
/// Main Canvas that contains all visual objects for all bodies and clipped edges
/// </summary>
private Canvas drawingCanvas;
/// <summary>
/// List of BodyInfo objects for each potential body
/// </summary>
private BodyInfo[] BodyInfos;
/// <summary>
/// List of colors for each body tracked
/// </summary>
private List<Color> BodyColors;
/// <summary>
/// Clipped edges rectangles
/// </summary>
private Rectangle LeftClipEdge;
private Rectangle RightClipEdge;
private Rectangle TopClipEdge;
private Rectangle BottomClipEdge;
private int BodyCount
{
set
{
if (value == 0)
{
this.BodyInfos = null;
return;
}
// creates instances of BodyInfo objects for potential number of bodies
if (this.BodyInfos == null || this.BodyInfos.Length != value)
{
this.BodyInfos = new BodyInfo[value];
for (int bodyIndex = 0; bodyIndex < this.bodies.Length; bodyIndex++)
{
this.BodyInfos[bodyIndex] = new BodyInfo(this.BodyColors[bodyIndex]);
}
}
}
get { return this.BodyInfos == null ? 0 : this.BodyInfos.Length; }
}
private float JointSpaceWidth { get; set; }
private float JointSpaceHeight { get; set; }
/// <summary>
/// Initializes a new instance of the MainPage class.
/// </summary>
public MainPage()
{
// one sensor is currently supported
this.kinectSensor = KinectSensor.GetDefault();
// get the coordinate mapper
this.coordinateMapper = this.kinectSensor.CoordinateMapper;
// get the depth (display) extents
FrameDescription frameDescription = this.kinectSensor.DepthFrameSource.FrameDescription;
// get size of joint space
this.JointSpaceWidth = frameDescription.Width;
this.JointSpaceHeight = frameDescription.Height;
// get total number of bodies from BodyFrameSource
this.bodies = new Body[this.kinectSensor.BodyFrameSource.BodyCount];
// open the reader for the body frames
this.bodyFrameReader = this.kinectSensor.BodyFrameSource.OpenReader();
// wire handler for frame arrival
this.bodyFrameReader.FrameArrived += this.Reader_BodyFrameArrived;
// set IsAvailableChanged event notifier
this.kinectSensor.IsAvailableChanged += this.Sensor_IsAvailableChanged;
// populate body colors, one for each BodyIndex
this.BodyColors = new List<Color>
{
Colors.Red,
Colors.Orange,
Colors.Green,
Colors.Blue,
Colors.Indigo,
Colors.Violet
};
// sets total number of possible tracked bodies
// create ellipses and lines for drawing bodies
this.BodyCount = this.kinectSensor.BodyFrameSource.BodyCount;
// Instantiate a new Canvas
this.drawingCanvas = new Canvas();
// open the sensor
this.kinectSensor.Open();
// set the status text
this.StatusText = this.kinectSensor.IsAvailable ? resourceLoader.GetString("RunningStatusText")
: resourceLoader.GetString("NoSensorStatusText");
// use the window object as the view model in this simple example
this.DataContext = this;
// initialize the components (controls) of the window
this.InitializeComponent();
// set the clip rectangle to prevent rendering outside the canvas
this.drawingCanvas.Clip = new RectangleGeometry();
this.drawingCanvas.Clip.Rect = new Rect(0.0, 0.0, this.DisplayGrid.Width, this.DisplayGrid.Height);
// create visual objects for drawing joints, bone lines, and clipped edges
this.PopulateVisualObjects();
// add canvas to DisplayGrid
this.DisplayGrid.Children.Add(this.drawingCanvas);
}
/// <summary>
/// INotifyPropertyChangedPropertyChanged event to allow window controls to bind to changeable data
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Gets or sets the current status text to display
/// </summary>
public string StatusText
{
get
{
return this.statusText;
}
set
{
if (this.statusText != value)
{
this.statusText = value;
// notify any bound elements that the text has changed
if (this.PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs("StatusText"));
}
}
}
}
/// <summary>
/// Execute shutdown tasks
/// </summary>
/// <param name="sender">object sending the event</param>
/// <param name="e">event arguments</param>
private void MainPage_Unloaded(object sender, RoutedEventArgs e)
{
if (this.bodyFrameReader != null)
{
// BodyFrameReder is IDisposable
this.bodyFrameReader.Dispose();
this.bodyFrameReader = null;
}
// Body is IDisposable
if (this.bodies != null)
{
foreach (Body body in this.bodies)
{
if (body != null)
{
body.Dispose();
}
}
}
if (this.kinectSensor != null)
{
this.kinectSensor.Close();
this.kinectSensor = null;
}
}
/// <summary>
/// Handles the body frame data arriving from the sensor
/// </summary>
/// <param name="sender">object sending the event</param>
/// <param name="e">event arguments</param>
private void Reader_BodyFrameArrived(object sender, BodyFrameArrivedEventArgs e)
{
bool dataReceived = false;
bool hasTrackedBody = false;
using (BodyFrame bodyFrame = e.FrameReference.AcquireFrame())
{
if (bodyFrame != null)
{
bodyFrame.GetAndRefreshBodyData(this.bodies);
dataReceived = true;
}
}
if (dataReceived)
{
this.BeginBodiesUpdate();
// iterate through each body
for (int bodyIndex = 0; bodyIndex < this.bodies.Length; bodyIndex++)
{
Body body = this.bodies[bodyIndex];
if (body.IsTracked)
{
// check if this body clips an edge
this.UpdateClippedEdges(body, hasTrackedBody);
this.UpdateBody(body, bodyIndex);
hasTrackedBody = true;
}
else
{
// collapse this body from canvas as it goes out of view
this.ClearBody(bodyIndex);
}
}
if (!hasTrackedBody)
{
// clear clipped edges if no bodies are tracked
this.ClearClippedEdges();
}
}
}
/// <summary>
/// Clear update status of all bodies
/// </summary>
internal void BeginBodiesUpdate()
{
if (this.BodyInfos != null)
{
foreach (var bodyInfo in this.BodyInfos)
{
bodyInfo.Updated = false;
}
}
}
/// <summary>
/// Update body data for each body that is tracked.
/// </summary>
/// <param name="body">body for getting joint info</param>
/// <param name="bodyIndex">index for body we are currently updating</param>
internal void UpdateBody(Body body, int bodyIndex)
{
IReadOnlyDictionary<JointType, Joint> joints = body.Joints;
var jointPointsInDepthSpace = new Dictionary<JointType, Point>();
var bodyInfo = this.BodyInfos[bodyIndex];
CoordinateMapper coordinateMapper = this.kinectSensor.CoordinateMapper;
// update all joints
foreach (var jointType in body.Joints.Keys)
{
// sometimes the depth(Z) of an inferred joint may show as negative
// clamp down to 0.1f to prevent coordinatemapper from returning (-Infinity, -Infinity)
CameraSpacePoint position = body.Joints[jointType].Position;
if (position.Z < 0)
{
position.Z = InferredZPositionClamp;
}
// map joint position to depth space
DepthSpacePoint depthSpacePoint = coordinateMapper.MapCameraPointToDepthSpace(position);
jointPointsInDepthSpace[jointType] = new Point(depthSpacePoint.X, depthSpacePoint.Y);
// modify the joint's visibility and location
this.UpdateJoint(bodyInfo.JointPoints[jointType], joints[jointType], jointPointsInDepthSpace[jointType]);
// modify hand ellipse colors based on hand states
// modity hand ellipse sizes based on tracking confidences
if (jointType == JointType.HandRight)
{
this.UpdateHand(bodyInfo.HandRightEllipse, body.HandRightState, body.HandRightConfidence, jointPointsInDepthSpace[jointType]);
}
if (jointType == JointType.HandLeft)
{
this.UpdateHand(bodyInfo.HandLeftEllipse, body.HandLeftState, body.HandLeftConfidence, jointPointsInDepthSpace[jointType]);
}
}
// update all bones
foreach (var bone in bodyInfo.Bones)
{
this.UpdateBone(bodyInfo.BoneLines[bone], joints[bone.Item1], joints[bone.Item2],
jointPointsInDepthSpace[bone.Item1],
jointPointsInDepthSpace[bone.Item2]);
}
}
/// <summary>
/// Collapse the body from the canvas.
/// </summary>
/// <param name="bodyIndex"></param>
private void ClearBody(int bodyIndex)
{
var bodyInfo = this.BodyInfos[bodyIndex];
// collapse all joint ellipses
foreach (var joint in bodyInfo.JointPoints)
{
joint.Value.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
}
// collapse all bone lines
foreach (var bone in bodyInfo.Bones)
{
bodyInfo.BoneLines[bone].Visibility = Windows.UI.Xaml.Visibility.Collapsed;
}
// collapse handstate ellipses
bodyInfo.HandLeftEllipse.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
bodyInfo.HandRightEllipse.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
}
/// <summary>
/// Updates hand state ellipses depending on tracking state and it's confidence.
/// </summary>
/// <param name="ellipse">ellipse representing handstate</param>
/// <param name="handState">open, closed, or lasso</param>
/// <param name="trackingConfidence">confidence of handstate</param>
/// <param name="point">location of handjoint</param>
private void UpdateHand(Ellipse ellipse, HandState handState, TrackingConfidence trackingConfidence, Point point)
{
ellipse.Fill = new SolidColorBrush(this.HandStateToColor(handState));
// draw handstate ellipse based on tracking confidence
ellipse.Width = ellipse.Height = (trackingConfidence == TrackingConfidence.Low) ? LowConfidenceHandSize : HighConfidenceHandSize;
ellipse.Visibility = Windows.UI.Xaml.Visibility.Visible;
// don't draw handstate if hand joints are not tracked
if (!Double.IsInfinity(point.X) && !Double.IsInfinity(point.Y))
{
Canvas.SetLeft(ellipse, point.X - ellipse.Width / 2);
Canvas.SetTop(ellipse, point.Y - ellipse.Width / 2);
}
}
/// <summary>
/// Update a joint.
/// </summary>
/// <param name="ellipse"></param>
/// <param name="joint"></param>
/// <param name="point"></param>
private void UpdateJoint(Ellipse ellipse, Joint joint, Point point)
{
TrackingState trackingState = joint.TrackingState;
// only draw if joint is tracked or inferred
if (trackingState != TrackingState.NotTracked)
{
if (trackingState == TrackingState.Tracked)
{
ellipse.Fill = new SolidColorBrush(Colors.Green);
}
else
{
// inferred joints are yellow
ellipse.Fill = new SolidColorBrush(Colors.Yellow);
}
Canvas.SetLeft(ellipse, point.X - JointThickness / 2);
Canvas.SetTop(ellipse, point.Y - JointThickness / 2);
ellipse.Visibility = Windows.UI.Xaml.Visibility.Visible;
}
else
{
ellipse.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
}
}
/// <summary>
/// Update a bone line.
/// </summary>
/// <param name="line">line representing a bone line</param>
/// <param name="startJoint">start joint of bone line</param>
/// <param name="endJoint">end joint of bone line</param>
/// <param name="startPoint">location of start joint</param>
/// <param name="endPoint">location of end joint</param>
private void UpdateBone(Line line, Joint startJoint, Joint endJoint, Point startPoint, Point endPoint)
{
// don't draw if neither joints are tracked
if (startJoint.TrackingState == TrackingState.NotTracked || endJoint.TrackingState == TrackingState.NotTracked)
{
line.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
return;
}
// all lines are inferred thickness unless both joints are tracked
line.StrokeThickness = InferredBoneThickness;
if (startJoint.TrackingState == TrackingState.Tracked &&
endJoint.TrackingState == TrackingState.Tracked)
{
line.StrokeThickness = TrackedBoneThickness;
}
line.Visibility = Windows.UI.Xaml.Visibility.Visible;
line.X1 = startPoint.X;
line.Y1 = startPoint.Y;
line.X2 = endPoint.X;
line.Y2 = endPoint.Y;
}
/// <summary>
/// Draws indicators to show which edges are clipping body data.
/// </summary>
/// <param name="body">body to draw clipping information for</param>
/// <param name="hasTrackedBody">bool to determine if another body is triggering a clipped edge</param>
private void UpdateClippedEdges(Body body, bool hasTrackedBody)
{
// BUG (waiting for confirmation):
// Clip dectection works differently for top and right edges compared to left and bottom edges
// due to the current joint confidence model. This is an ST issue.
// Joints become inferred immediately as they touch the left/bottom edges and clip detection triggers.
// Joints squish on the right/top edges and clip detection doesn't trigger until more joints of
// the body goes out of view (e.g all hand joints vs only handtip).
FrameEdges clippedEdges = body.ClippedEdges;
if (clippedEdges.HasFlag(FrameEdges.Left))
{
this.LeftClipEdge.Visibility = Windows.UI.Xaml.Visibility.Visible;
}
else if(!hasTrackedBody)
{
// don't clear this edge if another body is triggering clipped edge
this.LeftClipEdge.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
}
if (clippedEdges.HasFlag(FrameEdges.Right))
{
this.RightClipEdge.Visibility = Windows.UI.Xaml.Visibility.Visible;
}
else if (!hasTrackedBody)
{
this.RightClipEdge.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
}
if (clippedEdges.HasFlag(FrameEdges.Top))
{
this.TopClipEdge.Visibility = Windows.UI.Xaml.Visibility.Visible;
}
else if (!hasTrackedBody)
{
this.TopClipEdge.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
}
if (clippedEdges.HasFlag(FrameEdges.Bottom))
{
this.BottomClipEdge.Visibility = Windows.UI.Xaml.Visibility.Visible;
}
else if (!hasTrackedBody)
{
this.BottomClipEdge.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
}
}
/// <summary>
/// Clear all clipped edges.
/// </summary>
private void ClearClippedEdges()
{
this.LeftClipEdge.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
this.RightClipEdge.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
this.TopClipEdge.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
this.BottomClipEdge.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
}
/// <summary>
/// Select color of hand state
/// </summary>
/// <param name="handState"></param>
/// <returns></returns>
private Color HandStateToColor(HandState handState)
{
switch (handState)
{
case HandState.Open:
return Colors.Green;
case HandState.Closed:
return Colors.Red;
case HandState.Lasso:
return Colors.Blue;
}
return Colors.Transparent;
}
/// <summary>
/// Instantiate new objects for joints, bone lines, and clipped edge rectangles
/// </summary>
private void PopulateVisualObjects()
{
// create clipped edges and set to collapsed initially
this.LeftClipEdge = new Rectangle()
{
Fill = new SolidColorBrush(Colors.Red),
Width = ClipBoundsThickness,
Height = this.DisplayGrid.Height,
Visibility = Windows.UI.Xaml.Visibility.Collapsed
};
this.RightClipEdge = new Rectangle()
{
Fill = new SolidColorBrush(Colors.Red),
Width = ClipBoundsThickness,
Height = this.DisplayGrid.Height,
Visibility = Windows.UI.Xaml.Visibility.Collapsed
};
this.TopClipEdge = new Rectangle()
{
Fill = new SolidColorBrush(Colors.Red),
Width = this.DisplayGrid.Width,
Height = ClipBoundsThickness,
Visibility = Windows.UI.Xaml.Visibility.Collapsed
};
this.BottomClipEdge = new Rectangle()
{
Fill = new SolidColorBrush(Colors.Red),
Width = this.DisplayGrid.Width,
Height = ClipBoundsThickness,
Visibility = Windows.UI.Xaml.Visibility.Collapsed
};
foreach (var bodyInfo in this.BodyInfos)
{
// add left and right hand ellipses of all bodies to canvas
this.drawingCanvas.Children.Add(bodyInfo.HandLeftEllipse);
this.drawingCanvas.Children.Add(bodyInfo.HandRightEllipse);
// add joint ellipses of all bodies to canvas
foreach (var joint in bodyInfo.JointPoints)
{
this.drawingCanvas.Children.Add(joint.Value);
}
// add bone lines of all bodies to canvas
foreach (var bone in bodyInfo.Bones)
{
this.drawingCanvas.Children.Add(bodyInfo.BoneLines[bone]);
}
}
// add clipped edges rectanges to main canvas
this.drawingCanvas.Children.Add(this.LeftClipEdge);
this.drawingCanvas.Children.Add(this.RightClipEdge);
this.drawingCanvas.Children.Add(this.TopClipEdge);
this.drawingCanvas.Children.Add(this.BottomClipEdge);
// position the clipped edges
Canvas.SetLeft(this.LeftClipEdge, 0);
Canvas.SetTop(this.LeftClipEdge, 0);
Canvas.SetLeft(this.RightClipEdge, this.DisplayGrid.Width - ClipBoundsThickness);
Canvas.SetTop(this.RightClipEdge, 0);
Canvas.SetLeft(this.TopClipEdge, 0);
Canvas.SetTop(this.TopClipEdge, 0);
Canvas.SetLeft(this.BottomClipEdge, 0);
Canvas.SetTop(this.BottomClipEdge, this.DisplayGrid.Height - ClipBoundsThickness);
}
/// <summary>
/// BodyInfo class that contains joint ellipses, handstate ellipses, lines for bones between two joints.
/// </summary>
private class BodyInfo
{
public bool Updated { get; set; }
public Color BodyColor { get; set; }
// ellipse representing left handstate
public Ellipse HandLeftEllipse { get; set; }
// ellipse representing right handstate
public Ellipse HandRightEllipse { get; set; }
// dictionary of all joints in a body
public Dictionary<JointType, Ellipse> JointPoints { get; private set; }
// definition of bones
public TupleList<JointType, JointType> Bones { get; private set; }
// collection of bones associated with the line object
public Dictionary<Tuple<JointType, JointType>, Line> BoneLines { get; private set; }
public BodyInfo(Color bodyColor)
{
this.BodyColor = bodyColor;
// create hand state ellipses
this.HandLeftEllipse = new Ellipse()
{
Visibility = Windows.UI.Xaml.Visibility.Collapsed
};
this.HandRightEllipse = new Ellipse()
{
Visibility = Windows.UI.Xaml.Visibility.Collapsed
};
// a joint defined as a jointType with a point location in XY space represented by an ellipse
this.JointPoints = new Dictionary<JointType, Ellipse>();
// pre-populate list of joints and set to non-visible initially
foreach (JointType jointType in Enum.GetValues(typeof(JointType)))
{
this.JointPoints.Add(jointType, new Ellipse()
{
Visibility = Windows.UI.Xaml.Visibility.Collapsed,
Fill = new SolidColorBrush(BodyColor),
Width = JointThickness,
Height = JointThickness
});
}
// collection of bones
this.BoneLines = new Dictionary<Tuple<JointType, JointType>, Line>();
// a bone defined as a line between two joints
this.Bones = new TupleList<JointType, JointType>
{
// Torso
{ JointType.Head, JointType.Neck },
{ JointType.Neck, JointType.SpineShoulder },
{ JointType.SpineShoulder, JointType.SpineMid },
{ JointType.SpineMid, JointType.SpineBase },
{ JointType.SpineShoulder, JointType.ShoulderRight },
{ JointType.SpineShoulder, JointType.ShoulderLeft },
{ JointType.SpineBase, JointType.HipRight },
{ JointType.SpineBase, JointType.HipLeft },
// Right Arm
{ JointType.ShoulderRight, JointType.ElbowRight },
{ JointType.ElbowRight, JointType.WristRight },
{ JointType.WristRight, JointType.HandRight },
{ JointType.HandRight, JointType.HandTipRight },
{ JointType.WristRight, JointType.ThumbRight },
// Left Arm
{ JointType.ShoulderLeft, JointType.ElbowLeft },
{ JointType.ElbowLeft, JointType.WristLeft },
{ JointType.WristLeft, JointType.HandLeft },
{ JointType.HandLeft, JointType.HandTipLeft },
{ JointType.WristLeft, JointType.ThumbLeft },
// Right Leg
{ JointType.HipRight, JointType.KneeRight },
{ JointType.KneeRight, JointType.AnkleRight },
{ JointType.AnkleRight, JointType.FootRight },
// Left Leg
{ JointType.HipLeft, JointType.KneeLeft },
{ JointType.KneeLeft, JointType.AnkleLeft },
{ JointType.AnkleLeft, JointType.FootLeft },
};
// pre-populate list of bones that are non-visible initially
foreach (var bone in this.Bones)
{
this.BoneLines.Add(bone, new Line()
{
Stroke = new SolidColorBrush(BodyColor),
Visibility = Visibility.Collapsed
});
}
}
}
private class TupleList<T1, T2> : List<Tuple<T1, T2>>
{
public void Add(T1 item, T2 item2)
{
this.Add(new Tuple<T1, T2>(item, item2));
}
}
/// <summary>
/// Handles the event which the sensor becomes unavailable (E.g. paused, closed, unplugged).
/// </summary>
/// <param name="sender">object sending the event</param>
/// <param name="e">event arguments</param>
private void Sensor_IsAvailableChanged(object sender, IsAvailableChangedEventArgs e)
{
// on failure, set the status text
if (!this.kinectSensor.IsAvailable)
{
this.StatusText = resourceLoader.GetString("SensorNotAvailableStatusText");
}
else
{
this.StatusText = resourceLoader.GetString("RunningStatusText");
}
}
}
}

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
<Identity Name="e515e7b3-374c-47d2-aa85-8c1aa0be9faa" Publisher="CN=Kinect for Windows Samples" Version="1.0.0.0" />
<Properties>
<DisplayName>BodyBasics-XAML</DisplayName>
<PublisherDisplayName>Kinect for Windows Samples</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.2.1</OSMinVersion>
<OSMaxVersionTested>6.2.1</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="BodyBasics_XAML.App">
<VisualElements DisplayName="BodyBasics-XAML" Logo="Assets\Logo.png" SmallLogo="Assets\SmallLogo.png" Description="BodyBasics-XAML" ForegroundText="light" BackgroundColor="#464646">
<DefaultTile ShowName="allLogos" />
<SplashScreen Image="Assets\SplashScreen.png" />
</VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<DeviceCapability Name="microphone" />
<DeviceCapability Name="webcam" />
</Capabilities>
</Package>

@ -1,35 +0,0 @@
//------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BodyBasics-XAML")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BodyBasics-XAML")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]

@ -1,132 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="NoSensorStatusText" xml:space="preserve">
<value>No ready Kinect found!</value>
</data>
<data name="RunningStatusText" xml:space="preserve">
<value>Running</value>
</data>
<data name="SensorNotAvailableStatusText" xml:space="preserve">
<value>Kinect not available!</value>
</data>
<data name="StandardStatusTextFormat" xml:space="preserve">
<value>FPS= {0:N1} Time = {1}</value>
</data>
</root>

@ -1,20 +0,0 @@
<Application
x:Class="Microsoft.Samples.Kinect.ColorBasics.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.Samples.Kinect.ColorBasics">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--
Styles that define common aspects of the platform look and feel
Required by Visual Studio project and item templates
-->
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

@ -1,108 +0,0 @@
//------------------------------------------------------------------------------
// <copyright file="App.xaml.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace Microsoft.Samples.Kinect.ColorBasics
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used when the application is launched to open a specific file, to display
/// search results, and so forth.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
// Set the default language
rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
rootFrame.NavigationFailed += OnNavigationFailed;
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
{
throw new Exception("Failed to create initial page");
}
}
// Ensure the current window is active
Window.Current.Activate();
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 B

@ -1,126 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{7775112C-5F13-4C95-A095-69D1852A7CAA}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ColorBasics_XAML</RootNamespace>
<AssemblyName>ColorBasics-XAML</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>ColorBasics-XAML_TemporaryKey.pfx</PackageCertificateKeyFile>
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
<PackageCertificateThumbprint>A57D8A6618953508D60FE39FF19F61E80A2257F4</PackageCertificateThumbprint>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<None Include="ColorBasics-XAML_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<Content Include="Assets\Logo.png" />
<Content Include="Assets\SmallLogo.png" />
<Content Include="Assets\SplashScreen.scale-100.png" />
<Content Include="Assets\SplashScreen.scale-140.png" />
<Content Include="Assets\SplashScreen.scale-180.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Images\Kinect.ico" />
<Content Include="Images\Logo.png" />
<Content Include="Images\Status.png" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="Common\StandardStyles.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<PRIResource Include="Resources.resw" />
</ItemGroup>
<ItemGroup>
<SDKReference Include="Microsoft.VCLibs, Version=11.0">
<Name>Microsoft Visual C++ Runtime Package</Name>
</SDKReference>
<SDKReference Include="WindowsPreview.Kinect, Version=2.0">
<Name>WindowsPreview.Kinect</Name>
</SDKReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '11.0' ">
<VisualStudioVersion>11.0</VisualStudioVersion>
</PropertyGroup>
<PropertyGroup />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

@ -1,30 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorBasics-XAML", "ColorBasics-XAML.csproj", "{7775112C-5F13-4C95-A095-69D1852A7CAA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7775112C-5F13-4C95-A095-69D1852A7CAA}.Debug|x64.ActiveCfg = Debug|x64
{7775112C-5F13-4C95-A095-69D1852A7CAA}.Debug|x64.Build.0 = Debug|x64
{7775112C-5F13-4C95-A095-69D1852A7CAA}.Debug|x64.Deploy.0 = Debug|x64
{7775112C-5F13-4C95-A095-69D1852A7CAA}.Debug|x86.ActiveCfg = Debug|x86
{7775112C-5F13-4C95-A095-69D1852A7CAA}.Debug|x86.Build.0 = Debug|x86
{7775112C-5F13-4C95-A095-69D1852A7CAA}.Debug|x86.Deploy.0 = Debug|x86
{7775112C-5F13-4C95-A095-69D1852A7CAA}.Release|x64.ActiveCfg = Release|x64
{7775112C-5F13-4C95-A095-69D1852A7CAA}.Release|x64.Build.0 = Release|x64
{7775112C-5F13-4C95-A095-69D1852A7CAA}.Release|x64.Deploy.0 = Release|x64
{7775112C-5F13-4C95-A095-69D1852A7CAA}.Release|x86.ActiveCfg = Release|x86
{7775112C-5F13-4C95-A095-69D1852A7CAA}.Release|x86.Build.0 = Release|x86
{7775112C-5F13-4C95-A095-69D1852A7CAA}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

@ -1,42 +0,0 @@
<Page
x:Class="Microsoft.Samples.Kinect.ColorBasics.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.Samples.Kinect.ColorBasics"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Unloaded="MainPage_Unloaded"
>
<Page.Resources>
<SolidColorBrush x:Key="MediumGreyBrush" Color="#ff6e6e6e" />
<SolidColorBrush x:Key="KinectPurpleBrush" Color="#ff52318f" />
<SolidColorBrush x:Key="KinectBlueBrush" Color="#ff00BCF2" />
</Page.Resources>
<Grid Background="White" Margin="10 0 10 0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Image Source="Images/Logo.png" Stretch="Fill" Height="32" Width="81" Margin="10 10 0 5"
Grid.Row="0" HorizontalAlignment="Left"/>
<Image Source="Images/Status.png" Stretch="None" HorizontalAlignment="Center"
Margin="0 0 0 5" Grid.Row="0"/>
<TextBlock Margin="0,0,10,10" VerticalAlignment="Bottom" HorizontalAlignment="Right" Foreground="{StaticResource MediumGreyBrush}" FontFamily="Segoe UI" FontSize="18"
Grid.Row="0">Color Basics</TextBlock>
<Viewbox Grid.Row="1" HorizontalAlignment="Center">
<Image Name="theImage" Stretch="UniformToFill" />
</Viewbox>
<StackPanel Grid.Row="3" HorizontalAlignment="Stretch" Name="statusBar" VerticalAlignment="Bottom" Background="White">
<TextBlock Text="{Binding StatusText}" Foreground="Black"/>
</StackPanel>
</Grid>
</Page>

@ -1,205 +0,0 @@
//------------------------------------------------------------------------------
// <copyright file="MainPage.xaml.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System.ComponentModel;
using System.IO;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel.Resources;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Imaging;
using WindowsPreview.Kinect;
namespace Microsoft.Samples.Kinect.ColorBasics
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page, INotifyPropertyChanged
{
/// <summary>
/// Resource loader for string resources
/// </summary>
private ResourceLoader resourceLoader = new ResourceLoader("Resources");
/// <summary>
/// Size of the RGB pixel in the bitmap
/// </summary>
private readonly uint bytesPerPixel;
/// <summary>
/// Active Kinect sensor
/// </summary>
private KinectSensor kinectSensor = null;
/// <summary>
/// Reader for color frames
/// </summary>
private ColorFrameReader colorFrameReader = null;
/// <summary>
/// Bitmap to display
/// </summary>
private WriteableBitmap bitmap = null;
/// <summary>
/// Intermediate storage for receiving frame data from the sensor
/// </summary>
private byte[] colorPixels = null;
/// <summary>
/// Current status text to display
/// </summary>
private string statusText = null;
/// <summary>
/// Initializes a new instance of the MainPage class.
/// </summary>
public MainPage()
{
// get the kinectSensor object
this.kinectSensor = KinectSensor.GetDefault();
// open the reader for the color frames
this.colorFrameReader = this.kinectSensor.ColorFrameSource.OpenReader();
// wire handler for frame arrival
this.colorFrameReader.FrameArrived += this.Reader_ColorFrameArrived;
// create the colorFrameDescription from the ColorFrameSource using rgba format
FrameDescription colorFrameDescription = this.kinectSensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Rgba);
// rgba is 4 bytes per pixel
this.bytesPerPixel = colorFrameDescription.BytesPerPixel;
// allocate space to put the pixels to be rendered
this.colorPixels = new byte[colorFrameDescription.Width * colorFrameDescription.Height * this.bytesPerPixel];
// create the bitmap to display
this.bitmap = new WriteableBitmap(colorFrameDescription.Width, colorFrameDescription.Height);
// set IsAvailableChanged event notifier
this.kinectSensor.IsAvailableChanged += this.Sensor_IsAvailableChanged;
// open the sensor
this.kinectSensor.Open();
// set the status text
this.StatusText = this.kinectSensor.IsAvailable ? resourceLoader.GetString("RunningStatusText")
: resourceLoader.GetString("NoSensorStatusText");
// use the window object as the view model in this simple example
this.DataContext = this;
// initialize the components (controls) of the window
this.InitializeComponent();
theImage.Source = this.bitmap;
}
/// <summary>
/// INotifyPropertyChangedPropertyChanged event to allow window controls to bind to changeable data.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Gets or sets the current status text to display
/// </summary>
public string StatusText
{
get
{
return this.statusText;
}
set
{
if (this.statusText != value)
{
this.statusText = value;
// notify any bound elements that the text has changed
if (this.PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs("StatusText"));
}
}
}
}
/// <summary>
/// Execute shutdown tasks.
/// </summary>
/// <param name="sender">object sending the event</param>
/// <param name="e">event arguments</param>
private void MainPage_Unloaded(object sender, RoutedEventArgs e)
{
if (this.colorFrameReader != null)
{
// ColorFrameReder is IDisposable
this.colorFrameReader.Dispose();
this.colorFrameReader = null;
}
if (this.kinectSensor != null)
{
this.kinectSensor.Close();
this.kinectSensor = null;
}
}
/// <summary>
/// Handles the color frame data arriving from the sensor.
/// </summary>
/// <param name="sender">object sending the event</param>
/// <param name="e">event arguments</param>
private void Reader_ColorFrameArrived(object sender, ColorFrameArrivedEventArgs e)
{
bool colorFrameProcessed = false;
// ColorFrame is IDisposable
using (ColorFrame colorFrame = e.FrameReference.AcquireFrame())
{
if (colorFrame != null)
{
FrameDescription colorFrameDescription = colorFrame.FrameDescription;
// verify data and write the new color frame data to the Writeable bitmap
if ((colorFrameDescription.Width == this.bitmap.PixelWidth) && (colorFrameDescription.Height == this.bitmap.PixelHeight))
{
if (colorFrame.RawColorImageFormat == ColorImageFormat.Bgra)
{
colorFrame.CopyRawFrameDataToBuffer(this.bitmap.PixelBuffer);
}
else
{
colorFrame.CopyConvertedFrameDataToBuffer(this.bitmap.PixelBuffer, ColorImageFormat.Bgra);
}
colorFrameProcessed = true;
}
}
}
// we got a frame, render
if (colorFrameProcessed)
{
this.bitmap.Invalidate();
}
}
/// <summary>
/// Handles the event which the sensor becomes unavailable (E.g. paused, closed, unplugged).
/// </summary>
/// <param name="sender">object sending the event</param>
/// <param name="e">event arguments</param>
private void Sensor_IsAvailableChanged(object sender, IsAvailableChangedEventArgs e)
{
// on failure, set the status text
this.StatusText = this.kinectSensor.IsAvailable ? resourceLoader.GetString("RunningStatusText")
: resourceLoader.GetString("SensorNotAvailableStatusText");
}
}
}

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
<Identity Name="9b425de7-8679-4c0a-94c6-63442c29b1b7"
Publisher="CN=Kinect for Windows Samples"
Version="1.0.0.0" />
<Properties>
<DisplayName>ColorBasics-XAML</DisplayName>
<PublisherDisplayName>Kinect for Windows Samples</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.2.1</OSMinVersion>
<OSMaxVersionTested>6.2.1</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="ColorBasics_XAML.App">
<VisualElements
DisplayName="ColorBasics-XAML"
Logo="Assets\Logo.png"
SmallLogo="Assets\SmallLogo.png"
Description="ColorBasics-XAML"
ForegroundText="light"
BackgroundColor="#464646">
<DefaultTile ShowName="allLogos" />
<SplashScreen Image="Assets\SplashScreen.png" />
</VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<DeviceCapability Name="microphone" />
<DeviceCapability Name="webcam" />
</Capabilities>
</Package>

@ -1,35 +0,0 @@
//------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ColorBasics-XAML")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ColorBasics-XAML")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]

@ -1,132 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="NoSensorStatusText" xml:space="preserve">
<value>No ready Kinect found!</value>
</data>
<data name="RunningStatusText" xml:space="preserve">
<value>Running</value>
</data>
<data name="SensorNotAvailableStatusText" xml:space="preserve">
<value>Kinect not available!</value>
</data>
<data name="StandardStatusTextFormat" xml:space="preserve">
<value>FPS= {0:N1} Time = {1}</value>
</data>
</root>

@ -1,20 +0,0 @@
<Application
x:Class="Microsoft.Samples.Kinect.DepthBasics.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.Samples.Kinect.DepthBasics">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--
Styles that define common aspects of the platform look and feel
Required by Visual Studio project and item templates
-->
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

@ -1,109 +0,0 @@
//------------------------------------------------------------------------------
// <copyright file="App.xaml.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace Microsoft.Samples.Kinect.DepthBasics
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used when the application is launched to open a specific file, to display
/// search results, and so forth.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
// Set the default language
rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
rootFrame.NavigationFailed += OnNavigationFailed;
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
{
throw new Exception("Failed to create initial page");
}
}
// Ensure the current window is active
Window.Current.Activate();
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 B

File diff suppressed because it is too large Load Diff

@ -1,121 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2861D2C8-9DD8-4D70-A364-F274A66BE96A}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DepthBasics_XAML</RootNamespace>
<AssemblyName>DepthBasics-XAML</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>DepthBasics-XAML_TemporaryKey.pfx</PackageCertificateKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<None Include="DepthBasics-XAML_TemporaryKey.pfx" />
<PRIResource Include="Resources.resw" />
</ItemGroup>
<ItemGroup>
<Content Include="Assets\Logo.png" />
<Content Include="Assets\SmallLogo.png" />
<Content Include="Assets\SplashScreen.scale-100.png" />
<Content Include="Assets\SplashScreen.scale-140.png" />
<Content Include="Assets\SplashScreen.scale-180.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Images\Kinect.ico" />
<Content Include="Images\Logo.png" />
<Content Include="Images\Status.png" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="Common\StandardStyles.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<SDKReference Include="Microsoft.VCLibs, version=11.0">
<Name>Microsoft Visual C++ Runtime Package</Name>
</SDKReference>
<SDKReference Include="WindowsPreview.Kinect, Version=2.0">
<Name>WindowsPreview.Kinect</Name>
</SDKReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '11.0' ">
<VisualStudioVersion>11.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

@ -1,30 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DepthBasics-XAML", "DepthBasics-XAML.csproj", "{2861D2C8-9DD8-4D70-A364-F274A66BE96A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2861D2C8-9DD8-4D70-A364-F274A66BE96A}.Debug|x64.ActiveCfg = Debug|x64
{2861D2C8-9DD8-4D70-A364-F274A66BE96A}.Debug|x64.Build.0 = Debug|x64
{2861D2C8-9DD8-4D70-A364-F274A66BE96A}.Debug|x64.Deploy.0 = Debug|x64
{2861D2C8-9DD8-4D70-A364-F274A66BE96A}.Debug|x86.ActiveCfg = Debug|x86
{2861D2C8-9DD8-4D70-A364-F274A66BE96A}.Debug|x86.Build.0 = Debug|x86
{2861D2C8-9DD8-4D70-A364-F274A66BE96A}.Debug|x86.Deploy.0 = Debug|x86
{2861D2C8-9DD8-4D70-A364-F274A66BE96A}.Release|x64.ActiveCfg = Release|x64
{2861D2C8-9DD8-4D70-A364-F274A66BE96A}.Release|x64.Build.0 = Release|x64
{2861D2C8-9DD8-4D70-A364-F274A66BE96A}.Release|x64.Deploy.0 = Release|x64
{2861D2C8-9DD8-4D70-A364-F274A66BE96A}.Release|x86.ActiveCfg = Release|x86
{2861D2C8-9DD8-4D70-A364-F274A66BE96A}.Release|x86.Build.0 = Release|x86
{2861D2C8-9DD8-4D70-A364-F274A66BE96A}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

@ -1,41 +0,0 @@
<Page
x:Class="Microsoft.Samples.Kinect.DepthBasics.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.Samples.Kinect.DepthBasics"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Unloaded="MainPage_Unloaded"
>
<Page.Resources>
<SolidColorBrush x:Key="MediumGreyBrush" Color="#ff6e6e6e" />
<SolidColorBrush x:Key="KinectPurpleBrush" Color="#ff52318f" />
<SolidColorBrush x:Key="KinectBlueBrush" Color="#ff00BCF2" />
</Page.Resources>
<Grid Background="White" Margin="10 0 10 0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Image Source="Images/Logo.png" Stretch="Fill" Height="32" Width="81" Margin="10 10 0 5"
Grid.Row="0" HorizontalAlignment="Left"/>
<Image Source="Images/Status.png" Stretch="None" HorizontalAlignment="Center"
Margin="0 0 0 5" Grid.Row="0"/>
<TextBlock Margin="0,0,10,10" VerticalAlignment="Bottom" HorizontalAlignment="Right" Foreground="{StaticResource MediumGreyBrush}" FontFamily="Segoe UI" FontSize="18"
Grid.Row="0">Depth Basics</TextBlock>
<Viewbox Grid.Row="1" HorizontalAlignment="Center">
<Image Name="theImage" Stretch="UniformToFill" />
</Viewbox>
<StackPanel Grid.Row="3" HorizontalAlignment="Stretch" Name="statusBar" VerticalAlignment="Bottom" Background="White">
<TextBlock Text="{Binding StatusText}" Foreground="Black"/>
</StackPanel>
</Grid>
</Page>

@ -1,267 +0,0 @@
//------------------------------------------------------------------------------
// <copyright file="MainPage.xaml.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System.ComponentModel;
using System.IO;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel.Resources;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Imaging;
using WindowsPreview.Kinect;
namespace Microsoft.Samples.Kinect.DepthBasics
{
/// <summary>
/// Main page for sample
/// </summary>
public sealed partial class MainPage : Page, INotifyPropertyChanged
{
/// <summary>
/// Map depth range to byte range
/// </summary>
private const int MapDepthToByte = 8000 / 256;
/// <summary>
/// Resource loader for string resources
/// </summary>
#if WIN81ORLATER
private ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView("Resources");
#else
private ResourceLoader resourceLoader = new ResourceLoader("Resources");
#endif
/// <summary>
/// Size of the RGB pixel in the bitmap
/// </summary>
private readonly int cbytesPerPixel = 4;
/// <summary>
/// Active Kinect sensor
/// </summary>
private KinectSensor kinectSensor = null;
/// <summary>
/// Reader for depth frames
/// </summary>
private DepthFrameReader depthFrameReader = null;
/// <summary>
/// Bitmap to display
/// </summary>
private WriteableBitmap bitmap = null;
/// <summary>
/// Intermediate storage for receiving frame data from the sensor
/// </summary>
private ushort[] depthFrameData = null;
/// <summary>
/// Intermediate storage for frame data converted to color
/// </summary>
private byte[] depthPixels = null;
/// <summary>
/// Current status text to display
/// </summary>
private string statusText = null;
/// <summary>
/// Initializes a new instance of the MainPage class.
/// </summary>
public MainPage()
{
// get the kinectSensor object
this.kinectSensor = KinectSensor.GetDefault();
// get the depthFrameDescription from the DepthFrameSource
FrameDescription depthFrameDescription = this.kinectSensor.DepthFrameSource.FrameDescription;
// open the reader for the depth frames
this.depthFrameReader = this.kinectSensor.DepthFrameSource.OpenReader();
// wire handler for frame arrival
this.depthFrameReader.FrameArrived += this.Reader_DepthFrameArrived;
// allocate space to put the pixels being received and converted
this.depthFrameData = new ushort[depthFrameDescription.Width * depthFrameDescription.Height];
this.depthPixels = new byte[depthFrameDescription.Width * depthFrameDescription.Height * this.cbytesPerPixel];
// create the bitmap to display
this.bitmap = new WriteableBitmap(depthFrameDescription.Width, depthFrameDescription.Height);//, 96.0, 96.0, PixelFormats.Bgr32, null);
// set IsAvailableChanged event notifier
this.kinectSensor.IsAvailableChanged += this.Sensor_IsAvailableChanged;
// open the sensor
this.kinectSensor.Open();
// set the status text
this.StatusText = this.kinectSensor.IsAvailable ? resourceLoader.GetString("RunningStatusText")
: resourceLoader.GetString("NoSensorStatusText");
// use the window object as the view model in this simple example
this.DataContext = this;
// initialize the components (controls) of the window
this.InitializeComponent();
}
/// <summary>
/// INotifyPropertyChangedPropertyChanged event to allow window controls to bind to changeable data.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Gets or sets the current status text to display
/// </summary>
public string StatusText
{
get
{
return this.statusText;
}
set
{
if (this.statusText != value)
{
this.statusText = value;
// notify any bound elements that the text has changed
if (this.PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs("StatusText"));
}
}
}
}
/// <summary>
/// Execute shutdown tasks.
/// </summary>
/// <param name="sender">object sending the event</param>
/// <param name="e">event arguments</param>
private void MainPage_Unloaded(object sender, RoutedEventArgs e)
{
if (this.depthFrameReader != null)
{
// DepthFrameReder is IDisposable
this.depthFrameReader.Dispose();
this.depthFrameReader = null;
}
if (this.kinectSensor != null)
{
this.kinectSensor.Close();
this.kinectSensor = null;
}
}
/// <summary>
/// Handles the depth frame data arriving from the sensor.
/// </summary>
/// <param name="sender">object sending the event</param>
/// <param name="e">event arguments</param>
private void Reader_DepthFrameArrived(object sender, DepthFrameArrivedEventArgs e)
{
ushort minDepth = 0;
ushort maxDepth = 0;
bool depthFrameProcessed = false;
// DepthFrame is IDisposable
using (DepthFrame depthFrame = e.FrameReference.AcquireFrame())
{
if (depthFrame != null)
{
FrameDescription depthFrameDescription = depthFrame.FrameDescription;
// verify data and write the new depth frame data to the display bitmap
if (((depthFrameDescription.Width * depthFrameDescription.Height) == this.depthFrameData.Length) &&
(depthFrameDescription.Width == this.bitmap.PixelWidth) && (depthFrameDescription.Height == this.bitmap.PixelHeight))
{
// Copy the pixel data from the image to a temporary array
depthFrame.CopyFrameDataToArray(this.depthFrameData);
minDepth = depthFrame.DepthMinReliableDistance;
// Note: In order to see the full range of depth (including the less reliable far field depth)
// we are setting maxDepth to the extreme potential depth threshold
maxDepth = ushort.MaxValue;
// If you wish to filter by reliable depth distance, uncomment the following line:
//// maxDepth = depthFrame.DepthMaxReliableDistance
depthFrameProcessed = true;
}
}
}
// we got a frame, convert and render
if (depthFrameProcessed)
{
ConvertDepthData(minDepth, maxDepth);
RenderDepthPixels(this.depthPixels);
}
}
/// <summary>
/// Converts depth to RGB.
/// </summary>
/// <param name="frame"></param>
private void ConvertDepthData(ushort minDepth, ushort maxDepth)
{
int colorPixelIndex = 0;
for (int i = 0; i < this.depthFrameData.Length; ++i)
{
// Get the depth for this pixel
ushort depth = this.depthFrameData[i];
// To convert to a byte, we're mapping the depth value to the byte range.
// Values outside the reliable depth range are mapped to 0 (black).
byte intensity = (byte)(depth >= minDepth && depth <= maxDepth ? (depth / MapDepthToByte) : 0);
// Write out blue byte
this.depthPixels[colorPixelIndex++] = intensity;
// Write out green byte
this.depthPixels[colorPixelIndex++] = intensity;
// Write out red byte
this.depthPixels[colorPixelIndex++] = intensity;
// Write out alpha byte
this.depthPixels[colorPixelIndex++] = 255;
}
}
/// <summary>
/// Renders color pixels into the writeableBitmap.
/// </summary>
/// <param name="pixels">pixel data</param>
private void RenderDepthPixels(byte[] pixels)
{
pixels.CopyTo(this.bitmap.PixelBuffer);
this.bitmap.Invalidate();
theImage.Source = this.bitmap;
}
/// <summary>
/// Handles the event which the sensor becomes unavailable (E.g. paused, closed, unplugged).
/// </summary>
/// <param name="sender">object sending the event</param>
/// <param name="e">event arguments</param>
private void Sensor_IsAvailableChanged(object sender, IsAvailableChangedEventArgs e)
{
// on failure, set the status text
this.StatusText = this.kinectSensor.IsAvailable ? resourceLoader.GetString("RunningStatusText")
: resourceLoader.GetString("SensorNotAvailableStatusText");
}
}
}

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
<Identity Name="62b06cb0-593a-45ed-b8ab-f71b37c21fd5"
Publisher="CN=Kinect for Windows Samples"
Version="1.0.0.0" />
<Properties>
<DisplayName>DepthBasics-XAML</DisplayName>
<PublisherDisplayName>Kinect for Windows Samples</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.2.1</OSMinVersion>
<OSMaxVersionTested>6.2.1</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="DepthBasics_XAML.App">
<VisualElements
DisplayName="DepthBasics-XAML"
Logo="Assets\Logo.png"
SmallLogo="Assets\SmallLogo.png"
Description="DepthBasics-XAML"
ForegroundText="light"
BackgroundColor="#464646">
<DefaultTile ShowName="allLogos" />
<SplashScreen Image="Assets\SplashScreen.png" />
</VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<DeviceCapability Name="microphone" />
<DeviceCapability Name="webcam" />
</Capabilities>
</Package>

@ -1,35 +0,0 @@
//------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DepthBasics-XAML")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DepthBasics-XAML")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]

@ -1,132 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="NoSensorStatusText" xml:space="preserve">
<value>No ready Kinect found!</value>
</data>
<data name="RunningStatusText" xml:space="preserve">
<value>Running</value>
</data>
<data name="SensorNotAvailableStatusText" xml:space="preserve">
<value>Kinect not available!</value>
</data>
<data name="StandardStatusTextFormat" xml:space="preserve">
<value>FPS= {0:N1} Time = {1}</value>
</data>
</root>

@ -1,20 +0,0 @@
<Application
x:Class="Microsoft.Samples.Kinect.InfraredBasics.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.Samples.Kinect.InfraredBasics">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--
Styles that define common aspects of the platform look and feel
Required by Visual Studio project and item templates
-->
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

@ -1,103 +0,0 @@
//------------------------------------------------------------------------------
// <copyright file="App.xaml.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace Microsoft.Samples.Kinect.InfraredBasics
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
// Set the default language
rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

@ -1,121 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{C5BB9835-588E-41A0-A722-CB66863E7AAF}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>InfraredBasics_XAML</RootNamespace>
<AssemblyName>InfraredBasics-XAML</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>InfraredBasics-XAML_TemporaryKey.pfx</PackageCertificateKeyFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<None Include="InfraredBasics-XAML_TemporaryKey.pfx" />
<PRIResource Include="Resources.resw" />
</ItemGroup>
<ItemGroup>
<Content Include="Assets\Logo.png" />
<Content Include="Assets\SmallLogo.png" />
<Content Include="Assets\SplashScreen.scale-100.png" />
<Content Include="Assets\SplashScreen.scale-140.png" />
<Content Include="Assets\SplashScreen.scale-180.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Images\Kinect.ico" />
<Content Include="Images\Logo.png" />
<Content Include="Images\Status.png" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="Common\StandardStyles.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<SDKReference Include="Microsoft.VCLibs, Version=11.0">
<Name>Microsoft Visual C++ Runtime Package</Name>
</SDKReference>
<SDKReference Include="WindowsPreview.Kinect, Version=2.0">
<Name>WindowsPreview.Kinect</Name>
</SDKReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '11.0' ">
<VisualStudioVersion>11.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

@ -1,30 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InfraredBasics-XAML", "InfraredBasics-XAML.csproj", "{C5BB9835-588E-41A0-A722-CB66863E7AAF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C5BB9835-588E-41A0-A722-CB66863E7AAF}.Debug|x86.ActiveCfg = Debug|x86
{C5BB9835-588E-41A0-A722-CB66863E7AAF}.Debug|x86.Build.0 = Debug|x86
{C5BB9835-588E-41A0-A722-CB66863E7AAF}.Debug|x86.Deploy.0 = Debug|x86
{C5BB9835-588E-41A0-A722-CB66863E7AAF}.Release|x86.ActiveCfg = Release|x86
{C5BB9835-588E-41A0-A722-CB66863E7AAF}.Release|x86.Build.0 = Release|x86
{C5BB9835-588E-41A0-A722-CB66863E7AAF}.Release|x86.Deploy.0 = Release|x86
{C5BB9835-588E-41A0-A722-CB66863E7AAF}.Debug|x64.ActiveCfg = Debug|x64
{C5BB9835-588E-41A0-A722-CB66863E7AAF}.Debug|x64.Build.0 = Debug|x64
{C5BB9835-588E-41A0-A722-CB66863E7AAF}.Debug|x64.Deploy.0 = Debug|x64
{C5BB9835-588E-41A0-A722-CB66863E7AAF}.Release|x64.ActiveCfg = Release|x64
{C5BB9835-588E-41A0-A722-CB66863E7AAF}.Release|x64.Build.0 = Release|x64
{C5BB9835-588E-41A0-A722-CB66863E7AAF}.Release|x64.Deploy.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

@ -1,40 +0,0 @@
<Page
x:Class="Microsoft.Samples.Kinect.InfraredBasics.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.Samples.Kinect.InfraredBasics"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Unloaded="MainPage_Unloaded"
>
<Page.Resources>
<SolidColorBrush x:Key="MediumGreyBrush" Color="#ff6e6e6e" />
<SolidColorBrush x:Key="KinectPurpleBrush" Color="#ff52318f" />
<SolidColorBrush x:Key="KinectBlueBrush" Color="#ff00BCF2" />
</Page.Resources>
<Grid Background="White" Margin="10 0 10 0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Image Source="Images/Logo.png" Stretch="Fill" Height="32" Width="81" Margin="10 10 0 5"
Grid.Row="0" HorizontalAlignment="Left"/>
<Image Source="Images/Status.png" Stretch="None" HorizontalAlignment="Center"
Margin="0 0 0 5" Grid.Row="0"/>
<TextBlock Margin="0,0,10,10" VerticalAlignment="Bottom" HorizontalAlignment="Right" Foreground="{StaticResource MediumGreyBrush}" FontFamily="Segoe UI" FontSize="18"
Grid.Row="0">Infrared Basics</TextBlock>
<Viewbox Grid.Row="1" HorizontalAlignment="Center">
<Image Name="theImage" Stretch="UniformToFill" />
</Viewbox>
<StackPanel Grid.Row="3" HorizontalAlignment="Stretch" Name="statusBar" VerticalAlignment="Bottom" Background="White">
<TextBlock Text="{Binding StatusText}" Foreground="Black"/>
</StackPanel>
</Grid>
</Page>

@ -1,289 +0,0 @@
//------------------------------------------------------------------------------
// <copyright file="MainPage.xaml.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.ComponentModel;
using System.IO;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel.Resources;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Imaging;
using WindowsPreview.Kinect;
namespace Microsoft.Samples.Kinect.InfraredBasics
{
/// <summary>
/// Main page for sample
/// </summary>
public sealed partial class MainPage : Page, INotifyPropertyChanged
{
/// <summary>
/// InfraredSourceValueMaximum is the highest value that can be returned in the InfraredFrame.
/// It is cast to a float for readability in the visualization code.
/// </summary>
private const float InfraredSourceValueMaximum = (float)ushort.MaxValue;
/// <summary>
/// The InfraredOutputValueMinimum value is used to set the lower limit, post processing, of the
/// infrared data that we will render.
/// Increasing or decreasing this value sets a brightness "wall" either closer or further away.
/// </summary>
private const float InfraredOutputValueMinimum = 0.01f;
/// <summary>
/// The InfraredOutputValueMaximum value is the upper limit, post processing, of the
/// infrared data that we will render.
/// </summary>
private const float InfraredOutputValueMaximum = 1.0f;
/// <summary>
/// The InfraredSceneValueAverage value specifies the average infrared value of the scene.
/// This value was selected by analyzing the average pixel intensity for a given scene.
/// Depending on the visualization requirements for a given application, this value can be
/// hard coded, as was done here, or calculated by averaging the intensity for each pixel prior
/// to rendering.
/// </summary>
private const float InfraredSceneValueAverage = 0.08f;
/// <summary>
/// The InfraredSceneStandardDeviations value specifies the number of standard deviations
/// to apply to InfraredSceneValueAverage. This value was selected by analyzing data
/// from a given scene.
/// Depending on the visualization requirements for a given application, this value can be
/// hard coded, as was done here, or calculated at runtime.
/// </summary>
private const float InfraredSceneStandardDeviations = 3.0f;
/// <summary>
/// Size of the RGB pixel in the bitmap
/// </summary>
private const int BytesPerPixel = 4;
/// <summary>
/// Resource loader for string resources
/// </summary>
#if WIN81ORLATER
private ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView("Resources");
#else
private ResourceLoader resourceLoader = new ResourceLoader("Resources");
#endif
/// <summary>
/// Active Kinect sensor
/// </summary>
private KinectSensor kinectSensor = null;
/// <summary>
/// Reader for infrared frames
/// </summary>
private InfraredFrameReader infraredFrameReader = null;
/// <summary>
/// Bitmap to display
/// </summary>
private WriteableBitmap bitmap = null;
/// <summary>
/// Intermediate storage for receiving frame data from the sensor
/// </summary>
private ushort[] infraredFrameData = null;
/// <summary>
/// Intermediate storage for frame data converted to color
/// </summary>
private byte[] infraredPixels = null;
/// <summary>
/// Current status text to display
/// </summary>
private string statusText = null;
/// <summary>
/// Initializes a new instance of the MainPage class.
/// </summary>
public MainPage()
{
// get the kinectSensor object
this.kinectSensor = KinectSensor.GetDefault();
// get the infraredFrameDescription from the InfraredFrameSource
FrameDescription infraredFrameDescription = this.kinectSensor.InfraredFrameSource.FrameDescription;
// open the reader for the infrared frames
this.infraredFrameReader = this.kinectSensor.InfraredFrameSource.OpenReader();
// wire handler for frame arrival
this.infraredFrameReader.FrameArrived += this.Reader_InfraredFrameArrived;
// allocate space to put the pixels being received and converted
this.infraredFrameData = new ushort[infraredFrameDescription.Width * infraredFrameDescription.Height];
this.infraredPixels = new byte[infraredFrameDescription.Width * infraredFrameDescription.Height * BytesPerPixel];
// create the bitmap to display
this.bitmap = new WriteableBitmap(infraredFrameDescription.Width, infraredFrameDescription.Height);
// set IsAvailableChanged event notifier
this.kinectSensor.IsAvailableChanged += this.Sensor_IsAvailableChanged;
// open the sensor
this.kinectSensor.Open();
// set the status text
this.StatusText = this.kinectSensor.IsAvailable ? resourceLoader.GetString("RunningStatusText")
: resourceLoader.GetString("NoSensorStatusText");
// use the window object as the view model in this simple example
this.DataContext = this;
// initialize the components (controls) of the window
this.InitializeComponent();
}
/// <summary>
/// INotifyPropertyChangedPropertyChanged event to allow window controls to bind to changeable data.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Gets or sets the current status text to display
/// </summary>
public string StatusText
{
get
{
return this.statusText;
}
set
{
if (this.statusText != value)
{
this.statusText = value;
// notify any bound elements that the text has changed
if (this.PropertyChanged != null)
{
this.PropertyChanged(this, new PropertyChangedEventArgs("StatusText"));
}
}
}
}
/// <summary>
/// Execute shutdown tasks.
/// </summary>
/// <param name="sender">object sending the event</param>
/// <param name="e">event arguments</param>
private void MainPage_Unloaded(object sender, RoutedEventArgs e)
{
if (this.infraredFrameReader != null)
{
// InfraredFrameReder is IDisposable
this.infraredFrameReader.Dispose();
this.infraredFrameReader = null;
}
if (this.kinectSensor != null)
{
this.kinectSensor.Close();
this.kinectSensor = null;
}
}
/// <summary>
/// Handles the infrared frame data arriving from the sensor.
/// </summary>
/// <param name="sender">object sending the event</param>
/// <param name="e">event arguments</param>
private void Reader_InfraredFrameArrived(object sender, InfraredFrameArrivedEventArgs e)
{
bool infraredFrameProcessed = false;
// InfraredFrame is IDisposable
using (InfraredFrame infraredFrame = e.FrameReference.AcquireFrame())
{
if (infraredFrame != null)
{
FrameDescription infraredFrameDescription = infraredFrame.FrameDescription;
// verify data and write the new infrared frame data to the display bitmap
if (((infraredFrameDescription.Width * infraredFrameDescription.Height) == this.infraredFrameData.Length) &&
(infraredFrameDescription.Width == this.bitmap.PixelWidth) && (infraredFrameDescription.Height == this.bitmap.PixelHeight))
{
// Copy the pixel data from the image to a temporary array
infraredFrame.CopyFrameDataToArray(this.infraredFrameData);
infraredFrameProcessed = true;
}
}
}
// we got a frame, convert and render
if (infraredFrameProcessed)
{
this.ConvertInfraredData();
this.RenderInfraredPixels(this.infraredPixels);
}
}
/// <summary>
/// Convert infrared to RGB.
/// </summary>
private void ConvertInfraredData()
{
// Convert the infrared to RGB
int colorPixelIndex = 0;
for (int i = 0; i < this.infraredFrameData.Length; ++i)
{
// normalize the incoming infrared data (ushort) to a float ranging from
// [InfraredOutputValueMinimum, InfraredOutputValueMaximum] by
// 1. dividing the incoming value by the source maximum value
float intensityRatio = (float)this.infraredFrameData[i] / InfraredSourceValueMaximum;
// 2. dividing by the (average scene value * standard deviations)
intensityRatio /= InfraredSceneValueAverage * InfraredSceneStandardDeviations;
// 3. limiting the value to InfraredOutputValueMaximum
intensityRatio = Math.Min(InfraredOutputValueMaximum, intensityRatio);
// 4. limiting the lower value InfraredOutputValueMinimym
intensityRatio = Math.Max(InfraredOutputValueMinimum, intensityRatio);
// 5. converting the normalized value to a byte and using the result
// as the RGB components required by the image
byte intensity = (byte)(intensityRatio * 255.0f);
this.infraredPixels[colorPixelIndex++] = intensity;
this.infraredPixels[colorPixelIndex++] = intensity;
this.infraredPixels[colorPixelIndex++] = intensity;
this.infraredPixels[colorPixelIndex++] = 255;
}
}
/// <summary>
/// Renders color pixels into the writeableBitmap.
/// </summary>
/// <param name="pixels">pixel data</param>
private void RenderInfraredPixels(byte[] pixels)
{
pixels.CopyTo(this.bitmap.PixelBuffer);
this.bitmap.Invalidate();
theImage.Source = this.bitmap;
}
/// <summary>
/// Handles the event which the sensor becomes unavailable (E.g. paused, closed, unplugged).
/// </summary>
/// <param name="sender">object sending the event</param>
/// <param name="e">event arguments</param>
private void Sensor_IsAvailableChanged(object sender, IsAvailableChangedEventArgs e)
{
// on failure, set the status text
this.StatusText = this.kinectSensor.IsAvailable ? resourceLoader.GetString("RunningStatusText")
: resourceLoader.GetString("SensorNotAvailableStatusText");
}
}
}

@ -1,45 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
<Identity Name="bd7d9ef1-041a-4d54-9639-f85a31f99461"
Publisher="CN=Kinect for Windows Samples"
Version="1.0.0.0" />
<Properties>
<DisplayName>InfraredBasics-XAML</DisplayName>
<PublisherDisplayName>Kinect for Windows Samples</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.2.1</OSMinVersion>
<OSMaxVersionTested>6.2.1</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="InfraredBasics_XAML.App">
<VisualElements
DisplayName="InfraredBasics-XAML"
Logo="Assets\Logo.png"
SmallLogo="Assets\SmallLogo.png"
Description="InfraredBasics-XAML"
ForegroundText="light"
BackgroundColor="#464646">
<DefaultTile ShowName="allLogos" />
<SplashScreen Image="Assets\SplashScreen.png" />
</VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<DeviceCapability Name="microphone" />
<DeviceCapability Name="webcam" />
</Capabilities>
</Package>

@ -1,35 +0,0 @@
//------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("InfraredBasics-XAML")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("InfraredBasics-XAML")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]

@ -1,132 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="NoSensorStatusText" xml:space="preserve">
<value>No ready Kinect found!</value>
</data>
<data name="RunningStatusText" xml:space="preserve">
<value>Running</value>
</data>
<data name="SensorNotAvailableStatusText" xml:space="preserve">
<value>Kinect not available!</value>
</data>
<data name="StandardStatusTextFormat" xml:space="preserve">
<value>FPS= {0:N1} Time = {1}</value>
</data>
</root>

@ -1,391 +0,0 @@
[Home](./README.md)
| **Exercise 1 - Kinect Streams**
| [Exercise 2 - Introduction](./exo2_subject.md)
| [Exercise 2 part 1 - Postures](./exo2_1_subject.md)
| [Exercise 2 part 2 - Gestures](./exo2_2_subject.md)
| [Exercise 2 part 3 - Mapping](./exo2_3_subject.md)
| [Exercise 3 - Free App](./exo3_subject.md)
# Exercise 1: Kinect Sensor and Kinect Streams
*Advised duration*: 4 hours
*Maximum advised duration*: 6 hours
# Prerequisites
- WPF & XAML
- Data binding
- (not mandatory) converters
- events
- IDisposable
- (*not mandatory*) MVVM and/or MVVM Community Toolkit
# Resources
- 🔜 How to turn a **WPF Application (.NET Framework)** to a **SDK-style csproj**?
- 🔜 Microsoft Kinect Samples
- 🔜 videos about events
- 🔜 XAML
- 🔜 Data Binding
- 🔜 Converters
# Requested Work
The goal of this exercise is to create a WPF Application allowing to get these different **Kinect** streams (🚨 are mandatory):
- 🚨 color stream,
<img src="images/forsubjects/color.PNG" height="120px"/>
- depth stream,
<img src="images/forsubjects/depth.PNG" height="120px"/>
- infrared stream,
<img src="images/forsubjects/IR.PNG" height="120px"/>
- 🚨 body stream,
<img src="images/forsubjects/body.PNG" height="120px"/>
- body & color streams (a combination of color and body streams, where the skeleton is drawn above the color image).
The main (and only) window of your application, could look like this:
<img src="images/forsubjects/sketch01.png" width="800px"/>
- the upper part indicates if the **Kinect** sensor is available and running or not. It should display a **red dot** and a convenient text if the **Kinect** sensor is unplugged or not running yet. It should display a **green dot** and a convenient text otherwise.
- below this part, stands an horizontal bar of buttons allowing to switch between streams. The available streams are **color** (mandatory), **depth**, **infrared**, **body** (mandatory), and **body and color** streams. All this buttons should no be clickable if the **Kinect** is not available.
- at last, the remaining of the window will display the content of the selected stream.
# Steps to reproduce
This part is given as a set of advises to realize your application.
I use some symbols in it:
symbol | signification
--- | ---
💡 | be smart: this can obviously be done before practical works and without the kinect sensor!
🎬 | evaluated at the end of all the practical works
🚨 | mandatory if you want at least 10/20
🟢 | difficulty: low
🟡 | difficulty: medium
🔴 | difficulty: high
🔖 | quality (it's always better when it's beautiful 🥹)
> Note about difficulty:
> It's obviously completely subjective...
## 💡🚨🟢 Create the Window
- Create your repository
- Create a **WPF Application (.NET Framework)**
- Turn it to *SDK-style csproj* (especially if you want to use *MVVM Community Toolkit*, otherwise it is useless)
- Create the UI of your window (XAML)
## 🚨🟢 Kinect connection
- 💡 Read the Microsoft Kinect Samples (especially the **Color Basics-XAML** sample) and find how the **Kinect** sensor is managed
- Tip about how to encapsulate your **Kinect** sensor. You could write a ```KinectManager``` class like this one:
```mermaid
classDiagram
class KinectManager {
+/Status: bool
+/StatusText: string
+StartSensor()
+StopSensor()
-KinectSensor_IsAvailableChanged(sender, args)
}
class KinectSensor {
+/IsOpen: bool
+GetDefault()$ KinectSensor
+~~event~~IsAvailableChanged
+Open()
+Close()
}
KinectSensor <-- KinectManager
```
This class could be able to start and stop the sensor and listen to the IsAvailableChanged event from the ```KinectSensor```. It would also give access to status information through ```Status``` and ```StatusText```.
> TIP:
> If you like MVVM, consider using it directly to get more points (read next sections below).
- Use this class with your app:
- to start the sensor if it is plugged, when the window loads
- to stop the sensor when the window unloads
- use the status feedbacks to update the upper part of the window
## 🚨🟢 Display Color Image Stream
- 💡 Read the Microsoft Kinect Samples (especially the **Color Basics-XAML** sample) and find how to get the color stream
- Create your own class ```ColorImageStream``` to retrieve and give access to the kinect color stream
- Beware of copy and paste! Keep only what's useful!
- Consider adding ```Start``` and ```Stop``` methods
- Update the window so that it displays the color stream when you click on the **Color** button.
## 🟡🔖 Use MVVM
The two previous mandatory sections can bring more points if you use MVVM (or better, **MVVM Community Toolkit**).
If you do so, your code will be less cumbersome, simpler to write, read and plug to the window.
If you are not found of MVVM, it will be a nightmare.
Make your choice.
## 🟢 Display Depth Image Stream
It's exactly the same as for the Color Image Stream. Same difficulties, minor changes.
So it is easy, it does not take a lot of time, but it does not bring more knowledges.
This is why it is not mandatory, and bring less points.
## 🟢 Display IR Image Stream
It's exactly the same as for the Color Image Stream. Same difficulties, minor changes.
So it is easy, it does not take a lot of time, but it does not bring more knowledges.
This is why it is not mandatory, and bring less points.
## 🟡🔖 Architecture
- If you have prepared the three streams (but you can do it even with only one), you could decide to enhance your architecture by using inheritance.
```mermaid
classDiagram
direction TB
class KinectStream {
#Sensor : KinectSensor
+Start()
+Stop()
}
KinectStream --> "1" KinectManager : #KinectManager
KinectStream <|-- ColorImageStream
KinectStream <|-- DepthImageStream
KinectStream <|-- InfraredImageStream
```
- Once it is done, you could make the change between one stream and another easier by using a factory:
```mermaid
classDiagram
direction LR
class KinectStreamsFactory {
+ctor(kinect: KinectManager)
-streamFactory : Dictionary~KinectStreams, Func~KinectStream~~
+this[stream: KinectStreams] : KinectStream
}
class KinectStreams {
<<enum>>
None
Color
Depth
IR
}
KinectStreamsFactory --> "1" KinectManager
KinectStreamsFactory ..> KinectStreams
KinectStreamsFactory ..> KinectStream
KinectStream --> KinectManager
KinectStream <|-- ColorImageStream
KinectStream <|-- DepthImageStream
KinectStream <|-- InfraredImageStream
```
The idea here is to provide a collection of method to create and start ```KinectStream```s. These methods are ```Func<KinectStream>``` stored in a ```Dictionary``` that you could access through an indexer.
- If you update now your window with this factory, now your code-behind (or better, your view model) should be very very simple and beautiful (🥹).
## 🚨🟡 Display Body Stream
- 💡 Read the Microsoft Kinect Samples (especially the **Body Basics-XAML** sample) and find how to get the body stream. You will see that their sample is a little bit complex as they have decided to modify the image. I suggest we go in a simpler direction, by providing a canvas with ellipses representing the joints of the body, and lines representing the bones.
- Beware of copy and paste! Keep only what's useful!
- Update the window so that it displays the body stream when you click on the **Body** button.
## 🟡🔖 Update and use the architecture
If you have used the advised architecture, use it to make your new ```BodyStream``` class a subclass of the ```KinectStream``` abstract class. You may need to change some things in the base class as the body stream uses a canvas.
## 🔴 Display Body and Color Streams in the meantime
If you still have some time, find a way to display simultaneously color and body streams!
## 🟡🔖 Update and use the architecture
Obviously, integrate it in your architecture if you have done one.
## 🟢🔖 Make a class library
As all your classes may be used by other applications, make a class library!
# Evaluation criteria
To earned points, remember that you must validate your knowledge with your teacher, during the practical work.
**Signification**
symbol | signification
--- | ---
☢️ | if not respected => 0/20
🎬 | evaluated at the end of all the practical works
🚨 | mandatory
🟢 | difficulty: low
🟡 | difficulty: medium
🔴 | difficulty: high
🔖 | quality
**Criteria**
@ | category | description | coeff
--- | --- | --- | ---
☢️ | | the repositories must be accessible by the teacher | ☢️
☢️ | | a .gitignore file must be use at the creation of the repository or at the first push | ☢️
🎬 | | all *class libraries* and *applications* build | 6
🎬 | | *applications* run without any bug | 6
🚨🟢 | XAML of the Window | | 1
🚨🟢 | Kinect Connection | Use of the Kinect sensor | 2
🚨🟢 | Kinect Connection | Use of the Kinect event | 6
🚨🟢🔖 | Kinect Connection | Encapsulation | 6
🚨🟢 | Kinect Connection | Connect when the Window is loaded | 4
🚨🟢 | Kinect Connection | Disconnect when the Window is unloaded | 2
🚨🟢 | Kinect Connection | Status feedback in the Window | 6
🔴🔖 | Kinect Connection | Using MVVM (commands for window loaded and unloaded) | 6
🟡🔖 | Kinect Connection | Using MVVM (status feedback) | 6
🚨🟢🔖 | Color Stream | Encapsulation - ColorImageStream class with **ONLY** necessary members (beware of mindless copy and paste) | 6
🚨🟢 | Color Stream | retrieving the frame and processing it | 6
🚨🟢 | Color Stream | start and stop acquisition | 6
🚨🟢 | Color Stream | updating the window (start when clicking the button) | 6
🚨🟢 | Color Stream | updating the window (display the color stream) | 6
🟡🔖 | Color Stream | Using MVVM (button click + commands) | 6
🟢🔖 | Color Stream | Using MVVM (data bind the color stream to the image) | 6
🎬🚨🟢 | Color Stream | *test* runs without any bug | 4
🟢🔖 | Depth Stream | Encapsulation - DepthImageStream class with **ONLY** necessary members (beware of mindless copy and paste) | 1
🟢 | Depth Stream | retrieving the frame and processing it | 1
🟢 | Depth Stream | start and stop acquisition | 1
🟢 | Depth Stream | updating the window (start when clicking the button, stop when clicking another button) | 1
🟢 | Depth Stream | updating the window (display the color stream) | 1
🟡🔖 | Depth Stream | Using MVVM (button click + commands) | 1
🟢🔖 | Depth Stream | Using MVVM (data bind the depth stream to the image) | 1
🎬🟢 | Depth Stream | *test* runs without any bug | 1
🟢🔖 | IR Stream | Encapsulation - InfraredImageStream class with **ONLY** necessary members (beware of mindless copy and paste) | 1
🟢 | IR Stream | retrieving the frame and processing it | 1
🟢 | IR Stream | start and stop acquisition | 1
🟢 | IR Stream | updating the window (start when clicking the button, stop when clicking another button) | 1
🟢 | IR Stream | updating the window (display the IR stream) | 1
🟡🔖 | IR Stream | Using MVVM (button click + commands) | 1
🟢🔖 | IR Stream | Using MVVM (data bind the infrared stream to the image) | 1
🎬🟢 | IR Stream | *test* runs without any bug | 1
🟡🔖 | Architecture | Abstract class to factorize | 12
🔴🔖 | Architecture | Abstract class to factorize (using MVVM) | 6
🔴🔖 | Architecture | Factory to allow choosing between one stream or another | 12
🎬🔴🔖 | Architecture | *test* runs without any bug using the architecture and MVVM | 3
🚨🟢🔖 | Body Stream | Encapsulation - BodyStream class with **ONLY** necessary members (beware of mindless copy and paste) | 6
🚨🟢 | Body Stream | retrieving the frame and processing it, retrieving the body of the closest user | 6
🚨🟢 | Body Stream | start and stop acquisition | 6
🚨🟡 | Body Stream | fill a Canvas with Ellipses and Lines corresponding to the skeleton | 6
🚨🟢 | Body Stream | updating the window (start when clicking the button, stop when clicking another button) | 6
🚨🟡 | Body Stream | updating the window (display the body stream) | 6
🔴🔖 | Body Stream | Using MVVM (button click + commands) | 1
🔴🔖 | Body Stream | Using MVVM (data bind the body stream to the image) | 6
🎬🚨🔴 | Body Stream | *test* runs without any bug | 4
🔴🔖 | Architecture | Use the Body Stream with the abstract class and the Factory to allow choosing between one stream or another | 6
🎬🔴🔖 | Architecture | *test* runs without any bug using the architecture and MVVM | 3
🟡🔖 | Body and Color Streams | Encapsulation - BodyAndColorStream class (be smart) | 4
🟡🔖 | Body and Color Streams | updating the window (start when clicking the button, stop when clicking another button) | 4
🔴🔖 | Body and Color Streams | updating the window (display the body stream) | 4
🔴🔖 | Body and Color Streams | Using MVVM (button click + commands) | 1
🔴🔖 | Body and Color Streams | Using MVVM (data bind the body and color streams to the image) | 4
🎬🔴🔖 | Body and Color Streams | *test* runs without any bug | 2
🎬🔴🔖 | Architecture | *test* runs without any bug using the architecture and MVVM | 3
🟢🔖 | Architecture | Create a class library | 6
🎬🟢 | Documentation | ReadMe, comments, wiki... | 4
> Some samples if you wonder...
> - if you do only the 🚨 criteria, you get => 10/20
> - for the ```KinectManager``` (without MVVM) => 2,22 pts
> - for the Color Stream (without MVVM and without considering tests) => 2,56 pts
> - for depth and IR streams (without MVVM and without considering tests) => 0,85 pts
> - for body stream (without MVVM and without considering tests) => 3,08 pts
> - for body & color streams (without MVVM and without considering tests) => 1,03 pt
> - architecture => 3,08 pts
> - if you use MVVM (everywhere when indicated) => 4,7 pts
> - if all your tests pass and if you have done documentation => 2,48 pts
> Note :
> Coefficients may change and are here only indicative
---
[Home](./README.md)
| **Exercise 1 - Kinect Streams**
| [Exercise 2 - Introduction](./exo2_subject.md)
| [Exercise 2 part 1 - Postures](./exo2_1_subject.md)
| [Exercise 2 part 2 - Gestures](./exo2_2_subject.md)
| [Exercise 2 part 3 - Mapping](./exo2_3_subject.md)
| [Exercise 3 - Free App](./exo3_subject.md)
---
Copyright © 2023-2024 Marc Chevaldonné
---
While preparing these practical works, I was listening to...
<table>
<tr>
<td>
<img src="./images/trident.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Trident</b></p>
<p><i>McCoy Tyner</i> (1975)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/sweet_return.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Sweet Return</b></p>
<p><i>Freddie Hubbard</i> (1983)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/renaissance_man.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Renaissance Man</b></p>
<p><i>Jamaaladeen Tacuma</i> (1984)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/back_in_the_usa.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Back In The USA</b></p>
<p><i>MC5</i> (1970)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/blues_and_roots.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Blues & Roots</b></p>
<p><i>Charlie Mingus</i> (1960)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/the_magic_of_ju-ju.jpg" width="120"/>
</td>
<td>
<div>
<p><b>The Magic of Ju-Ju</b></p>
<p><i>Archie Shepp</i> (1967)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/loaded.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Loaded</b></p>
<p><i>The Velvet Underground</i> (1970)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/symphonie_fantastique.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Symphonie Fantastique / Tristia</b></p>
<p><i>Hector Berlioz - The Cleveland Orchestra & Chrosu - Pierre Boulez</i> (1830 - 1997)</p>
</div>
</td>
</tr>
</table>

@ -1,257 +0,0 @@
[Home](./README.md)
| [Exercise 1 - Kinect Streams](./exo1_subject.md)
| [Exercise 2 - Introduction](./exo2_subject.md)
| **Exercise 2 part 1 - Postures**
| [Exercise 2 part 2 - Gestures](./exo2_2_subject.md)
| [Exercise 2 part 3 - Mapping](./exo2_3_subject.md)
| [Exercise 3 - Free App](./exo3_subject.md)
# Exercise 2: Gesture Recognition part1 (Postures)
# Prerequisites
- the ```KinectManager``` from exercise 1
- inheritance in C# and abstract classes and methods
- polymorphism
- static methods and classes
- event in C# and Event Standard Pattern
# Resources
- 🔜 event and Event Standard Pattern
- 🔜 inheritance in C#
# Requested Work
As indicating in the introduction, the goal is to prepare the base classes of the gesture recognition system, and to develop and test postures.
```mermaid
classDiagram
class BaseGesture {
+TestGesture(Body body)*
+GestureRecognized : EventHandler~GestureRecognizedEventArgs~
#OnGestureRecognized()
+GestureName : string
}
class Posture {
+TestGesture(Body body)*
#TestPosture(Body body)* bool
}
class GestureManager {
<<static>>
+EventHandler~GestureRecognizedEventArgs~ GestureRecognized$
+AddGestures(IGestureFactory: factory)$
+AddGestures(params BaseGesture[])$
+RemoveGesture(BaseGesture)$
+StartAcquiringFrames(KinectManager)$
+StopAcquiringFrame()$
}
BaseGesture <|-- Posture
Posture <|-- PostureRightHandUp
Posture <|-- PostureTwoHandsDragon
BaseGesture "*" <-- GestureManager : +KnownGestures
GestureManager --> "1" KinectManager : KinectManager
```
# Steps to reproduce
This part is given as a set of advises to realize your application.
I use some symbols in it:
symbol | signification
--- | ---
💡 | be smart: this can obviously be done before practical works and without the kinect sensor!
🎬 | evaluated at the end of all the practical works
🚨 | mandatory if you want at least 10/20
🟢 | difficulty: low
🟡 | difficulty: medium
🔴 | difficulty: high
🔖 | quality (it's always better when it's beautiful 🥹)
> Note about difficulty:
> It's obviously completely subjective...
## 🚨🟢🔖 KinectUtils class library
- Create a .NET Framework class library
- Add your KinectManager
- Create all the base classes (```BaseGesture``` and ```Posture```)
## 🚨🟡🔖 MyGesturesBank class library
- Create a .NET Framework class library
- Add 2 concrete postures to it
> Suggestions:
> Hand up, Hand on the head, Join hands, hands on hips...
- Test your postures in a Console App (.NET Framework)
## 🚨🟡🔖 GestureManager
- add the ```GestureManager``` class to your KinectUtils class library
- manage the collection of gestures
- manage the acquisition of frames
- manage the ```GestureRecognized``` event so that the user subscribe only once to an event (this one) in order to be subscribed to all events of ```GestureManager``` gestures
- (not mandatory) find a way (or make your teacher talk) to allow automatic subscriptions to all gestures event, without event bouncing. In other words, ```GestureManager``` should not be subscribed to all gestures event, and re-fire an event if one occurs.
- (not mandatory) find a way (or...) to allow late subscriptions to gestures event. In other words, if the user has already subscribed to ```GestureRecognized``` of ```GestureManager```, if she adds a new gesture to the collection, she should be also subscribed without having to reset the subscription.
- Test your ```GestureManager``` in a Console App
## 🟡🔖 Posture specific events
As your posture is tested at every frame, it should send the event everytime it is recognized, so a dozen of times if you keep the pose.
Modify your ```Posture``` class so that it sends to more events:
- PostureRecognized if it is recognized although it wasn't at the previous frame
- PostureUnrecognized if it is not recognized although it was at the previous frame
- Test it in a Console App
# Evaluation criteria
To earned points, remember that you must validate your knowledge with your teacher, during the practical work.
**Signification**
symbol | signification
--- | ---
☢️ | if not respected => 0/20
🎬 | evaluated at the end of all the practical works
🚨 | mandatory
🟢 | difficulty: low
🟡 | difficulty: medium
🔴 | difficulty: high
🔖 | quality
**Criteria**
@ | category | description | coeff
--- | --- | --- | ---
☢️ | | the repositories must be accessible by the teacher | ☢️
☢️ | | a .gitignore file must be use at the creation of the repository or at the first push | ☢️
🎬 | | all *class libraries* and *applications* build | 4
🎬 | | *applications* run without any bug | 4
🚨🟢🔖 | KinectUtils class library | with KinectManager | 1
🚨🟢🔖 | KinectUtils class library | BaseGesture with event | 4
🚨🟢🔖 | KinectUtils class library | Posture | 1
🚨🟢 | KinectUtils class library | Posture.TestPosture | 1
🚨🟡🔖 | MyGesturesBank class library | 1st posture | 6
🟡 | MyGesturesBank class library | 2nd posture | 2
🚨🟡 | Test | Console test | 4
🚨🟢🔖 | GestureManager | collection of gestures | 1
🚨🟡🔖 | GestureManager | acquiring frames | 6
🚨🟡 | GestureManager | event (dirty but working) | 6
🔴🔖 | GestureManager | event automatic subscriptions to collection of gestures | 6
🔴🔖 | GestureManager | event late subscriptions | 6
🚨🟡 | Test | Console test | 4
🟡🔖 | Posture specific events | PostureRecognized and PostureUnrecognized | 6
🟡🔖 | Posture specific events | Update GestureManager | 6
🟡 | Test | Console test | 4
🎬🟢 | Documentation | ReadMe, comments, wiki... | 4
> Some samples if you wonder...
> - if you do only the 🚨 criteria and your application is building and running, you get => 11,05/20
> - for the Bases of *KinectUtils* class library (```BaseGesture``` and ```Posture```) => 1,84 pt
> - for two concrete postures => 2,1 pts
> - for ```GestureManager``` => 6,6 pts
> - for the management of the two specific events on ```Posture``` and ```GestureManager``` => 3,2 pts
> - for all your tests (the three ones) => 3,2 pts
> - quality (building, running and documentation) => 3,2 pts
> Note :
> Coefficients may change and are here only indicative
---
[Home](./README.md)
| [Exercise 1 - Kinect Streams](./exo1_subject.md)
| [Exercise 2 - Introduction](./exo2_subject.md)
| **Exercise 2 part 1 - Postures**
| [Exercise 2 part 2 - Gestures](./exo2_2_subject.md)
| [Exercise 2 part 3 - Mapping](./exo2_3_subject.md)
| [Exercise 3 - Free App](./exo3_subject.md)
---
Copyright © 2023-2024 Marc Chevaldonné
---
While preparing these practical works, I was listening to...
<table>
<tr>
<td>
<img src="./images/after_the_gold_rush.jpg" width="120"/>
</td>
<td>
<div>
<p><b>After The Gold Rush</b></p>
<p><i>Neil Young</i> (1970)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/monk_s_music.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Monk's Music</b></p>
<p><i>Thelonious Monk Septet</i> (1957)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/special_identity.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Special Identity</b></p>
<p><i>Joanne Brackeen</i> (1982)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/where_have_i_known_you_before.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Where Have I Known You Before</b></p>
<p><i>Return To Forever</i> (1974)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/bozilo.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Live</b></p>
<p><i>Bozilo</i> (2009)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/look_out.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Look Out!</b></p>
<p><i>Stanley Turrentine</i> (1960)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/moanin.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Moanin'</b></p>
<p><i>Art Blakey and The Jazz Messengers</i> (1958)</p>
</div>
</td>
</tr>
</table>

@ -1,229 +0,0 @@
[Home](./README.md)
| [Exercise 1 - Kinect Streams](./exo1_subject.md)
| [Exercise 2 - Introduction](./exo2_subject.md)
| [Exercise 2 part 1 - Postures](./exo2_1_subject.md)
| **Exercise 2 part 2 - Gestures**
| [Exercise 2 part 3 - Mapping](./exo2_3_subject.md)
| [Exercise 3 - Free App](./exo3_subject.md)
# Exercise 2: Gesture Recognition part2 (Gestures)
# Prerequisites
- classes from part 1
- inheritance in C# and abstract classes and methods
- polymorphism
- static methods and classes
- event in C# and Event Standard Pattern
- interfaces in C#
# Resources
- 🔜 event and Event Standard Pattern
- 🔜 inheritance in C#
- 🔜 interfaces
# Requested Work
As indicating in the introduction, the goal is to develop and test dynamic gestures.
```mermaid
classDiagram
class BaseGesture {
<<abstract>>
+TestGesture(Body body)*
+GestureRecognized : EventHandler~GestureRecognizedEventArgs~
#OnGestureRecognized(Body)
+GestureName : string
}
class Gesture {
+IsTesting : bool
#MinNbOfFrames : int
#MaxNbOfFrames : int
-mCurrentFrameCount : int
#TestInitialConditions(Body body)* bool
#TestPosture(Body body)* bool
#TestRunningGesture(Body body)* bool
#TestEndConditions(Body body)* bool
+TestGesture(Body body)*
}
BaseGesture <|-- Gesture
Gesture <|-- SwipeRightHand
Gesture <|-- ClapHands
```
```Gesture``` represents a *dynamic* gesture and thus, should override the ```TestGesture``` method.
The algorithm can be separated in four important pieces:
- we start the gesture recognition if **initial conditions** are met (```TestInitialConditions```)
- at every frame, we check if the static current posture corresponds to a pose of this gesture (```TestPosture```) (for instance, for a swipe, my hand shouldn't be higher than my head)
- at every frame, we check if the pose, in comparison with the previous ones, is valid or not (```TestRunningGesture```). In other terms, we test the *dynamic* of the gesture. For instance, in a swipe, my hand should not go on the left, then on the right, then on the left, then on the right...
- at every frame, we check if the ending conditions are met (```TestEndingConditions```).
Moreover, we count the number of frames since the initial conditions were met and we check that the number of counted frames is in [```MinNbOfFrames```;```MaxNbOfFrames```] when ending conditions are met, in order to filter too slow or too fast gestures.
Next, you will develop 2 or 3 gestures and add them to your *MyGesturesBank* library.
At last, you will take care of the factory to ease the use of many gestures.
```mermaid
classDiagram
class IGestureFactory {
+CreateGestures() IEnumerable~BaseGesture~
}
<<interface>> IGestureFactory
class GestureManager {
<<static>>
+EventHandler~GestureRecognizedEventArgs~ GestureRecognized$
+AddGestures(IGestureFactory: factory)$
+AddGestures(params BaseGesture[])$
+RemoveGesture(BaseGesture)$
+StartAcquiringFrames(KinectManager)$
+StopAcquiringFrame()$
}
BaseGesture "*" <-- GestureManager : +KnownGestures
KinectManager "1" <-- GestureManager : KinectManager
IGestureFactory "1" <.. GestureManager : Factory
IGestureFactory <|.. AllGesturesFactory
```
The ```IGestureFactory``` allows creating all at once, by calling ```CreateGestures()```, a collection of gestures.
Users can thus implement this interface to create their own collection of gestures.
At last, you will update ```GestureManager``` so that it can take a ```IGestureFactory``` as parameter in ```AddGestures``` to fill the collection of gestures.
# Steps to reproduce
This part is given as a set of advises to realize your application.
I use some symbols in it:
symbol | signification
--- | ---
💡 | be smart: this can obviously be done before practical works and without the kinect sensor!
🎬 | evaluated at the end of all the practical works
🚨 | mandatory if you want at least 10/20
🟢 | difficulty: low
🟡 | difficulty: medium
🔴 | difficulty: high
🔖 | quality (it's always better when it's beautiful 🥹)
> Note about difficulty:
> It's obviously completely subjective...
## 🚨🟡 Gesture & TestGesture
- 💡 Prepare an algorithm based on this subject. It's not that difficult, but it's not that easy neither...
- Code the abstract class ```Gesture``` and above all, the ```TestGesture``` method
## 🚨🟡 Gesture - 1st subclass
- choose a gesture and code it
- test it in a console app
> What gesture?
> If you do not know what to code, you can begin with simple gestures: swipes, clap hands, hands up.
> Avoid more complex gesture made of multiple steps (waves for instance)
## 🔴 Gesture: use body referential instead of kinect referential
If you have tested your gesture in a Kinect referential (_ie_ using the X, Y, Z axis of the Kinect), you may have different results if the body is not facing the Kinect. You could use another referential centered on the user body (for instance, use the axis made by the hips, the spin and the neck, etc.).
- update the gesture (or code another) using a body centered referential
- test it
## 🚨🟢🔖 IGestureFactory
- add the ```IGestureFactory``` to the correct class library
- implement this interace in the correct class library
- update your test
## 🟡 Gesture - 2nd subclass
- add a second gesture
- test it
# Evaluation criteria
To earned points, remember that you must validate your knowledge with your teacher, during the practical work.
**Signification**
symbol | signification
--- | ---
☢️ | if not respected => 0/20
🎬 | evaluated at the end of all the practical works
🚨 | mandatory
🟢 | difficulty: low
🟡 | difficulty: medium
🔴 | difficulty: high
🔖 | quality
**Criteria**
@ | category | description | coeff
--- | --- | --- | ---
☢️ | | the repositories must be accessible by the teacher | ☢️
☢️ | | a .gitignore file must be use at the creation of the repository or at the first push | ☢️
🎬 | | all *class libraries* and *applications* build | 2
🎬 | | *applications* run without any bug | 2
🚨🟡 | Gesture | TestGesture | 3
🚨🟡 | Gesture | 1st subclass | 2
🔴 | Gesture | use body referential instead of kinect referential | 2
🚨🟢 | Test | Console Test | 2
🚨🟢🔖 | IGestureFactory | interface and implementation | 1
🚨🟢 | Test | Console Test | 1
🟡 | Gesture | 2nd subclass | 2
🟢 | Test | Console Test | 1
🎬🟢 | Documentation | ReadMe, comments, wiki... | 2
> Some samples if you wonder...
> - if you do only the 🚨 criteria and your application is building and running, you get => 13/20
> - a coeff 3 criterium => 3 pts
> - a coeff 2 criterium => 2 pts
> - a coeff 1 criterium => 1 pt
(Note: this is just because the sum of coeffs is 20...)
> Note :
> Coefficients may change and are here only indicative
---
[Home](./README.md)
| [Exercise 1 - Kinect Streams](./exo1_subject.md)
| [Exercise 2 - Introduction](./exo2_subject.md)
| [Exercise 2 part 1 - Postures](./exo2_1_subject.md)
| **Exercise 2 part 2 - Gestures**
| [Exercise 2 part 3 - Mapping](./exo2_3_subject.md)
| [Exercise 3 - Free App](./exo3_subject.md)
---
Copyright © 2023-2024 Marc Chevaldonné
---
While preparing these practical works, I was listening to...
<table>
<tr>
<td>
<img src="./images/as_is.jpg" width="120"/>
</td>
<td>
<div>
<p><b>As Is</b></p>
<p><i>Bojan Z</i> (2023)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/darkness_on_the_edge_of_town.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Darkness On The Edge Of Town</b></p>
<p><i>Bruce Springsteen & the E Street Band</i> (1978)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/modernistic.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Modernistic</b></p>
<p><i>Jason Moran</i> (2002)</p>
</div>
</td>
</tr>
</table>

@ -1,243 +0,0 @@
[Home](./README.md)
| [Exercise 1 - Kinect Streams](./exo1_subject.md)
| [Exercise 2 - Introduction](./exo2_subject.md)
| [Exercise 2 part 1 - Postures](./exo2_1_subject.md)
| [Exercise 2 part 2 - Gestures](./exo2_2_subject.md)
| **Exercise 2 part 3 - Mapping**
| [Exercise 3 - Free App](./exo3_subject.md)
# Exercise 3: Gesture Recognition part3 (Mapping)
# Prerequisites
- classes from part 1 & 2
- inheritance in C# and abstract classes and methods
- polymorphism
- static methods and classes
- event in C# and Event Standard Pattern
- generic classes
# Resources
- 🔜 event and Event Standard Pattern
- 🔜 inheritance in C#
- 🔜 interfaces
- 🔜 generics
# Requested Work
This third and last part aims at mapping body movements to _something else_ movement (an ellipse, a cat, a nounours, a dinosaur...).
In order to do that, benefit from generic classes, as we do not know in advance what to map with a body.
The ```BaseMapping<T>``` generic class is very simple:
- its ```Mapping``` abstract method has the responsability to return a ```T``` value or instance at every frame, based on a ```Body```
- the ```TestMapping``` will check if ```Mapping``` can be called or not.
- ```SubscribeToStartGesture```, ```SubscribeToEndGesture``` and ```SubscribeToToggleGesture``` methods toggle a boolean indicating if the mapping is runnning or not when it receives event from gestures. For instance, every time the posture _LeftHandUp_ is received, it starts the mapping, or every time the gesture _SwipeRightHand_ is received, it stops the mapping... The ```SubscribeToToggleGesture``` method is used in order to use the same gesture to start and stop the mapping. So the user will have to either use start gesture and stop gesture, or use toggle gesture. But, in fact, he could also use multiple gestures!
- ```GestureManager``` will fire an event ```BodyFrameArrived``` every time it detects a body in a frame. This event should be catch by instances of ```BaseMapping```. In order to do that, mappings will subscribe (unsubscribe) to the ```BodyFrameArrived``` event when the ```GestureManager.AddMapping``` method is called (```RemoveMapping``` to unsubscribe).
- every time a mapping receives the ```BodyFrameArrived``` event, it calls ```TestMapping``` and if it returns ```true```, it fires itself its event ```OnMapping```
- ```OnMapping``` is the event to which you can subscribe in your app to do a mapping
```mermaid
classDiagram
direction TB
class BaseGesture {
+TestGesture(Body body)*
+GestureRecognized : EventHandler~GestureRecognizedEventArgs~
#OnGestureRecognized(Body)
+GestureName : string
}
class BaseMapping~T~ {
-running : bool
+EventHandler<OnMappingEventArgs> : OnMapping
+SubscribeToStartGesture(gesture: BaseGesture)
+SubscribeToEndGesture(gesture: BaseGesture)
+SubscribeToToggleGesture(gesture: BaseGesture)
#Mapping(Body body)* T
~TestMapping(Body body, out T ouput) bool
~#OnBodyFrameArrived(object, BodyFrameArrivedEventArgs)
}
class MapLeftHandToMouse {
#Mapping(Body body)* Point
}
BaseMapping~T~ <|-- MapLeftHandToMouse : T <- Point
BaseGesture <.. BaseMapping~T~
class GestureManager {
<<static>>
+EventHandler~GestureRecognizedEventArgs~ : GestureRecognized$
+EventHandler~BodyFrameArrivedEventArgs~ : BodyFrameArrived$
+AddGestures(IGestureFactory: factory)$
+AddGestures(params BaseGesture[])$
+RemoveGesture(BaseGesture)$
+AddMapping~T~(BaseMapping~T~: mapping)$
+RemoveMapping~T~(BaseMapping~T~: mapping)$
+StartAcquiringFrames(KinectManager)$
+StopAcquiringFrame()$
}
BaseGesture "*" <-- GestureManager : +KnownGestures
BaseMapping <.. GestureManager
```
# Steps to reproduce
This part is given as a set of advises to realize your application.
I use some symbols in it:
symbol | signification
--- | ---
💡 | be smart: this can obviously be done before practical works and without the kinect sensor!
🎬 | evaluated at the end of all the practical works
🚨 | mandatory if you want at least 10/20
🟢 | difficulty: low
🟡 | difficulty: medium
🔴 | difficulty: high
🔖 | quality (it's always better when it's beautiful 🥹)
> Note about difficulty:
> It's obviously completely subjective...
## 🚨🟡 Mapping and TestGesture
- create the ```BaseMapping<T>``` generic class
- manage the ```running``` boolean member so that it changes when the events ```GestureRecognized``` are received
- add the methods ```Mapping``` (abstract) and ```TestMapping``` calling the former one and return a ```bool``` and the result from ```Mapping```.
- add constructors with either the start and end gestures, or the toggle gesture
## 🚨🟡 GestureManager - BodyFrameArrived
- add a new event ```BodyFrameArrived``` to ```GestureManager``` whose arguments give access to bodies in the frame and also the closest one to the kinect sensor
- change ```GestureManager``` so that it fires this event when it acquires and processes body frames from the kinect sensor
## 🟢 IGestureFactory & access to gestures
As you may need access to the gestures of a factory, and as we do not have given any public access, add an indexer to get a gesture by its name (if you do not know nor want to use an indexer, use a method...)
## 🔴 ConcreteMapping
- Create a concrete mapping (for instance to the 2D position of an hand).
- Test it.
## 🔴🔖 OnMapping
- add and manage the ```OnMapping``` event to ```BaseMapping```. Its arguments should give access to the mapped value
- fire this event when the mapping is running
- update and test your program
# Evaluation criteria
To earned points, remember that you must validate your knowledge with your teacher, during the practical work.
**Signification**
symbol | signification
--- | ---
☢️ | if not respected => 0/20
🎬 | evaluated at the end of all the practical works
🚨 | mandatory
🟢 | difficulty: low
🟡 | difficulty: medium
🔴 | difficulty: high
🔖 | quality
**Criteria**
@ | category | description | coeff
--- | --- | --- | ---
☢️ | | the repositories must be accessible by the teacher | ☢️
☢️ | | a .gitignore file must be use at the creation of the repository or at the first push | ☢️
🎬 | | all *class libraries* and *applications* build | 1
🎬 | | *applications* run without any bug | 1
🚨🟡 | Mapping | TestGesture | 1
🚨🟡 | GestureManager | BodyFrameArrived | 1
🟢 | IGestureFactory | indexer | 1
🔴 | ConcreteMapping | BodyFrameArrived | 1
🚨🟢 | Test | Console Test | 1
🔴🔖 | OnMapping | BodyFrameArrived + OnMapping | 1
🟢 | Test | Console Test | 1
🎬🟢 | Documentation | ReadMe, comments, wiki... | 1
> Some samples if you wonder...
> - if you do only the 🚨 criteria and your application is building and running, you get => 10/20
> Note :
> Coefficients may change and are here only indicative
---
[Home](./README.md)
| [Exercise 1 - Kinect Streams](./exo1_subject.md)
| [Exercise 2 - Introduction](./exo2_subject.md)
| [Exercise 2 part 1 - Postures](./exo2_1_subject.md)
| [Exercise 2 part 2 - Gestures](./exo2_2_subject.md)
| **Exercise 2 part 3 - Mapping**
| [Exercise 3 - Free App](./exo3_subject.md)
---
Copyright © 2023-2024 Marc Chevaldonné
---
While preparing these practical works, I was listening to...
<table>
<tr>
<td>
<img src="./images/hypersuites.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Hypersuites</b></p>
<p><i>Marina Baranova</i> (2016)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/dracula.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Dracula</b></p>
<p><i>Pierre Henry</i> (2003)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/fats_1935_1936.jpg" width="120"/>
</td>
<td>
<div>
<p><b>1935-1936</b></p>
<p><i>Fats Waller</i> (1935-1936)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/just_jazz.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Just Jazz</b></p>
<p><i>Aldo Romano</i> (2008)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/carolina_shout.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Carolina Shout</b></p>
<p><i>James P. Johnson</i> (1920's - 1930's)</p>
</div>
</td>
</tr>
</table>

@ -1,305 +0,0 @@
[Home](./README.md)
| [Exercise 1 - Kinect Streams](./exo1_subject.md)
| **Exercise 2 - Introduction**
| [Exercise 2 part 1 - Postures](./exo2_1_subject.md)
| [Exercise 2 part 2 - Gestures](./exo2_2_subject.md)
| [Exercise 2 part 3 - Mapping](./exo2_3_subject.md)
| [Exercise 3 - Free App](./exo3_subject.md)
# Exercise 2: Gesture recognition
*Advised duration*: 4 hours
*Maximum advised duration*: 6 hours
This exercise can be splitted in three parts but they are all bound and you should do them in the right order.
The main objective is to develop a simple gesture recognition system. It is not based on AI or *Machine Learning*. It is rather made of **Q&D**¹ solutions.
# Just a glimpse on the work to be done
Our **gesture recognition** will be able to:
- recognize **postures** _ie_ static body poses (your body does not move, it is tested on a single frame),
- recognize **gestures** _ie_ dynamic body movements (your body does move, it is tested during several frames),
- do **mapping** of body movement on whatever computer thing (a cursor, an ellipse, a dinosaur...).
You will have to develop the following assemblies (except *Exercise3.WpfApp*, and the Nuget Packages *Microsoft.Kinect* and *CommunityToolkit.Mvvm*):
```mermaid
flowchart LR
subgraph Exercise2
MyGesturesBank
KinectUtils
Tests
end
MyGesturesBank -.-> KinectUtils
KinectUtils -.-> Microsoft.Kinect
KinectUtils -.-> CommunityToolkit.Mvvm
Tests -.-> MyGesturesBank
Tests -.-> KinectUtils
style Microsoft.Kinect fill:#eee,color:#111,stroke:#999
style CommunityToolkit.Mvvm fill:#eee,color:#111,stroke:#999
subgraph Exercise3
WpfApp
end
WpfApp -.-> MyGesturesBank
WpfApp -.-> KinectUtils
```
**KinectUtils** will contain all the base types to do gesture recognition and mapping. It will be updated in the three parts of this exercise.
**MyGesturesBank** will contain specific implementation of postures and gestures that could then be used in different applications.
**Tests** are only one or several *Console app* tests to verify that our system is working well.
Here is just a glimpse of the classes you will develop. More details will be given later or by your teacher on demand:
- ```BaseGesture``` will represent any gesture, _ie_ any ```Posture``` or ```Gesture``` (dynamic). To be tested, you will have to call ```TestGesture``` that will fire the event ```GestureRecognized``` if it is recognized.
- ```Posture``` is a specialization of ```BaseGesture``` for postures.
- ```Gesture``` is a specialization of ```BaseGesture``` for dynamic gestures.
- ```GestureManager``` is a static mediator for all gestures. It will ease the use of the gesture recognition system as the user will have to subscribe only once to the ```GestureManager.GestureRecognized``` event and not to every gesture event.
- ```BaseMapping<T>``` is a generic class that allow mapping a body on a ```T```. It will use ```BaseGesture``` to start or stop the mapping.
- To avoid plumbery of creating every gesture for every app or tests, we will finally add a ```IGestureFactory``` storing gestures to be used in an app.
```mermaid
classDiagram
class BaseGesture {
+TestGesture(Body body)*
+GestureRecognized : EventHandler~GestureRecognizedEventArgs~
#OnGestureRecognized()
+GestureName : string
}
class Gesture {
+IsRecognitionRunning : bool
#MinNbOfFrames : int
#MaxNbOfFrames : int
-currentFrameCount : int
#TestInitialConditions(Body body)* bool
#TestPosture(Body body)* bool
#TestRunningGesture(Body body)* bool
#TestEndConditions(Body body)* bool
+TestGesture(Body body)*
}
class Posture {
+TestGesture(Body body)*
#TestPosture(Body body)* bool
}
class IGestureFactory {
+CreateGestures() IEnumerable~BaseGesture~
}
<<interface>> IGestureFactory
class GestureManager {
<<static>>
+EventHandler~GestureRecognizedEventArgs~ GestureRecognized$
+AddGestures(IGestureFactory: factory)$
+AddGestures(params BaseGesture[])$
+RemoveGesture(BaseGesture)$
+StartAcquiringFrames(KinectManager)$
+StopAcquiringFrame()$
}
BaseGesture <|-- Gesture
BaseGesture <|-- Posture
Posture <|-- PostureRightHandUp
Posture <|-- PostureTwoHandsDragon
Gesture <|-- SwipeRightHand
Gesture <|-- ClapHands
IGestureFactory "1" <-- GestureManager : Factory
class BaseMapping~T~ {
+SubscribeToStartGesture(gesture: BaseGesture)
+SubscribeToEndGesture(gesture: BaseGesture)
+SubscribeToToggleGesture(gesture: BaseGesture)
#Mapping(Body body)* T
+TestMapping(Body body, out T ouput) bool
}
BaseMapping~T~ <|-- MapLeftHandToMouse : T <- Point
class MapLeftHandToMouse {
#Mapping(Body body)* Point
}
BaseGesture <.. BaseMapping~T~
BaseGesture "*" <-- GestureManager : +KnownGestures
IGestureFactory <|.. AllGesturesFactory
GestureManager --> "1" KinectManager : KinectManager
```
## Deeper informations
Here are more details about what we are going to do. **Do not hesitate to come back to this section later**.
- ```BaseGesture```: it represents the base class for every gesture, _ie_ a **posture** (static position of a body) or a **dynamic gesture** (a movement). It owns a name and sends and event ```GestureRecognized``` when the gesture is ... recognized. To test the gesture, the type owns an abstract method ```TestGesture``` that will be overriden in the different subclasses.
```mermaid
classDiagram
class BaseGesture {
<<abstract>>
+TestGesture(Body body)*
+GestureRecognized : EventHandler~GestureRecognizedEventArgs~
#OnGestureRecognized(Body)
+GestureName : string
}
```
- ```Posture```: this abstract subclass of ```BaseGesture``` is the base class for every **posture** (_ie_ every static position of a body). It overrides the ```TestGesture``` method that will send the event ```GestureRecognized``` event if the ```TestPosture``` abstract method returns ```true```. It is the base class for every other **posture** class of your coming application (_ie_ ```PostureRightHandUp```, ```PostureTwoHandsDragon```).
```mermaid
classDiagram
class BaseGesture {
<<abstract>>
+TestGesture(Body body)*
+GestureRecognized : EventHandler~GestureRecognizedEventArgs~
#OnGestureRecognized(Body)
+GestureName : string
}
class Posture {
<<abstract>>
+TestGesture(Body body)
#TestPosture(Body body)* bool
}
BaseGesture <|-- Posture
Posture <|-- RightHandUp
Posture <|-- TwoHandsDragon
```
- ```Gesture```: it represents a **dynamic gesture**. It is also a subclass of ```BaseGesture``` and overrides the ```TestGesture``` method to fire the event ```GestureRecognized``` event, but its algorithm is a little bit more complicated, and based on four abstract methods that will be explained later. But here is a summary:
- ```TestInitialConditions```: tests the body to see if the posture corresponds to a possible initial condition of this gesture
- ```TestPose```: tests the body to see if its current pose is valid for this gesture (like a picture or a pause in a movie)
- ```TestDynamicPoses```: tests the current pose but in comparison with the previous ones, to see if the dynamic of the movement corresponds to the gesture
- ```TestEndingConditions```: tests the current pose to see if it corresponds to the end of the gesture.
- Moreover, it also checks that the gesture is done in more than a minimum number of frames (otherwise it is just noise) or in less than a maximum number of frames (otherwise, it is too slow to be intentional).
> Note:
> This algorithm is far from being efficient, but it is simple...
Subclasses of ```Gesture``` will only have to override these methods.
```mermaid
classDiagram
class BaseGesture {
<<abstract>>
+TestGesture(Body body)*
+GestureRecognized : EventHandler~GestureRecognizedEventArgs~
#OnGestureRecognized(Body)
+GestureName : string
}
class Posture {
<<abstract>>
+TestGesture(Body body)
#TestPosture(Body body)* bool
}
class Gesture {
+IsRecognitionRunning : bool
#MinNbOfFrames : int
#MaxNbOfFrames : int
-mCurrentFrameCount : int
#TestInitialConditions(Body body)* bool
#TestPosture(Body body)* bool
#TestRunningGesture(Body body)* bool
#TestEndConditions(Body body)* bool
+TestGesture(Body body)*
}
BaseGesture <|-- Posture
BaseGesture <|-- Gesture
Gesture <|-- SwipeRightHand
Gesture <|-- ClapHands
```
- To simplify the creation of different gestures and postures, we will use **gesture factories**. Every gesture factory implements the interface ```IGestureFactory``` whose contract asks for just one method ```CreateGestures``` returning the collection of ```BaseGesture``` to be tested in your app. This way, you won't have to test a hundred colliding gestures if you need only a dozen.
```mermaid
classDiagram
direction TB
class BaseGesture {
<<abstract>>
+TestGesture(Body body)*
+GestureRecognized : EventHandler~GestureRecognizedEventArgs~
#OnGestureRecognized(Body)
+GestureName : string
}
class IGestureFactory {
<<interface>>
+CreateGestures() IEnumerable~BaseGesture~
}
BaseGesture <.. IGestureFactory
IGestureFactory <|.. AllGesturesFactory
```
- At last, to avoid the user to subscribe to multiple ```GestureRecognized``` events (one per gesture), the static class ```GestureManager``` plays the role of a mediator or a façade for our library, simplifying the subscription and use of the gestures. It also uses the previous factory.
One particular precious thing, is that it sends a static event ```GestureRecognized``` which you can subscribe to. This event is only one to which the user should subscribe. Its subscription will internally subscribes to all ```knownGestures```. Easier and beautiful.
```mermaid
classDiagram
class BaseGesture {
<<abstract>>
+TestGesture(Body body)*
+GestureRecognized : EventHandler~GestureRecognizedEventArgs~
#OnGestureRecognized(Body)
+GestureName : string
}
class IGestureFactory {
<<interface>>
+CreateGestures() IEnumerable~BaseGesture~
}
class GestureManager {
<<static>>
+EventHandler~GestureRecognizedEventArgs~ GestureRecognized$
+StartAcquiringFrames()$
+StopAcquiringFrames()$
}
BaseGesture "*" <-- GestureManager : -mKnownGestures
IGestureFactory "1" <-- GestureManager : Factory
```
# Plan
## Part1: Gesture Recognition (Postures)
The first part will focus on the basics of our gesture recognition system and postures.
In other words, you will have to code:
- ```BaseGesture```
- ```Posture```
- ```GestureManager```
- and some concrete postures to be tested in a test
## Part2: Gesture Recognition (Dynamic Gestures)
In the second part, you will code:
- ```Gesture```
- some concrete gestures to be tested in a console app
- *MyGesturesBank*
- ```IGestureFactory```
- a concrete factory with the previous gestures and postures
## Part3: Gesture Recognition (Mapping)
In this last part, you will have to code:
- ```BaseMapping<T>```
- a concrete mapping
- and a final test.
---
¹ *Q&D stands for Quick & Dirty in tribute to Seattle Computer Products and QDOS*
---
[Home](./README.md)
| [Exercise 1 - Kinect Streams](./exo1_subject.md)
| **Exercise 2 - Introduction**
| [Exercise 2 part 1 - Postures](./exo2_1_subject.md)
| [Exercise 2 part 2 - Gestures](./exo2_2_subject.md)
| [Exercise 2 part 3 - Mapping](./exo2_3_subject.md)
| [Exercise 3 - Free App](./exo3_subject.md)
---
Copyright © 2023-2024 Marc Chevaldonné
---
While preparing this practical works, I was listening to...
<table>
<tr>
<td>
<img src="./images/in_the_court_of_the_crimson_king.jpg" width="120"/>
</td>
<td>
<div>
<p><b>In The Court Of The Crimson King</b></p>
<p><i>King Crimson</i> (1969)</p>
</div>
</td>
</tr>
</table>

@ -1,91 +0,0 @@
[Home](./README.md)
| [Exercise 1 - Kinect Streams](./exo1_subject.md)
| [Exercise 2 - Introduction](./exo2_subject.md)
| [Exercise 2 part 1 - Postures](./exo2_1_subject.md)
| [Exercise 2 part 2 - Gestures](./exo2_2_subject.md)
| [Exercise 2 part 3 - Mapping](./exo2_3_subject.md)
| **Exercise 3 - Free App**
# Exercise 3: Gesture Recognition part3 (Mapping)
# Prerequisites
- exercises 1 & 2
- Dispatcher
- Timer
# Resources
- 🔜 Dispatcher
- 🔜 Timer
# Requested Work
A WPF application with body interaction through the use of the Kinect Sensor.
The application must:
- be interactive
- use the results of the two first exercises
- if possible, be original
[🎥 Here are some samples](https://opencast.dsi.uca.fr/paella/ui/watch.html?id=020468ca-165e-493f-8938-32043c4632df) of what students were able to do the last years.
# Evaluation criteria
To earned points, remember that you must validate your knowledge with your teacher, during the practical work.
**Criteria**
@ | description | coeff
--- | --- | ---
☢️ | the repositories must be accessible by the teacher | ☢️
☢️ | a .gitignore file must be use at the creation of the repository or at the first push | ☢️
🎬 | all *class libraries* and *applications* build | ~1
🎬 | *applications* run without any bug | ~2
🚨🟢 | Use of gestures recognition (postures and/or gestures and/or mapping) | ~2
🚨🟡 | Use of content (shapes, images, animations...) | ~2
🚨🔴 | Interactive application | ~2
🎬🟢 | Documentation (how to play, how to run the app...) | ~1
> Note :
> Coefficients may change and are here only indicative
---
[Home](./README.md)
| [Exercise 1 - Kinect Streams](./exo1_subject.md)
| [Exercise 2 - Introduction](./exo2_subject.md)
| [Exercise 2 part 1 - Postures](./exo2_1_subject.md)
| [Exercise 2 part 2 - Gestures](./exo2_2_subject.md)
| [Exercise 2 part 3 - Mapping](./exo2_3_subject.md)
| **Exercise 3 - Free App**
---
Copyright © 2023-2024 Marc Chevaldonné
---
While preparing these practical works, I was listening to...
<table>
<tr>
<td>
<img src="./images/live_at_fip.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Live At Fip</b></p>
<p><i>Popa Chubby</i> (2003)</p>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td>
<img src="./images/sarah_vaughan.jpg" width="120"/>
</td>
<td>
<div>
<p><b>Sarah Vaughan</b></p>
<p><i>Sarah Vaughan</i> (1955)</p>
</div>
</td>
</tr>
</table>

@ -1,89 +0,0 @@
# Introduction
- [Introduction](#introduction)
- [Kinect sensor](#kinect-sensor)
- [What's inside the Kinect sensor?](#whats-inside-the-kinect-sensor)
- [Software and SDK](#software-and-sdk)
- [Course of the practical work](#course-of-the-practical-work)
- [Evaluation](#evaluation)
The goal of this resource is to go deeper into *Object Oriented Programming* through the use of an (formerly) innovative device (**KinecT**) and simple gesture detection algorithms.
It is made of three exercises:
- the first one aims at retrieving information from the **Kinect** (4 hours)
- the second one aims at writing a gesture detection algorithm (4 hours)
- and the last one is a free subject exercise where you are asked to develop a simple app using the former two exercises.
This document is a quick introduction to the **Kinect** sensor.
# Kinect sensor
**Kinect** is a device designed by Microsoft, initially for the **Xbox360** and **Windows**, and then also for **Xbox One**.
Its purpose is to allow controlling applications (mainly games) without any physical device, with your own body. It is then a **Natural User Interface**.
It has first been sold in late 2010 (v1), and later in february 2012 (v2), and the windows version in july 2014. The production has ended in 2017.
But since 2019, the new **Azure Kinect** has been released. I do not have tested it yet.
> Tip 💡
> The word **Kinect** is a puzzle between *kinetic* (movement) and *connect*.
## What's inside the Kinect sensor?
The **Kinect** sensor owns various sensors.
It is an horizontal bar with:
- an infrared projector,
- cameras (RGB camera, time of flight camera),
- depth sensor,
- a special microchip generating a grid to allow position calculation
- a motorized pivot to position automatically the bar towards the users
- microphones
It allows:
- full body 3D motion capture (skeleton tracking)
- facial recognition
- voice recognition
## Software and SDK
If you want to use the **Kinect** sensor v2, you need to use the [**Kinect for Windows SDK 2.0**](https://www.microsoft.com/en-us/download/details.aspx?id=44561). You can then use C# (XAML), C++ or VB.NET.
However, due to its released date, it is not possible to use it with .NET Core or MAUI. You have to use a **.NET Framework** project to develop for the **Kinect**.
# Course of the practical work
You have only 1 hour of introduction in theater, and then 14 hours of practical work. This can be done only in the **C21** room where the **Kinect SDK** is installed.
> ⚠️ Available material ⚠️
> Due to the small number of **Kinect** sensors owned by IUT Clermont Auvergne, it is not possible to borrow one for the period, a weekend, or a night. If you want to work with the sensor outside of the practical work, you can borrow one during the day, if it is not used by another group. But all sensors should be returned at the end of the day.
You have three exercises to realize. It is advised to use:
- 4 to 6 hours for the first one,
- 4 to 6 hours for the second one,
- 2 to 6 hours for the third one.
Some parts of the exercises are mandatory to access the next exercise, some are not.
It is advised to organized yourself:
- before practical work:
- study the advised themes via resources given in the subjects,
- prepare your questions if you have some
- during the practical work:
- realize the different tasks
- validate your new skills acquisition with your teacher
- after the practical work:
- update and analyze your *to do list*
- check the skills that have not been vaidated yet with your teacher.
# Evaluation
You will be evaluated three times (one for each exercise). It will be done during the practical works.
In order to help you, we deliver you a *skill list* that you will have to fill by validating skills with your teacher.
To obtain a validation, you will have to prove your skill knowledge to your teacher through an oral interview or a test.
The final note will be composed of all the validated skills by the teacher at the end of the last minute of the last practical work hour.
Exercise | Subject | Coefficient
--- | --- | ---
1 | Kinect Streams | 7
2.1 | Gesture Recognition (Bases & Postures) | 3
2.2 | Gesture Recognition (Dynamic Gestures) | 2
2.3 | Gesture Recognition (Mapping) | 2
3 | Free App | 7
---
Copyright © 2023-2024 Marc Chevaldonné

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 386 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save