• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CoordinateMapper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: BodyDrawer

 public BodyDrawer(CoordinateMapper coordinateMapper, FrameDescription frameDescription, DrawingGroup drawingGroup)
 {
     this.bonesToDraw = (new BodyInitializer()).GetBones();
     this.coordinateMapper = coordinateMapper;
     this.displayHeight = frameDescription.Height;
     this.displayWidth = frameDescription.Width;
     this.drawingGroup = drawingGroup;
 }
开发者ID:rachelriv,项目名称:Instrumovement,代码行数:8,代码来源:Drawer.cs


示例17: KinectSkeletonDrawer

        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="kinect"></param>
        /// <param name="canvas"></param>
        public KinectSkeletonDrawer( KinectSensor kinect, Canvas canvas )
        {
            this.kinect = kinect;
            this.mapper = kinect.CoordinateMapper;
            this.canvas = canvas;

            SkeletonConvert = Skeleton2DPoint.Depth;
        }
开发者ID:NaturalSoftwareJP,项目名称:NaturalSoftware.Kinect.CSharp,代码行数:13,代码来源:KinectSkeletonDrawer.cs


示例18: HandSliderControl

 public HandSliderControl(HandDetectionType handDetectionType, HandState requirredHandState,
     Directions direction, CoordinateMapper mapper)
     : base(handDetectionType, requirredHandState)
 {
     SmoothLevel = 0;
     Direction = direction;
     _mapper = mapper;
 }
开发者ID:Aniel,项目名称:SimpleKinectGesture,代码行数:8,代码来源:HandSliderControl.cs


示例19: Convert

        /// <summary>
        /// Maps a 3D skeleton point to a 2D vector.
        /// </summary>
        /// <param name="sensor">The Kinect sensor.</param>
        /// <param name="position">The skeleton point to map.</param>
        /// <param name="coordinateMapper">The coordinate mapper.</param>
        /// <returns>The 2D mapped position.</returns>
        public static Vector2 Convert(KinectSensor sensor, SkeletonPoint position, CoordinateMapper coordinateMapper)
        {
            float width = 0;
            float height = 0;
            float x = 0;
            float y = 0;

            if (sensor.ColorStream.IsEnabled)
            {
                var colorPoint = coordinateMapper.MapSkeletonPointToColorPoint(position, sensor.ColorStream.Format);
                x = colorPoint.X;
                y = colorPoint.Y;

                switch (sensor.ColorStream.Format)
                {
                    case ColorImageFormat.RawYuvResolution640x480Fps15:
                    case ColorImageFormat.RgbResolution640x480Fps30:
                    case ColorImageFormat.YuvResolution640x480Fps15:
                        width = 640;
                        height = 480;
                        break;
                    case ColorImageFormat.RgbResolution1280x960Fps12:
                        width = 1280;
                        height = 960;
                        break;
                }
            }
            else if (sensor.DepthStream.IsEnabled)
            {
                var depthPoint = coordinateMapper.MapSkeletonPointToDepthPoint(position, sensor.DepthStream.Format);
                x = depthPoint.X;
                y = depthPoint.Y;

                switch (sensor.DepthStream.Format)
                {
                    case DepthImageFormat.Resolution80x60Fps30:
                        width = 80;
                        height = 60;
                        break;
                    case DepthImageFormat.Resolution320x240Fps30:
                        width = 320;
                        height = 240;
                        break;
                    case DepthImageFormat.Resolution640x480Fps30:
                        width = 640;
                        height = 480;
                        break;
                }
            }
            else
            {
                width = 1;
                height = 1;
            }

            return new Vector2(x / width, y / height);
        }
开发者ID:K-Cully,项目名称:SticKart,代码行数:64,代码来源:Tools.cs


示例20: CanvasCoordMapper

 public CanvasCoordMapper(
   Canvas canvas,
   CoordinateMapper mapper,
   Int32Rect colourFrameSize)
 {
     this.canvas = canvas;
     this.mapper = mapper;
     this.colourFrameSize = colourFrameSize;
 }
开发者ID:MZASTR,项目名称:Kinect_Application,代码行数:9,代码来源:CanvasCoordMapper.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CoordinateSystem类代码示例发布时间:2022-05-24
下一篇:
C# Coordinate类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap