本文整理汇总了C#中Runtime.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# Runtime.Initialize方法的具体用法?C# Runtime.Initialize怎么用?C# Runtime.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Runtime
的用法示例。
在下文中一共展示了Runtime.Initialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
}
示例2: Mover
public Mover(GameStateManagementGame myGame)
{
thisGameIsAwesome = myGame;
kinectSensor = new Runtime();
try
{
kinectSensor.Initialize(RuntimeOptions.UseSkeletalTracking);
kinectSensor.SkeletonEngine.TransformSmooth = true;
TransformSmoothParameters p = new TransformSmoothParameters
{
Smoothing = 0.75f,
Correction = 0.0f,
Prediction = 0.0f,
JitterRadius = 0.05f,
MaxDeviationRadius = 0.04f
};
kinectSensor.SkeletonEngine.SmoothParameters = p;
}
catch (Exception ex)
{
}
}
示例3: 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;
}
}
示例4: buttonStart_Click
private void buttonStart_Click(object sender, EventArgs e)
{
_nui = Runtime.Kinects.FirstOrDefault();
if (_nui != null)
{
if (buttonStart.Text == Resources.Form1_buttonStart_Click_Start)
{
buttonStart.Text = Resources.Form1_buttonStart_Click_Stop;
_nui.Initialize(RuntimeOptions.UseColor);
_nui.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color);
_nui.VideoFrameReady += FrameReady;
}
else if (buttonStart.Text == Resources.Form1_buttonStart_Click_Stop)
{
buttonStart.Text = Resources.Form1_buttonStart_Click_Start;
_nui.Uninitialize();
}
}
else
{
var dr = MessageBox.Show(Resources.Form1_buttonStart_Click_Please_connect_a_Microsoft_Kinect_to_the_computer,
Resources.Form1_buttonStart_Click_Error, MessageBoxButtons.RetryCancel);
if (dr == DialogResult.Retry)
{
buttonStart_Click(sender, e);
}
}
}
示例5: Window_Loaded
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Runtime kinectRuntime = new Runtime();
kinectRuntime.Initialize(RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking);
kinectRuntime.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex);
kinectRuntime.SkeletonFrameReady += kinectRuntime_SkeletonFrameReady;
kinectRuntime.DepthFrameReady += kinectRuntime_DepthFrameReady;
kinectRuntime.SkeletonEngine.TransformSmooth = true;
var parameters = new TransformSmoothParameters
{
Smoothing = 0.75f,
Correction = 0.0f,
Prediction = 0.0f,
JitterRadius = 0.05f,
MaxDeviationRadius = 0.04f
};
kinectRuntime.SkeletonEngine.SmoothParameters = parameters;
using (game = new Game1())
{
game.Exiting += game_Exiting;
game.Run();
}
kinectRuntime.Uninitialize();
}
示例6: Main
public static void Main(string[] args)
{
var runtime = new Runtime();
runtime.Initialize(RuntimeOptions.UseSkeletalTracking);
var observer = runtime.SkeletonFrameReadyAsObservable();
}
示例7: KinectBACKUP
public KinectBACKUP(GraphicsDevice GraphicsDevice)
{
this.GraphicsDevice = GraphicsDevice;
kinect = new Runtime();
kinect.Initialize(RuntimeOptions.UseDepthAndPlayerIndex);
kinect.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex);
kinect.DepthFrameReady += new EventHandler<ImageFrameReadyEventArgs>(DepthFrameReady);
}
示例8: loadKinectNui
public void loadKinectNui(Runtime run)
{
run.Initialize(RuntimeOptions.UseColor | RuntimeOptions.UseSkeletalTracking);
run.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(kinectSensor_SkeletonFrameReady);
run.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs>(kinectSensor_VideoFrameReady);
run.NuiCamera.ElevationAngle = 0;
run.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution1280x1024, ImageType.Color);
}
示例9: InitKinect
private void InitKinect( Runtime kinect )
{
kinect.Initialize( RuntimeOptions.UseColor );
kinect.VideoStream.Open( ImageStreamType.Video, 2,
ImageResolution.Resolution640x480, ImageType.Color );
kinect.VideoFrameReady +=
new EventHandler<ImageFrameReadyEventArgs>( kinect_VideoFrameReady );
}
示例10: xnInitialize
// ������
private void xnInitialize()
{
// �����^�C���̏����� ... (1)
runtime = new Runtime();
runtime.Initialize( RuntimeOptions.UseColor );
// �r�f�I�A�f�v�X�X�g���[���̍쐬
runtime.VideoStream.Open( ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color );
}
示例11: xnInitialize
// 初期化
private void xnInitialize()
{
// ランタイムの初期化
runtime = new Runtime();
runtime.Initialize( RuntimeOptions.UseColor | RuntimeOptions.UseDepth );
// ビデオ、デプスストリームの作成
runtime.VideoStream.Open( ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color );
runtime.DepthStream.Open( ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.Depth );
}
示例12: SetUpRGBCamera
private Image rgbImage; // Image for including RGB camera feed
#endregion Fields
#region Methods
/// <summary>
/// Setup function for the RGBCamera class, taking in the nui from the main class and
/// using this to open the VideoStream.
/// </summary>
/// <param name="_nui">Instance of the NUI runtime.</param>
/// <param name="_rgbImage">Instance of the RGB image object</param>
public void SetUpRGBCamera(Runtime _nui, Image _rgbImage)
{
// Set class variables.
nui = _nui;
rgbImage = _rgbImage;
// Initialise NUI and open Videostream.
nui.Initialize(RuntimeOptions.UseColor | RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking);
nui.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nui_VideoFrameReady);
nui.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color);
}
示例13: image1_Loaded
private void image1_Loaded(object sender, RoutedEventArgs e)
{
nui = Runtime.Kinects[0];
nui.Initialize(RuntimeOptions.UseColor | RuntimeOptions.UseDepth);
nui.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nui_VideoFrameReady);
nui.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color);
// nui.DepthFrameReady += new EventHandler<ImageFrameReadyEventArgs>(nui_DepthFrameReady);
// nui.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.Depth);
}
示例14: KinectHandler
protected KinectHandler(bool init)
{
SkeletonDataReady += s => { };
SkeletonReady += s => { };
if (!init) return;
kinectNUI = new Runtime();
kinectNUI.Initialize(RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseColor | RuntimeOptions.UseDepthAndPlayerIndex);
kinectNUI.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color);
kinectNUI.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex);
kinectNUI.SkeletonFrameReady += DataReady;
}
示例15: Kinect
public Kinect()
{
kinect = new Runtime();
//inicializa
kinect.Initialize(RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseColor);
kinect.DepthStream.Open(ImageStreamType.Depth, 2, ImageResolution.Resolution320x240, ImageType.DepthAndPlayerIndex);
kinect.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color);
kinect.SkeletonEngine.TransformSmooth = true;
kinect.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(kinect_SkeletonFrameReady);
}