当前位置: 首页>>代码示例>>C#>>正文


C# Runtime.Initialize方法代码示例

本文整理汇总了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;
            }
        }
开发者ID:NashDotNet,项目名称:Intro-to-Developing-for-the-Kinect,代码行数:32,代码来源:MainWindow.xaml.cs

示例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)
            {
            }
        }
开发者ID:ProjPossibility,项目名称:USC-AccessibleKinect,代码行数:25,代码来源:Mover.cs

示例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;

            }
        }
开发者ID:guozanhua,项目名称:kinect-earth,代码行数:30,代码来源:MainWindow.xaml.cs

示例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);
            }
              }
        }
开发者ID:felixpp,项目名称:KinectTester,代码行数:30,代码来源:KinectTesterForm.cs

示例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();
        }
开发者ID:ProjPossibility,项目名称:USC-AccessibleKinect,代码行数:30,代码来源:MainWindow.xaml.cs

示例6: Main

    public static void Main(string[] args)
    {
        var runtime = new Runtime();
        runtime.Initialize(RuntimeOptions.UseSkeletalTracking);

        var observer = runtime.SkeletonFrameReadyAsObservable();
    }
开发者ID:zoetrope,项目名称:ReactiveRTM,代码行数:7,代码来源:Program.cs

示例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);
 }
开发者ID:ewencluley,项目名称:KinectTest1,代码行数:8,代码来源:KinectBACKUP.cs

示例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);
 }
开发者ID:thefoofighter,项目名称:KinectTest,代码行数:8,代码来源:LoadKinect.cs

示例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 );
 }
开发者ID:kaorun55,项目名称:windows_phone_hackathon,代码行数:8,代码来源:MainWindow.xaml.cs

示例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 );
        }
开发者ID:sadmb,项目名称:kinect_sdk_sandbox,代码行数:10,代码来源:Form1_CameraImage.cs

示例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 );
        }
开发者ID:sadmb,项目名称:kinect_sdk_sandbox,代码行数:11,代码来源:Form1_Depth.cs

示例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);
        }
开发者ID:jonathan-w,项目名称:Gesture-Detector,代码行数:23,代码来源:RGBCamera.cs

示例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);
        }
开发者ID:Neamar,项目名称:MotionChallenge,代码行数:11,代码来源:MainWindow.xaml.cs

示例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;
        }
开发者ID:smanoharan,项目名称:314Kinect,代码行数:12,代码来源:KinectHandler.cs

示例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);
        }
开发者ID:lordviktor,项目名称:Pong-with-Kinect,代码行数:13,代码来源:Kinect.cs


注:本文中的Runtime.Initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。