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


C# CoordinateMapper.MapSkeletonPointToColorPoint方法代码示例

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


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

示例1: 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

示例2: Convert

        public static Vector2 Convert(CoordinateMapper mapper, SkeletonPoint position,
                                  Object format = null)
        {
            float width = 0;
              float height = 0;
              float x = 0;
              float y = 0;

              if (format != null) {
            if (format is ColorImageFormat) {
              var colorFormat = (ColorImageFormat)format;
              var colorPoint = mapper.MapSkeletonPointToColorPoint(position, colorFormat);
              x = colorPoint.X;
              y = colorPoint.Y;

              switch (colorFormat) {
            case ColorImageFormat.RawYuvResolution640x480Fps15:
            case ColorImageFormat.RgbResolution640x480Fps30:
            case ColorImageFormat.YuvResolution640x480Fps15:
              width = 640;
              height = 480;
              break;
            case ColorImageFormat.RgbResolution1280x960Fps12:
              width = 1280;
              height = 960;
              break;
              }
            } else if (format is DepthImageFormat) {
              var depthFormat = (DepthImageFormat)format;
              var depthPoint = mapper.MapSkeletonPointToDepthPoint(position, depthFormat);
              x = depthPoint.X;
              y = depthPoint.Y;

              switch (depthFormat) {
            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:ushadow,项目名称:kinect_toolbox,代码行数:55,代码来源:Tools.cs

示例3: DrawJoints

        private void DrawJoints(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;

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

示例4: sensorAllFramesReady

        void sensorAllFramesReady(object sender, AllFramesReadyEventArgs e)
        {
            depthImagePixels = new DepthImagePixel[sensor.DepthStream.FramePixelDataLength];
            using (var frame = e.OpenDepthImageFrame())
            {
                if (frame == null)
                {
                    return;
                }

                frame.CopyDepthImagePixelDataTo(depthImagePixels);
            }

            using (var frame = e.OpenColorImageFrame())
            {
                if (frame == null)
                {
                    return;
                }

                var bitmap = CreateBitmap(frame);
                VideoCanvas.Background = new ImageBrush(bitmap);
            }

            using (var frame = e.OpenSkeletonFrame())
            {
                if (frame == null)
                {
                    return;
                }

                var skeletons = new Skeleton[frame.SkeletonArrayLength];
                frame.CopySkeletonDataTo(skeletons);
                var skeleton = skeletons.FirstOrDefault(sk => sk.TrackingState == SkeletonTrackingState.Tracked);
                if (skeleton == null)
                {
                    return;
                }

                var rigthHandPosition = skeleton.Joints[JointType.HandRight].Position;
                var leftHandPosition = skeleton.Joints[JointType.HandLeft].Position;
                var headPosition = skeleton.Joints[JointType.Head].Position;
                var armsPosition = skeleton.Joints[JointType.ShoulderCenter].Position;
                var shoulderLeftPosition = skeleton.Joints[JointType.ShoulderLeft].Position;
                var shoulderRigthPosition = skeleton.Joints[JointType.ShoulderRight].Position;
                var hipCenterPosition = skeleton.Joints[JointType.HipCenter].Position;

                var mapper = new CoordinateMapper(sensor);

                var rightHandCoord = mapper.MapSkeletonPointToColorPoint(rigthHandPosition, ColorImageFormat.RgbResolution640x480Fps30);
                var headCoord = mapper.MapSkeletonPointToColorPoint(headPosition, ColorImageFormat.RgbResolution640x480Fps30);
                var armsCenterCoord = mapper.MapSkeletonPointToColorPoint(armsPosition, ColorImageFormat.RgbResolution640x480Fps30);
                var shoulderLeftCoord = mapper.MapSkeletonPointToColorPoint(shoulderLeftPosition, ColorImageFormat.RgbResolution640x480Fps30);
                var shoulderRightCoord = mapper.MapSkeletonPointToColorPoint(shoulderRigthPosition, ColorImageFormat.RgbResolution640x480Fps30);
                var leftHandCoord = mapper.MapSkeletonPointToColorPoint(leftHandPosition, ColorImageFormat.RgbResolution640x480Fps30);
                var hipCenterCoord = mapper.MapSkeletonPointToColorPoint(hipCenterPosition, ColorImageFormat.RgbResolution640x480Fps30);

                this.DetectGestures(headCoord, rightHandCoord, leftHandCoord, armsCenterCoord, shoulderLeftCoord, shoulderRightCoord, hipCenterCoord);
            }
        }
开发者ID:VyaraGGeorgieva,项目名称:TelerikAcademy,代码行数:60,代码来源:MainWindow.xaml.cs

示例5: getDataPointRelativeToBody

        private KinectDataPoint getDataPointRelativeToBody(JointCollection joints,
            JointType joint, CoordinateMapper coordinateMapper)
        {
            ColorImagePoint colorPoint = coordinateMapper.MapSkeletonPointToColorPoint(
                joints[joint].Position, ColorImageFormat.RgbResolution640x480Fps30);

            return new KinectDataPoint(colorPoint, joints[joint].Position, joints[JointType.ShoulderCenter].Position);
        }
开发者ID:philiWeitz,项目名称:InteractionTechniques,代码行数:8,代码来源:SkeletonServiceImpl.cs

示例6: getDisplayPosition

 /// <summary>
 /// Map Joint Position to ColorImagePoint 
 /// </summary>
 /// <param name="joint"></param>
 /// <returns></returns>
 private Point getDisplayPosition(Joint joint)
 {
     CoordinateMapper mapper = new CoordinateMapper(this.SensorPlus.Sensor);
     ColorImagePoint point = mapper.MapSkeletonPointToColorPoint(joint.Position, this.SensorPlus.Sensor.ColorStream.Format);
     return new Point(point.X, point.Y);
 }
开发者ID:jiliyutou,项目名称:Kinect.Joy,代码行数:11,代码来源:CameraView.xaml.cs

示例7: ToColorSpace

        public OpenTK.Vector3[] ToColorSpace(CoordinateMapper mapper, IEnumerable<DepthImagePoint> points, DepthImageFormat format, float zTune = 1)
        {
            var sps = points.Select(p => mapper.MapDepthPointToSkeletonPoint(format, p)).ToArray();
            var dist = sps.Select(p => mapper.MapSkeletonPointToColorPoint(p, ColorImageFormat.RgbResolution1280x960Fps12))
                .Select(cp => new PointF((1280 - cp.X), cp.Y)).ToArray();

            return StereoCalibration.Undistort(calib, dist).Zip(sps, (p, s) => new OpenTK.Vector3(p.X * s.Z * zTune, p.Y * s.Z * zTune, s.Z * zTune)).ToArray();
        }
开发者ID:virrkharia,项目名称:dynamight,代码行数:8,代码来源:KinectCalibrator.cs

示例8: MapToColor

 public static ColorImagePoint MapToColor(this SkeletonPoint skeletonPoint, CoordinateMapper mapper, ColorImageFormat format = ColorImageFormat.RgbResolution640x480Fps30)
 {
     return mapper.MapSkeletonPointToColorPoint(skeletonPoint, format);
 }
开发者ID:nicolastinkl,项目名称:FluentKinect,代码行数:4,代码来源:SkeletonPointExtensions.cs

示例9: storeframe

        //public void initialstore(ReplaySkeletonFrame frame, int framenumber)


        public void storeframe(ReplaySkeletonFrame frame, int framenumber, CoordinateMapper replayCoordinateMapper)
        {
            //int framenumber;
            double leftShoulderAngle, leftHipAngle, leftKneeAngle, headHeight;
            double headX, headY, leftHandX, leftHandY, rightHandX, rightHandY;
            double leftshoulderX, leftshoulderY, rightshoulderX, rightshoulderY;
            double hipX, hipY, leftKneeX, leftKneeY, rightKneeX, rightKneeY;
            double leftFootX, leftFootY, rightFootX, rightFootY;

            //side view

            double headYabs, headZabs, leftHandYabs, leftHandZabs;
            double leftshoulderYabs, leftshoulderZabs, hipYabs, hipZabs;
            double leftKneeYabs, leftKneeZabs, leftFootYabs, leftFootZabs;



            if (isStartingFrame == true)
            {
                initialFrameNumber = framenumber;
                System.Console.WriteLine("initialFrame = " + initialFrameNumber);
                isStartingFrame = false;

            }

            if (frame == null)
            {
                //currentFrameNumber = framenumber - initialFrameNumber;
                leftShoulderAngle = 999;
                leftHipAngle = 999;
                leftKneeAngle = 999;
                headHeight = 999;
                headX = 999;
                headY = 999;
                leftHandX = 999;
                leftHandY = 999;
                rightHandX = 999;
                rightHandY = 999;
                leftshoulderX = 999;
                leftshoulderY = 999;
                rightshoulderX = 999;
                rightshoulderY = 999;
                hipX = 999;
                hipY = 999;
                leftKneeX = 999; 
                leftKneeY = 999;
                rightKneeX = 999;
                rightKneeY = 999;
                leftFootX = 999;
                leftFootY = 999;
                rightFootX = 999;
                rightFootY = 999;

                //side view
                headYabs = 999;
                headZabs = 999;
                leftHandYabs = 999;
                leftHandZabs = 999;
                leftshoulderYabs = 999;
                leftshoulderZabs = 999;
                hipYabs = 999;
                hipZabs = 999;
                leftKneeYabs = 999;
                leftKneeZabs = 999;
                leftFootYabs = 999;
                leftFootZabs = 999;
                

                //currentFrameNumber++;
            }

            else
            {


                var trackedSkeleton = frame.Skeletons.FirstOrDefault(a => a.TrackingState == SkeletonTrackingState.Tracked);
                //IMPORTATNT: 23 occurences frame here for deadlift1.replay
                if (trackedSkeleton == null)
                    return;

                //set starting frame of the video to index 1
                //framenumber = frame.FrameNumber - initialFrameNumber + 1;
                //currentFrameNumber = framenumber;
                leftShoulderAngle = JointAngle(trackedSkeleton.Joints[JointType.ShoulderLeft], trackedSkeleton.Joints[JointType.WristLeft], trackedSkeleton.Joints[JointType.HipLeft]);
                leftHipAngle = JointAngle(trackedSkeleton.Joints[JointType.HipLeft], trackedSkeleton.Joints[JointType.ShoulderLeft], trackedSkeleton.Joints[JointType.KneeLeft]);
                leftKneeAngle = JointAngle(trackedSkeleton.Joints[JointType.KneeLeft], trackedSkeleton.Joints[JointType.FootLeft], trackedSkeleton.Joints[JointType.HipLeft]);
                headHeight = trackedSkeleton.Joints[JointType.Head].Position.Y;
                //frontal view
                headX = replayCoordinateMapper.MapSkeletonPointToColorPoint(trackedSkeleton.Joints[JointType.Head].Position, ColorImageFormat.RgbResolution640x480Fps30).X;
                headY = replayCoordinateMapper.MapSkeletonPointToColorPoint(trackedSkeleton.Joints[JointType.Head].Position, ColorImageFormat.RgbResolution640x480Fps30).Y;
                leftHandX = replayCoordinateMapper.MapSkeletonPointToColorPoint(trackedSkeleton.Joints[JointType.HandLeft].Position, ColorImageFormat.RgbResolution640x480Fps30).X;
                leftHandY = replayCoordinateMapper.MapSkeletonPointToColorPoint(trackedSkeleton.Joints[JointType.HandLeft].Position, ColorImageFormat.RgbResolution640x480Fps30).Y;
                rightHandX = replayCoordinateMapper.MapSkeletonPointToColorPoint(trackedSkeleton.Joints[JointType.HandRight].Position, ColorImageFormat.RgbResolution640x480Fps30).X;
                rightHandY = replayCoordinateMapper.MapSkeletonPointToColorPoint(trackedSkeleton.Joints[JointType.HandRight].Position, ColorImageFormat.RgbResolution640x480Fps30).Y;
                leftshoulderX = replayCoordinateMapper.MapSkeletonPointToColorPoint(trackedSkeleton.Joints[JointType.ShoulderLeft].Position, ColorImageFormat.RgbResolution640x480Fps30).X;
                leftshoulderY = replayCoordinateMapper.MapSkeletonPointToColorPoint(trackedSkeleton.Joints[JointType.ShoulderLeft].Position, ColorImageFormat.RgbResolution640x480Fps30).Y;
                rightshoulderX = replayCoordinateMapper.MapSkeletonPointToColorPoint(trackedSkeleton.Joints[JointType.ShoulderRight].Position, ColorImageFormat.RgbResolution640x480Fps30).X;
//.........这里部分代码省略.........
开发者ID:soudazhou,项目名称:Kinect-Analysis-Tool-for-Barbell-Weightlifting,代码行数:101,代码来源:XMLWriter.cs

示例10: Map2DJoints

 protected void Map2DJoints(Skeleton sk, CoordinateMapper mapper) {
   if (null == sk) { return;  }
   foreach (Joint jt in sk.Joints) {
     var pts   = mapper.MapSkeletonPointToColorPoint(jt.Position, ColorFormat);
     Joints2D[jt.JointType] = new System.Drawing.Point(pts.X, pts.Y);
   }
 }
开发者ID:BubuLeMag,项目名称:WSRMacro,代码行数:7,代码来源:WSRKinectSensor.cs

示例11: GetDisplayPositionVGA

        /// <summary>
        /// Returns the position of a 3D vector on a 2D surface in VGA space
        /// </summary>
        /// <param name="j">current instance</param>
        /// <param name="nui">NUI Runtime</param>
        /// <param name="panel">The image which to project the vector on</param>
        /// <returns>2D position</returns>
        public static Point GetDisplayPositionVGA(this NUIVector j, KinectSensor nui, Canvas panel)
        {
            CoordinateMapper cm = new CoordinateMapper(nui);
            ColorImagePoint cip = cm.MapSkeletonPointToColorPoint(j, nui.ColorStream.Format);
            //nui.SkeletonStream.SkeletonToDepthImage(j, out depthX, out depthY, out depthValue);
            int colorX = cip.X;
            int colorY = cip.Y;

            return new Point((int)(colorX * panel.ActualWidth / 640), (int)(colorY * panel.ActualHeight / 480));
        }
开发者ID:pi11e,项目名称:KinectHTML5,代码行数:17,代码来源:Extensions.cs


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