本文整理汇总了C#中Microsoft.Kinect.Toolkit.KinectChangedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# KinectChangedEventArgs类的具体用法?C# KinectChangedEventArgs怎么用?C# KinectChangedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KinectChangedEventArgs类属于Microsoft.Kinect.Toolkit命名空间,在下文中一共展示了KinectChangedEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SeletorKinect_KinectChanged
private void SeletorKinect_KinectChanged(object sender, KinectChangedEventArgs kinectArgs)
{
if (kinectArgs.OldSensor != null)
{
try
{
if (kinectArgs.OldSensor.DepthStream.IsEnabled)
kinectArgs.OldSensor.DepthStream.Disable();
if (kinectArgs.OldSensor.SkeletonStream.IsEnabled)
kinectArgs.OldSensor.SkeletonStream.Disable();
if (kinectArgs.OldSensor.ColorStream.IsEnabled)
kinectArgs.OldSensor.ColorStream.Disable();
}
catch (InvalidOperationException)
{
// Captura exceção caso o KinectSensor entre em um estado inválido durante a desabilitação de um fluxo.
}
}
if (kinectArgs.NewSensor != null)
{
if (MetodoInicializadorKinect != null)
MetodoInicializadorKinect(SeletorKinect.Kinect);
}
}
开发者ID:gilgaljunior,项目名称:CrieAplicacoesInterativascomoMicrosoftKinect,代码行数:28,代码来源:InicializadorKinect.cs
示例2: SensorChooserOnKinectChanged
private void SensorChooserOnKinectChanged(object sender, KinectChangedEventArgs args)
{
MessageBox.Show(args.NewSensor == null ? "No Kinect" : args.NewSensor.Status.ToString());
}
开发者ID:sgupta43,项目名称:CS422,代码行数:7,代码来源:mainWindow.xaml.cs
示例3: myChooser_KinectChanged
void myChooser_KinectChanged(object sender, KinectChangedEventArgs e)
{
if (null != e.OldSensor)
{
//Alten Kinect deaktivieren
if (mySensor != null)
{
mySensor.Dispose();
}
}
if (null != e.NewSensor)
{
mySensor = e.NewSensor;
mySensor.ColorStream.Enable(ColorImageFormat.InfraredResolution640x480Fps30);
myColorArray = new byte[this.mySensor.ColorStream.FramePixelDataLength];
myBitmap = new WriteableBitmap(this.mySensor.DepthStream.FrameWidth, this.mySensor.DepthStream.FrameHeight, 96.0, 96.0, PixelFormats.Gray16, null);
image1.Source = myBitmap;
mySensor.AllFramesReady += new EventHandler<AllFramesReadyEventArgs>(mySensor_AllFramesReady);
try
{
this.mySensor.Start();
SensorChooserUI.Visibility = Visibility.Hidden;
}
catch (IOException)
{
this.mySensor = null;
}
}
}
开发者ID:kinectNao,项目名称:bluenao,代码行数:30,代码来源:MainWindow.xaml.cs
示例4: ChooserSensorChanged
private static void ChooserSensorChanged(object sender, KinectChangedEventArgs e)
{
//As of 6/12/2013 @ 10:30AM, the program never enters here
var old = e.OldSensor;
StopKinect(old);
var newsensor = e.NewSensor;
if (newsensor == null)
{
return;
}
newsensor.SkeletonStream.Enable();
//newsensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
//newsensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
newsensor.AllFramesReady += SensorAllFramesReady;
try
{
newsensor.Start();
}
catch (System.IO.IOException)
{
//maybe another app is using Kinect
_chooser.TryResolveConflict();
}
}
开发者ID:AesteroidBlues,项目名称:rampage-xl,代码行数:28,代码来源:XLK.cs
示例5: sensorChooser_KinectChanged
void sensorChooser_KinectChanged(object sender, KinectChangedEventArgs e)
{
if (e.OldSensor != null)
{
e.OldSensor.Stop();
}
if (e.NewSensor != null)
{
e.NewSensor.ColorStream.Enable();
e.NewSensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
//var parameters = new TransformSmoothParameters
//{
// Smoothing = 0.3f,
// Correction = 0.0f,
// Prediction = 0.0f,
// JitterRadius = 1.0f,
// MaxDeviationRadius = 0.5f
//};
//e.NewSensor.SkeletonStream.Enable(parameters);
e.NewSensor.SkeletonStream.Enable();
e.NewSensor.DepthStream.Range = DepthRange.Near;
e.NewSensor.SkeletonStream.EnableTrackingInNearRange = true;
e.NewSensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
e.NewSensor.AllFramesReady += NewSensor_AllFramesReady;
_colorBitmap = Coding4Fun.Kinect.Wpf.WriteableBitmapHelper.CreateWriteableBitmap(e.NewSensor.ColorStream);
_image1.Source = _colorBitmap;
}
}
开发者ID:Cocotus,项目名称:kinect,代码行数:30,代码来源:OneButtonWindow.xaml.cs
示例6: myChooser_KinectChanged
void myChooser_KinectChanged(object sender, KinectChangedEventArgs e)
{
if (null != e.OldSensor)
{
//Alten Kinect deaktivieren
if (mySensor != null)
{
mySensor.Dispose();
}
}
if (null != e.NewSensor)
{
mySensor = e.NewSensor;
mySensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
myDArray1 = new short[this.mySensor.DepthStream.FramePixelDataLength];
myDArray2 = new short[this.mySensor.DepthStream.FramePixelDataLength];
myDArray3 = new short[this.mySensor.DepthStream.FramePixelDataLength];
myHistoArray = new int[50];
myFinalArray = new short[this.mySensor.DepthStream.FramePixelDataLength];
mySensor.AllFramesReady += new EventHandler<AllFramesReadyEventArgs>(mySensor_AllFramesReady);
try
{
this.mySensor.Start();
SensorChooserUI.Visibility = Visibility.Hidden;
}
catch (IOException)
{
this.mySensor = null;
}
}
}
开发者ID:kinectNao,项目名称:bluenao,代码行数:33,代码来源:MainWindow.xaml.cs
示例7: myChooser_KinectChanged
void myChooser_KinectChanged(object sender, KinectChangedEventArgs e)
{
if (null != e.OldSensor)
{
//Alten Kinect deaktivieren
if (mySensor != null)
{
mySensor.Dispose();
}
}
if (null != e.NewSensor)
{
mySensor = e.NewSensor;
mySensor.AudioSource.Start();
mySensor.AudioSource.BeamAngleChanged += new EventHandler<BeamAngleChangedEventArgs>(AudioSource_BeamAngleChanged);
mySensor.AudioSource.SoundSourceAngleChanged += new EventHandler<SoundSourceAngleChangedEventArgs>(AudioSource_SoundSourceAngleChanged);
myBitmap = new WriteableBitmap(640,480, 96.0, 96.0, PixelFormats.Pbgra32, null);
image1.Source = myBitmap;
try
{
this.mySensor.Start();
SensorChooserUI.Visibility = Visibility.Hidden;
}
catch (IOException)
{
this.mySensor = null;
}
}
}
开发者ID:kinectNao,项目名称:bluenao,代码行数:30,代码来源:MainWindow.xaml.cs
示例8: ChooserSensorChanged
void ChooserSensorChanged(object sender, KinectChangedEventArgs e)
{
var old = e.OldSensor;
StopKinect(old);
var newsensor = e.NewSensor;
if (newsensor == null)
{
return;
}
newsensor.SkeletonStream.Enable();
newsensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
newsensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
newsensor.AllFramesReady += SensorAllFramesReady;
try
{
newsensor.Start();
rtbMessages.Text = "Kinect Started" + "\r";
}
catch (System.IO.IOException)
{
rtbMessages.Text = "Kinect Not Started" + "\r";
//maybe another app is using Kinect
_chooser.TryResolveConflict();
}
}
开发者ID:zyp8884625,项目名称:Kinect_Research,代码行数:28,代码来源:Form1.cs
示例9: OnKinectSensorChanged
public void OnKinectSensorChanged(object sender, KinectChangedEventArgs args)
{
if (null == args)
{
throw new ArgumentNullException("args");
}
if (null != args.OldSensor)
{
args.OldSensor.ColorFrameReady -= this.ColorImageReady;
}
if ((null != args.NewSensor) && (KinectStatus.Connected == args.NewSensor.Status))
{
if (ColorImageFormat.RawYuvResolution640x480Fps15 == args.NewSensor.ColorStream.Format)
{
throw new NotImplementedException("RawYuv conversion is not yet implemented.");
}
else
{
args.NewSensor.ColorFrameReady += this.ColorImageReady;
}
}
}
开发者ID:VincentGuigui,项目名称:IKinea,代码行数:25,代码来源:KinectViewer.cs
示例10: chooser_KinectChanged
/* This function is used to stop any previous instances of a running kinect sensor
* and starts a new reference under the name NewSensor.
* if a kinect sensor is connected to the PC then its depth stream is enabled
* to receive the depth data and the sensor is started. Exceptions may occur
* during the process of starting the sensor which is taken care of in the try-
* catch block.
*/
void chooser_KinectChanged(object sender, KinectChangedEventArgs e)
{
KinectSensor oldSensor = (KinectSensor)e.OldSensor;
//Get reference to any old sensor
StopKinect(oldSensor);
//Stop the previous instances if any
KinectSensor newSensor = (KinectSensor)e.NewSensor;
//Get a reference to a new (latest) kinect sensor
if (newSensor == null)
{
//If no kinect sensor is connected simply return
return;
}
//If a kinect sensor is attached then ...
newSensor.DepthStream.Enable(DepthImageFormat.Resolution320x240Fps30);
//Enable the depth stream to recerive depth data of the frame of resolution 320 x 240
newSensor.AllFramesReady += newSensor_AllFramesReady;
//Initializing the AllFramesReady event
try
{
newSensor.Start();
//Start the kinect sensor
}
catch (System.IO.IOException)
{
//Some other application is streaming from the same Kinect sensor
chooser.TryResolveConflict();
//Allow chooser to resolve conflict if any
}
}
开发者ID:RoboTricks,项目名称:kinect,代码行数:38,代码来源:MainWindow.xaml.cs
示例11: myChooser_KinectChanged
void myChooser_KinectChanged(object sender, KinectChangedEventArgs e)
{
if (null != e.OldSensor)
{
//Alten Kinect deaktivieren
if (mySensor != null)
{
mySensor.Dispose();
}
}
if (null != e.NewSensor)
{
mySensor = e.NewSensor;
mySensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
myArray = new short[this.mySensor.DepthStream.FramePixelDataLength];
myBitmap = new WriteableBitmap(this.mySensor.DepthStream.FrameWidth, this.mySensor.DepthStream.FrameHeight, 96.0, 96.0, PixelFormats.Gray16, null);
image1.Source = myBitmap;
mySensor.DepthFrameReady += this.SensorDepthFrameReady;
try
{
this.mySensor.Start();
//SensorChooserUI.Visibility = Visibility.Hidden;
}
catch (IOException)
{
this.mySensor = null;
}
}
}
开发者ID:kinectNao,项目名称:bluenao,代码行数:30,代码来源:MainWindow.xaml.cs
示例12: myChooser_KinectChanged
void myChooser_KinectChanged(object sender, KinectChangedEventArgs e)
{
if (null != e.OldSensor)
{
//Alten Kinect deaktivieren
if (mySensor != null)
{
mySensor.Dispose();
}
}
if (null != e.NewSensor)
{
RecognizerInfo ri = GetKinectRecognizer();
mySensor = e.NewSensor;
if (null != ri)
{
myEngine = new SpeechRecognitionEngine(ri.Id);
using (var memoryStream = new MemoryStream(Encoding.ASCII.GetBytes(Properties.Resources.Grammar)))
{
var g = new Grammar(memoryStream);
myEngine.LoadGrammar(g);
}
myEngine.SpeechRecognized+=new EventHandler<SpeechRecognizedEventArgs>(myEngine_SpeechRecognized);
myEngine.SpeechRecognitionRejected+=new EventHandler<SpeechRecognitionRejectedEventArgs>(myEngine_SpeechRecognitionRejected);
myEngine.SetInputToAudioStream(mySensor.AudioSource.Start(), new SpeechAudioFormatInfo(EncodingFormat.Pcm, 16000, 16, 1, 32000, 2, null));
myEngine.RecognizeAsync(RecognizeMode.Multiple);
}
}
}
开发者ID:kinectNao,项目名称:bluenao,代码行数:34,代码来源:MainWindow.xaml.cs
示例13: SensorChooserOnKinectChanged
private void SensorChooserOnKinectChanged(object sender, KinectChangedEventArgs args)
{
bool error = false;
if (args.OldSensor != null)
{
try
{
args.OldSensor.DepthStream.Range = DepthRange.Default;
args.OldSensor.SkeletonStream.EnableTrackingInNearRange = false;
args.OldSensor.DepthStream.Disable();
args.OldSensor.SkeletonStream.Disable();
}
catch (InvalidOperationException)
{
// KinectSensor might enter an invalid state while enabling/disabling streams or stream features.
// E.g.: sensor might be abruptly unplugged.
error = true;
}
}
if (args.NewSensor != null)
{
try
{
args.NewSensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
args.NewSensor.SkeletonStream.Enable();
try
{
args.NewSensor.DepthStream.Range = DepthRange.Near;
args.NewSensor.SkeletonStream.EnableTrackingInNearRange = true;
args.NewSensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
}
catch (InvalidOperationException)
{
// Non Kinect for Windows devices do not support Near mode, so reset back to default mode.
args.NewSensor.DepthStream.Range = DepthRange.Default;
args.NewSensor.SkeletonStream.EnableTrackingInNearRange = false;
}
}
catch (InvalidOperationException)
{
error = true;
// KinectSensor might enter an invalid state while enabling/disabling streams or stream features.
// E.g.: sensor might be abruptly unplugged.
}
try
{
if (!error)
kinectRegion1.KinectSensor = args.NewSensor;
}
catch (Exception)
{
throw;
}
}
}
开发者ID:playboy210,项目名称:playboy,代码行数:59,代码来源:FaceTrackMainWindow.xaml.cs
示例14: SensorChooserOnKinectChanged
private void SensorChooserOnKinectChanged(object sender, KinectChangedEventArgs kinectChangedEventArgs)
{
Trace.WriteLine("kinect changed!");
KinectSensor oldSensor = kinectChangedEventArgs.OldSensor;
KinectSensor newSensor = kinectChangedEventArgs.NewSensor;
if (oldSensor != null)
{
Trace.WriteLine("old sensor");
oldSensor.AllFramesReady -= KinectSensorOnAllFramesReady;
oldSensor.ColorStream.Disable();
oldSensor.DepthStream.Disable();
oldSensor.DepthStream.Range = DepthRange.Default;
oldSensor.SkeletonStream.Disable();
oldSensor.SkeletonStream.EnableTrackingInNearRange = false;
oldSensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Default;
}
if (newSensor != null)
{
try
{
newSensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
newSensor.DepthStream.Enable(DepthImageFormat.Resolution320x240Fps30);
try
{
// This will throw on non Kinect For Windows devices.
newSensor.DepthStream.Range = DepthRange.Near;
newSensor.SkeletonStream.EnableTrackingInNearRange = true;
}
catch (InvalidOperationException)
{
newSensor.DepthStream.Range = DepthRange.Default;
newSensor.SkeletonStream.EnableTrackingInNearRange = false;
}
newSensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
Trace.WriteLine("before enable");
newSensor.SkeletonStream.Enable();
Trace.WriteLine("after enable");
newSensor.AllFramesReady += KinectSensorOnAllFramesReady;
}
catch (InvalidOperationException)
{
// This exception can be thrown when we are trying to
// enable streams on a device that has gone away. This
// can occur, say, in app shutdown scenarios when the sensor
// goes away between the time it changed status and the
// time we get the sensor changed notification.
//
// Behavior here is to just eat the exception and assume
// another notification will come along if a sensor
// comes back.
}
}
}
开发者ID:Hitchhikrr,项目名称:harley,代码行数:57,代码来源:FaceRecognitionActivityWindow.xaml.cs
示例15: KinectSensor_KinectChanged
void KinectSensor_KinectChanged(object sender, KinectChangedEventArgs e)
{
bool error = true;
if (e.OldSensor == null)
{
try
{
e.OldSensor.DepthStream.Disable();
e.OldSensor.SkeletonStream.Disable();
}
catch (Exception)
{
error = true;
}
}
if (e.NewSensor == null)
return;
try
{
Kinect = e.NewSensor;
e.NewSensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
e.NewSensor.SkeletonStream.Enable();
e.NewSensor.SkeletonFrameReady += KinectSensor_SkeletonFrameReady;
try
{
e.NewSensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
e.NewSensor.DepthStream.Range = DepthRange.Near;
e.NewSensor.SkeletonStream.EnableTrackingInNearRange = true;
}
catch (InvalidOperationException)
{
e.NewSensor.DepthStream.Range = DepthRange.Default;
e.NewSensor.SkeletonStream.EnableTrackingInNearRange = false;
}
}
catch (InvalidOperationException)
{
error = true;
}
ZonaCursor.KinectSensor = e.NewSensor;
KinectRegion.AddHandPointerGripHandler(this.ZonaCursor, this.OnHandGripHandler);
KinectRegion.AddHandPointerGripReleaseHandler(this.ZonaCursor, this.OngRripReleaseHandler);
KinectRegion.AddHandPointerMoveHandler(this.ZonaCursor, this.OnMoveHandler);
KinectRegion.AddHandPointerPressHandler(this.ZonaCursor, this.OnPressHandler);
KinectRegion.AddHandPointerPressReleaseHandler(this.ZonaCursor, this.OnPressRelaaseHandler);
}
开发者ID:donnaknew,项目名称:programmingProject,代码行数:53,代码来源:MainWindow.xaml.cs
示例16: sensorChooser_KinectChanged
void sensorChooser_KinectChanged(object sender, KinectChangedEventArgs e)
{
try
{
this.UninitializeSensor(e.OldSensor);
this.InitializeSensor(e.NewSensor);
}
catch (InvalidOperationException)
{
// cos zle z sensorem
}
}
开发者ID:KaMyLuS,项目名称:PTT-Kinect-Server,代码行数:12,代码来源:MainWindow.xaml.cs
示例17: _sensorChooser_KinectChanged
void _sensorChooser_KinectChanged(object sender, KinectChangedEventArgs e)
{
if (e.OldSensor != null)
{
e.OldSensor.Stop();
e.OldSensor.AllFramesReady -= this._sensor_AllFramesReady;
}
if (e.NewSensor != null)
{
#region Setup Kinect Sensor
_sensor = e.NewSensor;
//map points
_mapper = new CoordinateMapper(_sensor);
// create color data bitmaps and arrays
_colorData = new byte[_sensor.ColorStream.FramePixelDataLength];
_colorWriteableBitmap = new WriteableBitmap(_sensor.ColorStream.FrameWidth, _sensor.ColorStream.FrameHeight, 96.0, 96.0, PixelFormats.Bgr32, null);
// create the skeleton arrays
_skeletons = new Skeleton[_sensor.SkeletonStream.FrameSkeletonArrayLength];
// Assign the writeable bitmap to the WPF color image display
ColorImage.Source = _colorWriteableBitmap;
// enable color, depth, skeleton
_sensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
_sensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
try
{
_sensor.DepthStream.Range = DepthRange.Near;
}
catch
{
// Kinect for Xbox, doesn't support this.
}
_sensor.SkeletonStream.Enable();
_sensor.SkeletonStream.EnableTrackingInNearRange = true;
_sensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
// hook up our event
_sensor.AllFramesReady += _sensor_AllFramesReady;
#endregion
//System.Drawing.Bitmap and the OpenCvImage
_drawingBitmap = new Bitmap(_sensor.ColorStream.FrameWidth, _sensor.ColorStream.FrameHeight, PixelFormat.Format32bppRgb);
_ocvColorImg = new Image<Bgra, byte>(_drawingBitmap);
}
}
开发者ID:Cocotus,项目名称:kinect,代码行数:53,代码来源:MainWindow.xaml.cs
示例18: _sensorChooser_KinectChanged
void _sensorChooser_KinectChanged(object sender, KinectChangedEventArgs e)
{
if (e.OldSensor != null)
{
try
{
e.OldSensor.DepthStream.Range = DepthRange.Default;
e.OldSensor.SkeletonStream.EnableTrackingInNearRange = false;
e.OldSensor.DepthStream.Disable();
e.OldSensor.SkeletonStream.Disable();
e.OldSensor.ColorStream.Disable();
e.OldSensor.Stop();
}
catch (InvalidOperationException)
{
// KinectSensor might enter an invalid state while enabling/disabling streams or stream features.
// E.g.: sensor might be abruptly unplugged.
}
}
if (e.NewSensor != null)
{
try
{
e.NewSensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
e.NewSensor.SkeletonStream.Enable();
//e.NewSensor.ColorStream.Enable();
try
{
e.NewSensor.DepthStream.Range = DepthRange.Near;
e.NewSensor.SkeletonStream.EnableTrackingInNearRange = true;
e.NewSensor.Start();
this.openGameWindow();
}
catch (InvalidOperationException)
{
// Non Kinect for Windows devices do not support Near mode, so reset back to default mode.
e.NewSensor.DepthStream.Range = DepthRange.Default;
e.NewSensor.SkeletonStream.EnableTrackingInNearRange = false;
e.NewSensor.Start();
this.openGameWindow();
}
}
catch (InvalidOperationException)
{
// KinectSensor might enter an invalid state while enabling/disabling streams or stream features.
// E.g.: sensor might be abruptly unplugged.
}
}
//throw new NotImplementedException();
}
开发者ID:guozanhua,项目名称:KinectMiniGames,代码行数:52,代码来源:MainWindow.xaml.cs
示例19: SensorChooserOnKinectChanged
private void SensorChooserOnKinectChanged(object sender, KinectChangedEventArgs e)
{
if (e.OldSensor != null)
{
try
{
e.OldSensor.DepthStream.Range = DepthRange.Default;
e.OldSensor.SkeletonStream.EnableTrackingInNearRange = false;
e.OldSensor.DepthStream.Disable();
e.OldSensor.SkeletonStream.Disable();
}
catch (InvalidOperationException)
{
// KinectSensor might enter an invalid state while enabling/disabling streams or stream features.
// E.g.: sensor might be abruptly unplugged.
}
}
if (e.NewSensor != null)
{
try
{
e.NewSensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
e.NewSensor.SkeletonStream.Enable();
try
{
e.NewSensor.DepthStream.Range = DepthRange.Near;
e.NewSensor.SkeletonStream.EnableTrackingInNearRange = true;
e.NewSensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
}
catch (InvalidOperationException)
{
// Non Kinect for Windows devices do not support Near mode, so reset back to default mode.
e.NewSensor.DepthStream.Range = DepthRange.Default;
e.NewSensor.SkeletonStream.EnableTrackingInNearRange = false;
}
}
catch (InvalidOperationException)
{
//MessageBox.Show("Kinect Setup Error");
// KinectSensor might enter an invalid state while enabling/disabling streams or stream features.
// E.g.: sensor might be abruptly unplugged.
}
if (e.NewSensor.Status == KinectStatus.Connected)
{
KinectUserViewer.KinectSensor = e.NewSensor;
MyKinectRegion.KinectSensor = e.NewSensor;
}
}
}
开发者ID:guozanhua,项目名称:KinectMiniGames,代码行数:51,代码来源:FirstLevelView.xaml.cs
示例20: SensorChooserOnKinectChanged
private void SensorChooserOnKinectChanged(object sender, KinectChangedEventArgs args)
{
bool error = false;
if (args.OldSensor != null)
{
try
{
args.OldSensor.DepthStream.Range = DepthRange.Default;
args.OldSensor.SkeletonStream.EnableTrackingInNearRange = false;
args.OldSensor.DepthStream.Disable();
args.OldSensor.SkeletonStream.Disable();
}
catch (InvalidOperationException)
{
error = true;
}
}
if (args.NewSensor != null)
{
try
{
args.NewSensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
args.NewSensor.SkeletonStream.Enable();
try
{
args.NewSensor.DepthStream.Range = DepthRange.Near;
args.NewSensor.SkeletonStream.EnableTrackingInNearRange = true;
}
catch (InvalidOperationException)
{
args.NewSensor.DepthStream.Range = DepthRange.Default;
args.NewSensor.SkeletonStream.EnableTrackingInNearRange = false;
error = true;
}
}
catch (InvalidOperationException)
{
error = true;
}
}
if (!error)
{
kinectRegion.KinectSensor = args.NewSensor;
}
}
开发者ID:nata-water,项目名称:kinect_sample_scrollbar_in_image,代码行数:50,代码来源:MainWindow.xaml.cs
注:本文中的Microsoft.Kinect.Toolkit.KinectChangedEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论