本文整理汇总了C#中TransformSmoothParameters类的典型用法代码示例。如果您正苦于以下问题:C# TransformSmoothParameters类的具体用法?C# TransformSmoothParameters怎么用?C# TransformSmoothParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TransformSmoothParameters类属于命名空间,在下文中一共展示了TransformSmoothParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: initializ
//Methode d'initialisation
public void initializ()
{
//on associe a port , le port USB COM3
port = new SerialPort ("COM3", 9600);
//On ouvre le port pour l'envoie des données
port.Open ();
//On recupere la Kinect
sensor = KinectSensor.KinectSensors[0];
// SmoothParamater pour reduire les interferances sur le SkeletonStream
TransformSmoothParameters parameters = new TransformSmoothParameters{
Smoothing = 0.3f,
Correction = 0.0f,
Prediction = 0.0f,
JitterRadius = 1.0f,
MaxDeviationRadius = 0.5f
};
//On demare la capture
sensor.Start();
// Ouverture des flux
sensor.ColorStream.Enable();
sensor.DepthStream.Enable();
sensor.SkeletonStream.Enable(parameters);
//on ouvre une frame toute les 33 millisecondes
//soit environ 30 images secondes.
sensor.SkeletonStream.OpenNextFrame(33);
//le Tracking du skelette est réalisé par défault:
//20 joints , quelque soit la position de l'utilisateur.
sensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Default;
return;
}
示例2: StartKinectSensor
public void StartKinectSensor()
{
kinect = KinectSensor.KinectSensors[0];
if (kinect.Status == KinectStatus.Connected)
{
kinect.SkeletonStream.Enable();
kinect.SkeletonStream.TrackingMode = SkeletonTrackingMode.Seated;
TransformSmoothParameters smoothingParam = new TransformSmoothParameters();
{
smoothingParam.Smoothing = 0.5f;
smoothingParam.Correction = 0.1f;
smoothingParam.Prediction = 0.5f;
smoothingParam.JitterRadius = 0.1f;
smoothingParam.MaxDeviationRadius = 0.1f;
};
kinect.SkeletonStream.Enable(smoothingParam); // Enable skeletal tracking
skeletonData = new Skeleton[kinect.SkeletonStream.FrameSkeletonArrayLength];
kinect.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(kinect_SkeletonFrameReady);
kinect.Start();
}
else
Console.WriteLine("No Kinect Found");
}
示例3: SkeletonSlam
/// <summary>
/// Starts up the SkeletonSlam class.
/// </summary>
public SkeletonSlam()
{
halfSpinFlag = false;
fullSpinFlag = false;
fullRightFlag = false;
fullLeftFlag = false;
halfSpinRightFlag = false;
halfSpinLeftFlag = false;
quarterRightFlag = false;
quarterLeftFlag = false;
//kinectSensor = KinectSensor.KinectSensors[0];
TransformSmoothParameters smoothingParam = new TransformSmoothParameters();
{
smoothingParam.Smoothing = 0.5f;
smoothingParam.Correction = 0.5f;
smoothingParam.Prediction = 0.5f;
smoothingParam.JitterRadius = 0.05f;
smoothingParam.MaxDeviationRadius = 0.04f;
};
//kinectSensor.SkeletonStream.Enable(smoothingParam);
//kinectSensor.Start();
reset();
//kinectSensor.SkeletonFrameReady += getSkeleton;
//processHandMove = new Thread(ProcessHandMove);
//processHandMove.Start();
}
示例4: startKinect
private void startKinect()
{
if (KinectSensor.KinectSensors.Count > 0)
{
// Choose the first Kinect device
kinect = KinectSensor.KinectSensors[0];
if (kinect == null)
return;
kinect.ColorStream.Enable();
var tsp = new TransformSmoothParameters
{
Smoothing = 0.5f,
Correction = 0.5f,
Prediction = 0.5f,
JitterRadius = 0.05f,
MaxDeviationRadius = 0.04f
};
kinect.SkeletonStream.Enable(tsp);
// Start skeleton tracking
//kinect.ColorFrameReady += new EventHandler<ColorImageFrameReadyEventArgs>(kinect_ColorFrameReady);
//kinect.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(kinect_SkeletonFrameReady);
// Start Kinect device
kinect.Start();
}
else
{
MessageBox.Show("No Kinect Device found.");
}
}
示例5: startKinect
private void startKinect()
{
if (KinectSensor.KinectSensors.Count > 0)
{
kinect = KinectSensor.KinectSensors[0];
if (kinect == null)
{
return;
}
//Get Depth Stream, Color Stream
kinect.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
kinect.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
var parameters = new TransformSmoothParameters
{
Smoothing = 0.5f,
Correction = 0.5f,
Prediction = 0.5f,
JitterRadius = 0.05f,
MaxDeviationRadius = 0.04f
};
kinect.SkeletonStream.Enable(parameters);
kinect.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(kinect_SkeletonFrameReady);
kinectColorViewer1.Kinect = kinect;
//kinectSkeletonViewer1.Kinect = kinect;
kinect.Start();
//OperationRecognizer();
}
else
{
MessageBox.Show("No kinect device found");
}
}
示例6: StartKinect
public void StartKinect()
{
// Checks to see how many Kinects are connected to the system. If None then exit.
if (KinectSensor.KinectSensors.Count == 0)
{
Console.Out.WriteLine("There are no Kinects Connected");
return;
}
// If there is a Kinect connected, get the Kinect
ks = KinectSensor.KinectSensors[0];
ks.Start();
//Sets the initial elevation angle of the connect to 0 degrees
ks.ElevationAngle = 0;
// Set smoothing parameters for when Kinect is tracking a skeleton
TransformSmoothParameters parameters = new TransformSmoothParameters()
{
Smoothing = 0.7f,
Correction = 0.3f,
Prediction = 0.4f,
JitterRadius = 1.0f,
MaxDeviationRadius = 0.5f,
};
ks.SkeletonStream.Enable(parameters);
ks.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(ks_SkeletonFrameReady);
}
示例7: StartKinect
/// <summary>
/// Starts up Kinect
/// </summary>
void StartKinect()
{
try
{
kinect = KinectSensor.KinectSensors.FirstOrDefault();
kinect.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(runtime_SkeletonFrameReady);
TransformSmoothParameters parameters = new TransformSmoothParameters()
{
Smoothing = 0.75f,
Correction = 0.0f,
Prediction = 0.0f,
JitterRadius = 0.05f,
MaxDeviationRadius = 0.4f
};
kinect.SkeletonStream.Enable(parameters);
this.skeletonData = new Skeleton[kinect.SkeletonStream.FrameSkeletonArrayLength];
kinect.Start();
Trace.WriteLine("Kinect initialized");
}
catch (Exception)
{
Trace.WriteLine("Error while initializing Kinect. Trying again in 5 seconds...");
kinectRetryTimer.Start();
}
}
示例8: Initialize
/// <summary>
/// Allows the game component to perform any initialization it needs to before starting
/// to run. This is where it can query for any required services and load content.
/// </summary>
public override void Initialize()
{
// TODO: Add your initialization code here
//initialize Kinect SDK
LoadGameComponents();
kinectSensor = (from sensorToCheck in KinectSensor.KinectSensors
where sensorToCheck.Status == KinectStatus.Connected
select sensorToCheck).FirstOrDefault();
kinectSensor.DepthStream.Enable();
TransformSmoothParameters param = new TransformSmoothParameters();
param.Smoothing = 0.2f;
param.Correction = 0.0f;
param.Prediction = 0.0f;
param.JitterRadius = 0.2f;
param.MaxDeviationRadius = 0.3f;
kinectSensor.SkeletonStream.Enable(param);
kinectSensor.Start();
kinectSensor.AllFramesReady += new EventHandler<AllFramesReadyEventArgs>(kinectSensor_AllFrameReady);
//setup speech recognition
// SetupSpeech();
base.Initialize();
}
示例9: SetupKinect
private void SetupKinect()
{
// Check to see if there are any Kinect devices connected.
if (Runtime.Kinects.Count == 0)
{
MessageBox.Show("No Kinect connected");
}
else
{
// Use first Kinect.
kinectRuntime = Runtime.Kinects[0];
// Initialize to return skeletal data.
kinectRuntime.Initialize(RuntimeOptions.UseSkeletalTracking);
// Attach to the event to receive skeleton frame data.
kinectRuntime.SkeletonFrameReady += KinectRuntime_SkeletonFrameReady;
kinectRuntime.SkeletonEngine.TransformSmooth = true;
TransformSmoothParameters parameters = new TransformSmoothParameters();
parameters.Smoothing = 0.5f;
parameters.Correction = 0.3f;
parameters.Prediction = 0.2f;
parameters.JitterRadius = .2f;
parameters.MaxDeviationRadius = 0.5f;
kinectRuntime.SkeletonEngine.SmoothParameters = parameters;
kinectRuntime.NuiCamera.ElevationAngle = 0;
}
}
示例10: KinectNuiService
public KinectNuiService()
{
if (KinectSensor.KinectSensors.Count == 0)
{
return;
}
this.handsRaisingStart = new Dictionary<JointType, DateTime>();
this.handsRaising = new Dictionary<JointType, bool>();
this.handsWaitingToLower = new Dictionary<JointType, bool>();
this.BoundsWidth = .5d;
this.BoundsDepth = .5d;
this.MinDistanceFromCamera = 1.0d;
this.sensor = KinectSensor.KinectSensors[0];
this.sensor.AllFramesReady += new EventHandler<AllFramesReadyEventArgs>(sensor_AllFramesReady);
this.initialized = true;
var parameters = new TransformSmoothParameters();
parameters.Smoothing = 0.7f;
parameters.Correction = 0.9f;
parameters.Prediction = 0.5f;
parameters.JitterRadius = 0.5f;
parameters.MaxDeviationRadius = 0.5f;
this.sensor.SkeletonStream.Enable(parameters);
this.sensor.SkeletonStream.Enable();
this.sensor.DepthStream.Enable(DepthImageFormat.Resolution320x240Fps30);
this.sensor.Start();
DebugLogWriter.WriteMessage("Kinect initialized.");
}
示例11: kinectSensorChooser1_KinectSensorChanged
void kinectSensorChooser1_KinectSensorChanged(object sender, DependencyPropertyChangedEventArgs e)
{
KinectSensor oldSensor = (KinectSensor)e.OldValue;
stopKinect(oldSensor);
KinectSensor newSensor = (KinectSensor)e.NewValue;
newSensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
newSensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30);
var parameters = new TransformSmoothParameters
{
Smoothing = 0.3f,
Correction = 0.0f,
Prediction = 0.0f,
JitterRadius = 1.0f,
MaxDeviationRadius = 0.5f
};
//newSensor.SkeletonStream.Enable(parameters);
newSensor.SkeletonStream.Enable();
newSensor.AllFramesReady += new EventHandler<AllFramesReadyEventArgs>(newSensor_AllFramesReady);
try
{
newSensor.Start();
}
catch (System.IO.IOException)
{
kinectSensorChooser1.AppConflictOccurred();
}
}
示例12: SmoothingParams
private static TransformSmoothParameters SmoothingParams()
{
TransformSmoothParameters verySmoothParam = new TransformSmoothParameters();
{
verySmoothParam.Smoothing = 0.7f;
verySmoothParam.Correction = 0.3f;
verySmoothParam.Prediction = 1.0f;
verySmoothParam.JitterRadius = 1.0f;
verySmoothParam.MaxDeviationRadius = 1.0f;
};
TransformSmoothParameters smoothParam = new TransformSmoothParameters();
{
smoothParam.Smoothing = 0.5f;
smoothParam.Correction = 0.1f;
smoothParam.Prediction = 0.5f;
smoothParam.JitterRadius = 0.1f;
smoothParam.MaxDeviationRadius = 0.1f;
};
TransformSmoothParameters fastSmoothingParam = new TransformSmoothParameters();
{
fastSmoothingParam.Smoothing = 0.5f;
fastSmoothingParam.Correction = 0.5f;
fastSmoothingParam.Prediction = 0.5f;
fastSmoothingParam.JitterRadius = 0.05f;
fastSmoothingParam.MaxDeviationRadius = 0.04f;
};
return verySmoothParam;
}
示例13: VoiceControl
/// <summary>
/// Starts up the SkeletonSlam class.
/// </summary>
public VoiceControl()
{
kinectSensor = KinectSensor.KinectSensors[0];
TransformSmoothParameters smoothingParam = new TransformSmoothParameters();
{
smoothingParam.Smoothing = 0.5f;
smoothingParam.Correction = 0.5f;
smoothingParam.Prediction = 0.5f;
smoothingParam.JitterRadius = 0.05f;
smoothingParam.MaxDeviationRadius = 0.04f;
};
kinectSensor.SkeletonStream.Enable(smoothingParam);
kinectSensor.SkeletonFrameReady += getSkeleton;
sre = CreateSpeechRecognizer();
kinectSensor.Start();
sre.SetInputToAudioStream(kinectSensor.AudioSource.Start(),
new SpeechAudioFormatInfo(
EncodingFormat.Pcm, 16000, 16, 1,
32000, 2, null));
sre.RecognizeAsync(RecognizeMode.Multiple);
reset();
}
示例14: StartKinectST
//Méthode d'initialisation de la Kinect
public void StartKinectST()
{
//Instancitation d'un objet kinectSensor
kinectSensor = KinectSensor.KinectSensors[0];
kinectSensor.Start();
// SmoothParamater pour éliminer le bruit
TransformSmoothParameters parameters = new TransformSmoothParameters
{
Smoothing = 0.3f,
Correction = 0.0f,
Prediction = 0.0f,
JitterRadius = 1.0f,
MaxDeviationRadius = 0.5f
};
// Ouverture des flux
kinectSensor.ColorStream.Enable();
kinectSensor.DepthStream.Enable();
kinectSensor.SkeletonStream.Enable(parameters);
kinectSensor.SkeletonStream.OpenNextFrame(33);
kinectSensor.SkeletonStream.TrackingMode = SkeletonTrackingMode.Default;
kinectSensor.SkeletonFrameReady += kinect_SkeletonFrameReady;
while (true)
{
}
}
示例15: SetupKinect
private void SetupKinect()
{
if (Runtime.Kinects.Count == 0)
{
this.Title = "No Kinect connected";
}
else
{
//use first Kinect
nui = Runtime.Kinects[0];
//Initialize to do skeletal tracking
nui.Initialize(RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseColor | RuntimeOptions.UseDepthAndPlayerIndex);
//add event to receive skeleton data
nui.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(nui_SkeletonFrameReady);
//to experiment, toggle TransformSmooth between true & false and play with parameters
nui.SkeletonEngine.TransformSmooth = true;
TransformSmoothParameters parameters = new TransformSmoothParameters();
// parameters used to smooth the skeleton data
parameters.Smoothing = 0.3f;
parameters.Correction = 0.3f;
parameters.Prediction = 0.4f;
parameters.JitterRadius = 0.7f;
parameters.MaxDeviationRadius = 0.2f;
nui.SkeletonEngine.SmoothParameters = parameters;
}
}