|
|
|
@ -6,24 +6,18 @@ namespace Lib
|
|
|
|
|
{
|
|
|
|
|
public class KinectManager : INotifyPropertyChanged
|
|
|
|
|
{
|
|
|
|
|
private KinectStream currentStream;
|
|
|
|
|
public KinectStream CurrentStream
|
|
|
|
|
{
|
|
|
|
|
get { return currentStream; }
|
|
|
|
|
private KinectSensor sensor;
|
|
|
|
|
public KinectSensor Sensor {
|
|
|
|
|
get {
|
|
|
|
|
return sensor;
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (currentStream != value)
|
|
|
|
|
{
|
|
|
|
|
if (currentStream != null)
|
|
|
|
|
{
|
|
|
|
|
currentStream.Stop();
|
|
|
|
|
}
|
|
|
|
|
currentStream = value;
|
|
|
|
|
currentStream.Start();
|
|
|
|
|
OnPropertyChanged(nameof(CurrentStream));
|
|
|
|
|
}
|
|
|
|
|
sensor = value;
|
|
|
|
|
OnPropertyChanged(nameof(Sensor));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
|
protected virtual void OnPropertyChanged(string propertyName)
|
|
|
|
|
{
|
|
|
|
@ -32,48 +26,38 @@ namespace Lib
|
|
|
|
|
|
|
|
|
|
public KinectManager()
|
|
|
|
|
{
|
|
|
|
|
CurrentStream = new ColorImageStream(KinectSensor.GetDefault());
|
|
|
|
|
sensor = KinectSensor.GetDefault();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ChangeToColorStream()
|
|
|
|
|
{
|
|
|
|
|
CurrentStream = new ColorImageStream(KinectSensor.GetDefault());
|
|
|
|
|
}
|
|
|
|
|
//public void ChangeToDepthStream()
|
|
|
|
|
//{
|
|
|
|
|
// KinectSensor sensor = KinectSensor.GetDefault();
|
|
|
|
|
// CurrentStream = new DepthImageStream(sensor);
|
|
|
|
|
//}
|
|
|
|
|
//public void ChangeToInfraredStream()
|
|
|
|
|
//{
|
|
|
|
|
// KinectSensor sensor = KinectSensor.GetDefault();
|
|
|
|
|
// CurrentStream = new InfraredImageStream(sensor);
|
|
|
|
|
//}
|
|
|
|
|
public void StartSensor()
|
|
|
|
|
{
|
|
|
|
|
currentStream.Start();
|
|
|
|
|
if (sensor != null) {
|
|
|
|
|
sensor.Open();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void StopSensor()
|
|
|
|
|
{
|
|
|
|
|
currentStream.Stop();
|
|
|
|
|
if (sensor != null)
|
|
|
|
|
{
|
|
|
|
|
sensor.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public bool Status
|
|
|
|
|
{
|
|
|
|
|
get { return currentStream.Sensor != null && currentStream.Sensor.IsAvailable; }
|
|
|
|
|
get { return Sensor != null && Sensor.IsAvailable; }
|
|
|
|
|
}
|
|
|
|
|
public string StatusText
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (currentStream.Sensor == null)
|
|
|
|
|
if (Sensor == null)
|
|
|
|
|
{
|
|
|
|
|
return "Kinect n'est pas connecté";
|
|
|
|
|
}
|
|
|
|
|
else if (!currentStream.Sensor.IsOpen)
|
|
|
|
|
else if (!Sensor.IsOpen)
|
|
|
|
|
{
|
|
|
|
|
return "Kinect n'est pas ouvert";
|
|
|
|
|
}
|
|
|
|
|
else if (currentStream.Sensor.IsAvailable)
|
|
|
|
|
else if (Sensor.IsAvailable)
|
|
|
|
|
{
|
|
|
|
|
return "Kinect est disponible";
|
|
|
|
|
}
|
|
|
|
|