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


C# CoordinateMapper.MapCameraPointToColorSpace方法代码示例

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


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

示例1: ColorSpaceKinectJoints

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="body">Kinect body</param>
        /// <param name="coordinateMapper">Coordinate mapper</param>
        public ColorSpaceKinectJoints(KinectBody body, CoordinateMapper coordinateMapper)
        {
            if (body == null)
                throw new ArgumentNullException("body");
            if (coordinateMapper == null)
                throw new ArgumentNullException("coordinateMapper");

            this.jointPositions = new Dictionary<JointType,ColorSpacePoint>();

            foreach (Joint joint in body.Joints.Values)
            {
                this.jointPositions.Add(joint.JointType, coordinateMapper.MapCameraPointToColorSpace(joint.Position));
            }
        }
开发者ID:semihguresci,项目名称:kgp,代码行数:19,代码来源:ColorSpaceKinectJoints.cs

示例2: Scale

        public static Point Scale(this Joint joint, CoordinateMapper mapper)
        {
            Point point = new Point();

            ColorSpacePoint colorPoint = mapper.MapCameraPointToColorSpace(joint.Position);
            point.X = float.IsInfinity(colorPoint.X) ? 0.0 : colorPoint.X;
            point.Y = float.IsInfinity(colorPoint.Y) ? 0.0 : colorPoint.Y;

            return point;
        }
开发者ID:Caribpa,项目名称:NPI---Kinect-2.0,代码行数:10,代码来源:Extensions.cs

示例3: ToPoint

        /// <summary>
        /// Converts the specified CameraSpacePoint into a 2-D point.
        /// </summary>
        /// <param name="position">The CameraSpacePoint to convert.</param>
        /// <param name="visualization">The type of the conversion (color, depth, or infrared).</param>
        /// <param name="coordinateMapper">The CoordinateMapper to make the conversion.</param>
        /// <returns>The corresponding 2-D point.</returns>
        public static Point ToPoint(this CameraSpacePoint position, Visualization visualization, CoordinateMapper coordinateMapper)
        {
            Point point = new Point();

            switch (visualization)
            {
                case Visualization.Color:
                    {
                        ColorSpacePoint colorPoint = coordinateMapper.MapCameraPointToColorSpace(position);
                        point.X = float.IsInfinity(colorPoint.X) ? 0.0 : colorPoint.X;
                        point.Y = float.IsInfinity(colorPoint.Y) ? 0.0 : colorPoint.Y;
                    }
                    break;
                case Visualization.Depth:
                case Visualization.Infrared:
                    {
                        DepthSpacePoint depthPoint = coordinateMapper.MapCameraPointToDepthSpace(position);
                        point.X = float.IsInfinity(depthPoint.X) ? 0.0 : depthPoint.X;
                        point.Y = float.IsInfinity(depthPoint.Y) ? 0.0 : depthPoint.Y;
                    }
                    break;
                default:
                    break;
            }

            return point;
        }
开发者ID:reeonce,项目名称:Vitruvius,代码行数:34,代码来源:MathExtensions.cs

示例4: DrawBone

        internal static void DrawBone(DrawingContext drawingContext, System.Windows.Media.Brush brush, JointType startJoint, JointType endJoint, IReadOnlyDictionary<JointType, Joint> joints, System.Windows.Rect rect, CoordinateMapper coordinateMapper, bool useDepthSpace = true, double line = 0.8F)
        {
            if (joints[startJoint].TrackingState != TrackingState.Tracked
                && joints[endJoint].TrackingState != TrackingState.Tracked)
            {
                return;
            }

            System.Windows.Point startPoint;
            System.Windows.Point endPoint;

            if (useDepthSpace)
            {
                startPoint = coordinateMapper.MapCameraPointToDepthSpace(joints[startJoint].Position).GetPoint();
                endPoint = coordinateMapper.MapCameraPointToDepthSpace(joints[endJoint].Position).GetPoint();
            }
            else
            {
                startPoint = coordinateMapper.MapCameraPointToColorSpace(joints[startJoint].Position).GetPoint();
                endPoint = coordinateMapper.MapCameraPointToColorSpace(joints[endJoint].Position).GetPoint();
            }

            if (rect.Contains(startPoint) && rect.Contains(endPoint))
                drawingContext.DrawLine(new System.Windows.Media.Pen(brush, line), startPoint, endPoint);
        }
开发者ID:andreasassetti,项目名称:Kinect-v2-Visual-Studio-Visualizer,代码行数:25,代码来源:ExtensionMethodsBodyFrame.cs

示例5: MainWindow

        /// <summary>
        /// Initializes a new instance of the MainWindow class.
        /// </summary>
        public MainWindow()
        {
            //Depth pixe> FILE
            string winDir = System.Environment.GetEnvironmentVariable("windir");

            writer.WriteLine("START");

            // get the kinectSensor object
            this.kinectSensor = KinectSensor.GetDefault();

            // get the coordinate mapper
            coordinateMapper = this.kinectSensor.CoordinateMapper;

            // open the reader for the depth frames
            this.depthFrameReader = this.kinectSensor.DepthFrameSource.OpenReader();

            this.bodyFrameReader = this.kinectSensor.BodyFrameSource.OpenReader();

            // wire handler for frame arrival
            this.depthFrameReader.FrameArrived += this.Depth_Reader_FrameArrived;

            if (this.bodyFrameReader != null)
            {
                Console.Write("yO");
                this.bodyFrameReader.FrameArrived += this.Body_Reader_FrameArrived;
            }

            // get FrameDescription from DepthFrameSource
            this.depthFrameDescription = this.kinectSensor.DepthFrameSource.FrameDescription;
            // get size of joint space
            this.displayWidth = depthFrameDescription.Width;
            this.displayHeight = depthFrameDescription.Height;

            // open the reader for the body frames
            this.bodyFrameReader = this.kinectSensor.BodyFrameSource.OpenReader();

            // allocate space to put the pixels being received and converted
            this.depthPixels = new byte[this.depthFrameDescription.Width * this.depthFrameDescription.Height];
            this.hist = new int[this.depthPixels.Length];
            // create the bitmap to display
            this.depthBitmap = new WriteableBitmap(this.depthFrameDescription.Width, this.depthFrameDescription.Height, 96.0, 96.0, PixelFormats.Gray8, null);

            // set IsAvailableChanged event notifier
            this.kinectSensor.IsAvailableChanged += this.Sensor_IsAvailableChanged;

            // open the sensor
            this.kinectSensor.Open();

            // set the status text
            this.StatusText = this.kinectSensor.IsAvailable ? Properties.Resources.RunningStatusText
            : Properties.Resources.NoSensorStatusText;

            // use the window object as the view model in this simple example
            this.DataContext = this;

            this.ctr = 0;
            this.handpoint = coordinateMapper.MapCameraPointToColorSpace(lefthandpoint);
            this.lefthandpoint = this.lefthand.Position;

            // initialize the components (controls) of the window
            this.InitializeComponent();
        }
开发者ID:abhirajD,项目名称:HGR-AugmentedReality_Kinect,代码行数:65,代码来源:MainWindow.xaml.cs

示例6: TranslatePoint

 /// <summary>
 /// Translates between kinect and drawing points
 /// </summary>
 private System.Drawing.Point TranslatePoint(CameraSpacePoint point, CoordinateMapper mapper)
 {
     var colorPoint = mapper.MapCameraPointToColorSpace(point);
     return new System.Drawing.Point((int)colorPoint.X, (int)colorPoint.Y);
 }
开发者ID:renato127,项目名称:Sacknet.KinectFacialRecognition,代码行数:8,代码来源:KinectFaceTrackingResult.cs

示例7: ProjectCameraPoint

 /// <summary>
 /// Project the camera space point using the given sensor coordinate mapper.
 /// </summary>
 /// <param name="inPoint"></param>
 /// <param name="coordinateMapper"></param>
 /// <returns></returns>
 public Point ProjectCameraPoint(CameraSpacePoint inPoint, CoordinateMapper coordinateMapper)
 {
     if (_useDepthMapper)
     {
         DepthSpacePoint depthPoint = coordinateMapper.MapCameraPointToDepthSpace(inPoint);
         return new Point(depthPoint.X, depthPoint.Y);
     }
     else
     {
         ColorSpacePoint colorPoint = coordinateMapper.MapCameraPointToColorSpace(inPoint);
         return new Point(colorPoint.X, colorPoint.Y);
     }
 }
开发者ID:shirshmx,项目名称:Monocle-Record-Rssdk,代码行数:19,代码来源:ProjectionMode.cs

示例8: DrawAxis

        //--------------------------------------------------------------------------------------
        //Helper functions for imaging and debuging
        //--------------------------------------------------------------------------------------

        public void DrawAxis(CoordinateMapper coordinateMapper, DrawingContext drawingContext)
        {
            Matrix3D t = RightPHIZTransform();
            ColorSpacePoint p = coordinateMapper.MapCameraPointToColorSpace(PHIZTracker.ToVectorCS(GetOffset(t)));
            ColorSpacePoint px = coordinateMapper.MapCameraPointToColorSpace(ToVectorCS(Vector3D.Add(GetOffset(t),
                Vector3D.Multiply(.5,GetAxisDir(new Vector3D(1, 0, 0), t)))));
            ColorSpacePoint py = coordinateMapper.MapCameraPointToColorSpace(ToVectorCS(Vector3D.Add(GetOffset(t),
                Vector3D.Multiply(.5, GetAxisDir(new Vector3D(0, 1, 0), t)))));
            ColorSpacePoint pz = coordinateMapper.MapCameraPointToColorSpace(ToVectorCS(Vector3D.Add(GetOffset(t),
                Vector3D.Multiply(.5, GetAxisDir(new Vector3D(0, 0, 1), t)))));

            drawingContext.DrawEllipse(Brushes.Aqua, null, new Point(p.X, p.Y), 30, 30);
            drawingContext.DrawLine(new Pen(Brushes.Red, 15), new Point(p.X, p.Y), new Point(px.X, px.Y));
            drawingContext.DrawLine(new Pen(Brushes.Green, 15), new Point(p.X, p.Y), new Point(py.X, py.Y));
            drawingContext.DrawLine(new Pen(Brushes.Blue, 15), new Point(p.X, p.Y), new Point(pz.X, pz.Y));
        }
开发者ID:njpanzarino,项目名称:Kinect,代码行数:20,代码来源:PHIZTracker.cs


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