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


C# CoordinateMapper.MapDepthPointToColorPoint方法代码示例

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


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

示例1: GetCameraPoint

        void GetCameraPoint(Skeleton first, AllFramesReadyEventArgs e)
        {
            using (DepthImageFrame depth = e.OpenDepthImageFrame())
            {
                if (depth == null ||
                    kinectSensorChooser1.Kinect == null)
                {
                    return;
                }

                //Map a joint location to a point on the depth map
                //head
                CoordinateMapper mapper = new CoordinateMapper(sensor);

                DepthImagePoint headDepthPoint =
                    mapper.MapSkeletonPointToDepthPoint(first.Joints[JointType.Head].Position, DepthImageFormat.Resolution640x480Fps30);
                //left hand
                DepthImagePoint leftDepthPoint =
                     mapper.MapSkeletonPointToDepthPoint(first.Joints[JointType.HandLeft].Position, DepthImageFormat.Resolution640x480Fps30);
                //right hand
                DepthImagePoint rightDepthPoint =
                     mapper.MapSkeletonPointToDepthPoint(first.Joints[JointType.HandRight].Position, DepthImageFormat.Resolution640x480Fps30);

                //Map a depth point to a point on the color image
                //head
                ColorImagePoint headColorPoint =
                    mapper.MapDepthPointToColorPoint(DepthImageFormat.Resolution640x480Fps30, headDepthPoint, ColorImageFormat.RgbResolution640x480Fps30);
                //left hand
                ColorImagePoint leftColorPoint =
                    mapper.MapDepthPointToColorPoint(DepthImageFormat.Resolution640x480Fps30, leftDepthPoint,
                    ColorImageFormat.RgbResolution640x480Fps30);
                //right hand
                ColorImagePoint rightColorPoint =
                    mapper.MapDepthPointToColorPoint(DepthImageFormat.Resolution640x480Fps30, rightDepthPoint,
                    ColorImageFormat.RgbResolution640x480Fps30);

                SkeletonPoint rightHand = first.Joints[JointType.HandRight].Position;
                SkeletonPoint leftHand = first.Joints[JointType.HandLeft].Position;

                if (isInBoundingBox(rightHand))
                {
                    CameraPosition(rightEllipse, rightColorPoint);
                    RightBlobs.Points.Add(new System.Windows.Point(rightColorPoint.X, rightColorPoint.Y));
                    //drawBlob(rightColorPoint);
                    tuioManager.addPoint(0, new PointF(rightColorPoint.X, rightColorPoint.Y));
                }
                else
                {
                    rightColorPoint.X = 0; rightColorPoint.Y = 0;
                    CameraPosition(rightEllipse, rightColorPoint);
                }

                if (isInBoundingBox(leftHand))
                {
                    CameraPosition(leftEllipse, leftColorPoint);
                    LeftBlobs.Points.Add(new System.Windows.Point(leftColorPoint.X, leftColorPoint.Y));
                    //drawBlob(leftColorPoint);
                    tuioManager.addPoint(1, new PointF(leftColorPoint.X, leftColorPoint.Y));
                }
                else
                {
                    leftColorPoint.X = 0; leftColorPoint.Y = 0;
                    CameraPosition(leftEllipse, leftColorPoint);
                }

                //Console.WriteLine("X " + rightHand.X + "Y " + rightHand.Y + "Z " + rightHand.Z);
                label1.Content = "X " + rightHand.X + "Y " + rightHand.Y + "Z " + rightHand.Z;

            }
        }
开发者ID:pancur,项目名称:KinectDisplay,代码行数:70,代码来源:MainWindow.xaml.cs

示例2: GetCameraPoint

        //DEPTH_END
        void GetCameraPoint(Skeleton first, AllFramesReadyEventArgs e)
        {
            using (DepthImageFrame depth = e.OpenDepthImageFrame())
              {
                  if (depth == null || kinectSensorChooser1.Kinect == null)
                  {
                      return;
                  }
                  CoordinateMapper cm = new CoordinateMapper(kinectSensorChooser1.Kinect);
                  DepthImagePoint headDepthPoint = cm.MapSkeletonPointToDepthPoint(first.Joints[JointType.Head].Position,DepthImageFormat.Resolution640x480Fps30);
                  DepthImagePoint leftDepthPoint = cm.MapSkeletonPointToDepthPoint(first.Joints[JointType.HandLeft].Position, DepthImageFormat.Resolution640x480Fps30);
                  DepthImagePoint rightDepthPoint = cm.MapSkeletonPointToDepthPoint(first.Joints[JointType.HandRight].Position, DepthImageFormat.Resolution640x480Fps30);

                  ColorImagePoint headColorPoint =  cm.MapDepthPointToColorPoint(DepthImageFormat.Resolution640x480Fps30, headDepthPoint, ColorImageFormat.RgbResolution640x480Fps30);
                  ColorImagePoint leftColorPoint = cm.MapDepthPointToColorPoint(DepthImageFormat.Resolution640x480Fps30, leftDepthPoint, ColorImageFormat.RgbResolution640x480Fps30);
                  ColorImagePoint rightColorPoint = cm.MapDepthPointToColorPoint(DepthImageFormat.Resolution640x480Fps30, rightDepthPoint, ColorImageFormat.RgbResolution640x480Fps30);

                //=>  CameraPosition(headImage, headColorPoint);
                //=>  CameraPosition(leftEllipse, leftColorPoint);
                //=>  CameraPosition(rightEllipse, rightColorPoint);
              }
        }
开发者ID:T0xicMatter,项目名称:Kinect-EmguCV,代码行数:23,代码来源:MainWindow.xaml.cs


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