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


C# CoordinateMapper类代码示例

本文整理汇总了C#中CoordinateMapper的典型用法代码示例。如果您正苦于以下问题:C# CoordinateMapper类的具体用法?C# CoordinateMapper怎么用?C# CoordinateMapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CoordinateMapper类属于命名空间,在下文中一共展示了CoordinateMapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandJointTracker

 public HandJointTracker(CoordinateMapper coordMapper)
 {
     this.coordMapper = coordMapper;
       imageStorage = new byte[height, width, 3];
       gray = new Image<Gray, byte>(width, height);
       scaled = new Image<Gray, byte>(width / 4, height / 4);
 }
开发者ID:ushadow,项目名称:handinput,代码行数:7,代码来源:HandJointTracker.cs

示例2: KinectRecorder

        // Ctr
        public KinectRecorder(KinectRecordOptions options, CoordinateMapper mapper,
        float colorFocalLength, float depthFocalLength, Stream stream)
        {
            Options = options;

              recordStream = stream;
              writer = new BinaryWriter(recordStream);

              var coordParams = mapper.ColorToDepthRelationalParameters;
              int count = coordParams.Count;
              byte[] array = new byte[count];
              coordParams.CopyTo(array, 0);
              writer.Write(count);
              writer.Write(array);
              writer.Write(colorFocalLength);
              writer.Write(depthFocalLength);

              writer.Write((int)Options);

              if ((Options & KinectRecordOptions.Color) != 0) {
            colorRecoder = new ColorRecorder(writer);
              }
              if ((Options & KinectRecordOptions.Depth) != 0) {
            depthRecorder = new DepthRecorder(writer);
              }
              if ((Options & KinectRecordOptions.Skeletons) != 0) {
            skeletonRecorder = new SkeletonRecorder(writer);
              }

              previousFlushDate = DateTime.Now;
        }
开发者ID:ushadow,项目名称:kinect_toolbox,代码行数:32,代码来源:KinectRecorder.cs

示例3: ProcessJoints

        private void ProcessJoints(Skeleton skeleton)
        {
            foreach (var name in Enum.GetNames(typeof(JointType)))
            {
                var jointType = (JointType)Enum.Parse(typeof(JointType), name);

                var coordinateMapper = new CoordinateMapper(_kinectSensor);
                var joint = skeleton.Joints[jointType];

                var skeletonPoint = joint.Position;
                if (joint.TrackingState == JointTrackingState.NotTracked)
                    continue;

                if (jointType == JointType.HandRight)
                    _gestureDetector.Add(joint.Position, _kinectSensor);

                var colorPoint = coordinateMapper.MapSkeletonPointToColorPoint(skeletonPoint, ColorImageFormat.RgbResolution640x480Fps30);
                if (!_ellipses.ContainsKey(jointType))
                {
                    _ellipses[jointType] = new Ellipse { Width = 20, Height = 20, Fill = Brushes.SandyBrown };
                    SkeletonCanvas.Children.Add(_ellipses[jointType]);
                }
                Canvas.SetLeft(_ellipses[jointType], colorPoint.X - _ellipses[jointType].Width / 2);
                Canvas.SetTop(_ellipses[jointType], colorPoint.Y - _ellipses[jointType].Height / 2);
            }
        }
开发者ID:latish,项目名称:Kinect_Demo,代码行数:26,代码来源:MainWindow.Gestures.cs

示例4: SimpleSkeletonHandTracker

 public SimpleSkeletonHandTracker(int width, int height, CoordinateMapper coordMapper,
                              int bufferSize = 1)
 {
     mapper = new CoordinateConverter(coordMapper, HandInputParams.ColorImageFormat,
                                HandInputParams.DepthImageFormat);
       Init(width, height);
 }
开发者ID:ushadow,项目名称:handinput,代码行数:7,代码来源:SimpleSkeletonHandTracker.cs

示例5: SkeletalTracker

 public SkeletalTracker(Rectangle fullscreen, CoordinateMapper coordinateMapper, ColorImageFormat colorFormat)
 {
     _coordinateMapper = coordinateMapper;
     _colorFormat = colorFormat;
     _fullscreen = fullscreen;
     _aspectRatio = _fullscreen.Width / (double)_fullscreen.Height;
 }
开发者ID:NickVanderPyle,项目名称:KinectCamForConference,代码行数:7,代码来源:SkeletalTracker.cs

示例6: RunAsync

		//Run the application async
		static async Task RunAsync()
		{
			//Get the default Kinect Sensor
			_kinectSensor = KinectSensor.GetDefault();

			// open the reader for the body frames
			_bodyFrameReader = _kinectSensor.BodyFrameSource.OpenReader();

			// Set the coordinate Mapper
			_coordinateMapper = _kinectSensor.CoordinateMapper;

			//open the sensor
			_kinectSensor.Open();

			//Check if the Sensor is available
			Console.WriteLine("Kinect sensor is " + (_kinectSensor.IsAvailable ? "available " : "missing. Waiting for sensor: press ctrl + c to abort"));
			while (!_kinectSensor.IsAvailable)
			{
				//wait for sensor
			}
			Console.WriteLine("Kinect sensor is " + (_kinectSensor.IsAvailable ? "available " : "missing. Waiting for sensor: press ctrl + c to abort"));

			//Init gesture
			_handOverHeadDetector = new HandOverHeadDetector(HandDetectionType.BothHands, HandState.Open);
			//Subscribe to completed event
			_handOverHeadDetector.GestureCompleteEvent += HandOverHeadDetectorOnGestureCompleteEvent;

			//Start reciving kinect Frames
			if (_bodyFrameReader != null)
			{
				_bodyFrameReader.FrameArrived += Reader_FrameArrived;
			}
		}
开发者ID:Aniel,项目名称:SimpleKinectGestureExample,代码行数:34,代码来源:Program.cs

示例7: Initialize

        public void Initialize(KinectSensor sensor)
        {
            this.sensor = sensor;
            coordinateMapper = new CoordinateMapper(sensor);

            //Prepare for RGB image information receive
            sensor.ColorStream.Enable(ColorImageFormat.RgbResolution1280x960Fps12);
            imageSize = new Int32Rect(0, 0, sensor.ColorStream.FrameWidth, sensor.ColorStream.FrameHeight);
            stride = imageSize.Width * 4; // blue, green, red, empty
            colorData = new byte[sensor.ColorStream.FramePixelDataLength];
            ColorBitmap = new WriteableBitmap(imageSize.Width, imageSize.Height, 96, 96, PixelFormats.Bgr32, null);

            TransformSmoothParameters smooth = new TransformSmoothParameters()
            {
                Smoothing = Parameters.Kinect.Smoothing,
                Correction = Parameters.Kinect.Correction,
                Prediction = Parameters.Kinect.Prediction,
                JitterRadius = Parameters.Kinect.JitterRadius,
                MaxDeviationRadius = Parameters.Kinect.MaxDeviationRadius
            };
            sensor.SkeletonStream.TrackingMode = Parameters.Kinect.TrackingMode;
            sensor.SkeletonStream.Enable(smooth);

            sensor.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(sensor_SkeletonFrameReady);
            sensor.ColorFrameReady += new EventHandler<ColorImageFrameReadyEventArgs>(sensor_ColorFrameReady);
            sensor.Start();
            Initialized = true;
        }
开发者ID:pentlandfirth,项目名称:PongForKinect,代码行数:28,代码来源:Kinect.cs

示例8: CoordinateConverter

 public CoordinateConverter(IEnumerable<byte> kinectParams, ColorImageFormat cif, 
                     DepthImageFormat dif)
 {
     mapper = new CoordinateMapper(kinectParams);
       this.cif = cif;
       this.dif = dif;
 }
开发者ID:ushadow,项目名称:handinput,代码行数:7,代码来源:CoordinateConverter.cs

示例9: DrawSkeleton

        public static void DrawSkeleton(this Canvas canvas, Body body, CoordinateMapper mapper)
        {
            if (body == null) return;

            foreach (Joint joint in body.Joints.Values)
            {
                canvas.DrawPoint(joint, mapper);
            }

            canvas.DrawLine(body.Joints[JointType.Head], body.Joints[JointType.Neck], mapper);
            canvas.DrawLine(body.Joints[JointType.Neck], body.Joints[JointType.SpineShoulder], mapper);
            canvas.DrawLine(body.Joints[JointType.SpineShoulder], body.Joints[JointType.ShoulderLeft], mapper);
            canvas.DrawLine(body.Joints[JointType.SpineShoulder], body.Joints[JointType.ShoulderRight], mapper);
            canvas.DrawLine(body.Joints[JointType.SpineShoulder], body.Joints[JointType.SpineMid], mapper);
            canvas.DrawLine(body.Joints[JointType.ShoulderLeft], body.Joints[JointType.ElbowLeft], mapper);
            canvas.DrawLine(body.Joints[JointType.ShoulderRight], body.Joints[JointType.ElbowRight], mapper);
            canvas.DrawLine(body.Joints[JointType.ElbowLeft], body.Joints[JointType.WristLeft], mapper);
            canvas.DrawLine(body.Joints[JointType.ElbowRight], body.Joints[JointType.WristRight], mapper);
            canvas.DrawLine(body.Joints[JointType.WristLeft], body.Joints[JointType.HandLeft], mapper);
            canvas.DrawLine(body.Joints[JointType.WristRight], body.Joints[JointType.HandRight], mapper);
            canvas.DrawLine(body.Joints[JointType.HandLeft], body.Joints[JointType.HandTipLeft], mapper);
            canvas.DrawLine(body.Joints[JointType.HandRight], body.Joints[JointType.HandTipRight], mapper);
            canvas.DrawLine(body.Joints[JointType.HandTipLeft], body.Joints[JointType.ThumbLeft], mapper);
            canvas.DrawLine(body.Joints[JointType.HandTipRight], body.Joints[JointType.ThumbRight], mapper);
            canvas.DrawLine(body.Joints[JointType.SpineMid], body.Joints[JointType.SpineBase], mapper);
            canvas.DrawLine(body.Joints[JointType.SpineBase], body.Joints[JointType.HipLeft], mapper);
            canvas.DrawLine(body.Joints[JointType.SpineBase], body.Joints[JointType.HipRight], mapper);
            canvas.DrawLine(body.Joints[JointType.HipLeft], body.Joints[JointType.KneeLeft], mapper);
            canvas.DrawLine(body.Joints[JointType.HipRight], body.Joints[JointType.KneeRight], mapper);
            canvas.DrawLine(body.Joints[JointType.KneeLeft], body.Joints[JointType.AnkleLeft], mapper);
            canvas.DrawLine(body.Joints[JointType.KneeRight], body.Joints[JointType.AnkleRight], mapper);
            canvas.DrawLine(body.Joints[JointType.AnkleLeft], body.Joints[JointType.FootLeft], mapper);
            canvas.DrawLine(body.Joints[JointType.AnkleRight], body.Joints[JointType.FootRight], mapper);
        }
开发者ID:gw-sd-2016,项目名称:Presenting101,代码行数:34,代码来源:Extensions.cs

示例10: GetKinect

        /// <summary>
        /// Starts a new Task and listens to KinectSensors StatusChanged event.
        /// </summary>
        /// <returns>Eventually returns a kinect sensor when one is connected.</returns>
        public static Task<KinectSensor> GetKinect()
        {
            return Task.Factory.StartNew<KinectSensor>(() =>
            {
                if (kinectSensor != null) return kinectSensor;

                var kinect = KinectSensor.KinectSensors.FirstOrDefault(_ => _.Status == KinectStatus.Connected);
                if (kinect != null)
                {
                    kinectSensor = kinect;
                    return kinectSensor;
                }

                using (var signal = new ManualResetEventSlim())
                {
                    KinectSensor.KinectSensors.StatusChanged += (s, e) =>
                    {
                        if (e.Status == KinectStatus.Connected)
                        {
                            kinectSensor = e.Sensor;
                            coordinateMapper = new CoordinateMapper(kinectSensor);
                            signal.Set();
                        }
                    };

                    signal.Wait();
                }

                return kinectSensor;
            });
        }
开发者ID:nicolastinkl,项目名称:FluentKinect,代码行数:35,代码来源:KinectConnector.cs

示例11: Init

 public void Init(
   CoordinateMapper mapper,
   Int32Rect colourFrameSize)
 {
     canvasCoordMapper = new CanvasCoordMapper(canvas,
       mapper, colourFrameSize);
 }
开发者ID:MZASTR,项目名称:Kinect_Application,代码行数:7,代码来源:CanvasBodyDrawer.cs

示例12: KinectBodyView

        /// <summary>
        /// Initializes a new instance of the KinectBodyView class
        /// </summary>
        /// <param name="kinectSensor">Active instance of the KinectSensor</param>
        public KinectBodyView(KinectSensor kinectSensor)
        {
            if (kinectSensor == null)
            {
                throw new ArgumentNullException("kinectSensor");
            }

            // get the coordinate mapper
            _coordinateMapper = kinectSensor.CoordinateMapper;

            // get the depth (display) extents
            FrameDescription frameDescription = kinectSensor.DepthFrameSource.FrameDescription;

            // get size of joint space
            _displayWidth = frameDescription.Width;
            _displayHeight = frameDescription.Height;



            // Create the drawing group we'll use for drawing
            _drawingGroup = new DrawingGroup();

            // Create an image source that we can use in our image control
            _imageSource = new DrawingImage(_drawingGroup);
        }
开发者ID:praveenv4k,项目名称:indriya,代码行数:29,代码来源:KinectBodyView.cs

示例13: BackgroundRemovalTool

 /// <summary>
 /// Creates a new instance of BackgroundRemovalTool.
 /// </summary>
 public BackgroundRemovalTool()
 {
     if (CoordinateMapper == null)
     {
         CoordinateMapper = KinectSensor.GetDefault().CoordinateMapper;
     }
 }
开发者ID:etrigger,项目名称:Vitruvius,代码行数:10,代码来源:BackgroundRemovalTool.cs

示例14: FaceTracker

        /// <summary>
        /// Initializes a new instance of the FaceTracker class from a reference of the Kinect device.
        /// <param name="sensor">Reference to kinect sensor instance</param>
        /// </summary>
        public FaceTracker(KinectSensor sensor)
        {
            if (sensor == null) {
            throw new ArgumentNullException("sensor");
              }

              if (!sensor.ColorStream.IsEnabled) {
            throw new InvalidOperationException("Color stream is not enabled yet.");
              }

              if (!sensor.DepthStream.IsEnabled) {
            throw new InvalidOperationException("Depth stream is not enabled yet.");
              }

              this.operationMode = OperationMode.Kinect;
              this.coordinateMapper = sensor.CoordinateMapper;
              this.initializationColorImageFormat = sensor.ColorStream.Format;
              this.initializationDepthImageFormat = sensor.DepthStream.Format;

              var newColorCameraConfig = new CameraConfig(
              (uint)sensor.ColorStream.FrameWidth,
              (uint)sensor.ColorStream.FrameHeight,
              sensor.ColorStream.NominalFocalLengthInPixels,
              FaceTrackingImageFormat.FTIMAGEFORMAT_UINT8_B8G8R8X8);
              var newDepthCameraConfig = new CameraConfig(
              (uint)sensor.DepthStream.FrameWidth,
              (uint)sensor.DepthStream.FrameHeight,
              sensor.DepthStream.NominalFocalLengthInPixels,
              FaceTrackingImageFormat.FTIMAGEFORMAT_UINT16_D13P3);
              this.Initialize(newColorCameraConfig, newDepthCameraConfig, IntPtr.Zero, IntPtr.Zero, this.DepthToColorCallback);
        }
开发者ID:ushadow,项目名称:handinput,代码行数:35,代码来源:FaceTracker.cs

示例15: Update

        /// <summary>
        /// Update map from a depth frame
        /// </summary>
        /// <param name="coordinateMapper"></param>
        /// <param name="depthFrame"></param>
        public void Update(CoordinateMapper coordinateMapper, DepthFrameData depthFrame)
        {
            if (this.dataPointer == IntPtr.Zero)
                throw new ObjectDisposedException("ColorToDepthFrameData");

            coordinateMapper.MapColorFrameToDepthSpaceUsingIntPtr(depthFrame.DataPointer,(uint)depthFrame.SizeInBytes,this.dataPointer,(uint)this.sizeInBytes);
        }
开发者ID:semihguresci,项目名称:kgp,代码行数:12,代码来源:ColorToDepthFrameData.cs


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