added latest master + fixed binding

colorStream
nico-dev 1 year ago
commit 80d8612e48

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
namespace KinectConnection
{
public class BodyImageStream : KinectStream
{
public override void Start()
{
throw new NotImplementedException();
}
public override void Stop()
{
throw new NotImplementedException();
}
}
}

@ -1,4 +1,5 @@
using Microsoft.Kinect;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.Kinect;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
@ -26,6 +27,13 @@ namespace KinectConnection
/// </summary>
private ColorFrameReader reader;
public WriteableBitmap Bitmap { get { return bitmap; } set { SetProperty(ref bitmap, value); } }
public ColorImageStream() : base()
{
}
public override void Start()
{
// create the colorFrameDescription from the ColorFrameSource using rgba format

@ -44,6 +44,7 @@
<HintPath>..\..\..\..\..\Program Files\Microsoft SDKs\Kinect\v2.0_1409\Assemblies\Microsoft.Kinect.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
@ -75,6 +76,7 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="BodyImageStream.cs" />
<Compile Include="ColorImageStream.cs" />
<Compile Include="DepthImageStream.cs" />
<Compile Include="InfraredImageStream.cs" />

@ -12,6 +12,8 @@ namespace KinectConnection
private bool status;
private string statusText;
public KinectSensor KinectSensor { get { return kinectSensor; } }
/// <summary>
/// Initializes a new instance of the KinectManager class.
/// </summary>

@ -1,11 +1,12 @@
using Microsoft.Kinect;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.Kinect;
namespace KinectConnection
{
/// <summary>
/// Abstract class for Kinect streams.
/// </summary>
public abstract class KinectStream
public abstract class KinectStream : ObservableObject
{
// Redondant d'avoir KinectSensor et KinectManager ici ? (car sensor dans manager)
protected KinectSensor KinectSensor { get; set; }
@ -14,5 +15,11 @@ namespace KinectConnection
public abstract void Start();
public abstract void Stop();
public KinectStream()
{
KinectSensor = KinectSensor.GetDefault();
KinectManager = new KinectManager();
}
}
}

@ -16,9 +16,9 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="10"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="10"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
@ -59,7 +59,8 @@
<Button Content="Color"
Width="100"
Height="30"
Grid.Column="1">
Grid.Column="1"
Command="{Binding ColorCommand}">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
@ -107,5 +108,11 @@
</Button.Resources>
</Button>
</Grid>
<Grid Grid.Row="4">
<Viewbox Grid.Row="1" HorizontalAlignment="Center">
<Image Source="{Binding KinectStream.Bitmap}"/>
</Viewbox>
</Grid>
</Grid>
</Window>

@ -13,8 +13,11 @@ namespace KinectSensorStreams.ViewModel
/// </summary>
public ICommand StartCommand { get; set; }
public ICommand ColorCommand { get; set; }
/// <summary>
/// Propriété liée à l'objet KinectManager
/// Maybe to remove now that we have the KinectStream attribute
/// </summary>
public KinectManager KinectManager { get; set; }
@ -68,6 +71,11 @@ namespace KinectSensorStreams.ViewModel
KinectStream.Start();
}
private void Color()
{
ColorImageStream.Start();
}
#endregion
}
}

Loading…
Cancel
Save