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


C# CameraSpacePoint.ElementAt方法代码示例

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


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

示例1: Reader_MultiSourceFrameArrived

        void Reader_MultiSourceFrameArrived(object sender, MultiSourceFrameArrivedEventArgs e)
        {
            var reference = e.FrameReference.AcquireFrame();

            // Color
            using (var frame = reference.ColorFrameReference.AcquireFrame())
            {
                if (frame != null)
                {
                    
                    if (_mode == CameraMode.Color)
                    {
                        camera.Source = frame.ToBitmap();
                    }
                }
            }
            var col_frame = reference.ColorFrameReference.AcquireFrame();
            CameraSpacePoint[] camerapoints = null;
            FrameDescription colorFrameDes = col_frame.FrameDescription;
            int colorWidth = colorFrameDes.Width;
            int colorHeight = colorFrameDes.Height;
            camerapoints = new CameraSpacePoint[colorWidth * colorHeight];


            // Depth
            using (var frame = reference.DepthFrameReference.AcquireFrame())
            {
                if (frame != null)
                {
                    if (_mode == CameraMode.Depth)
                    {
                        Console.Write("In the depth control.");
                        
                        //camera.Source = frame.ToBitmap();
                        FrameDescription depth_des = frame.FrameDescription;
                        int depth_height = depth_des.Height;
                        int depth_Width = depth_des.Width;
                        UInt16[] depthdata = new UInt16[depth_Width * depth_height];
                        frame.CopyFrameDataToArray(depthdata);
                        
                        for (int i = 1; i <= 100;i++ )
                        {

                            Console.Write(depthdata[i]);
                            Console.Write("\n");

                        }

                        _sensor.CoordinateMapper.MapColorFrameToCameraSpace(depthdata, camerapoints);
                        CameraSpacePoint testpoint = new CameraSpacePoint();
                        testpoint = camerapoints.ElementAt(3);
                        Console.WriteLine(testpoint.X);
                        //Console.Write(abc);
                    }
                }
            }

            // Body
            using (var frame = reference.BodyFrameReference.AcquireFrame())
            {
                if (frame != null)
                {
                    canvas.Children.Clear();

                    _bodies = new Body[frame.BodyFrameSource.BodyCount];

                    frame.GetAndRefreshBodyData(_bodies);

                    foreach (var body in _bodies)
                    {
                        if (body.IsTracked)
                        {
                            // COORDINATE MAPPING
                            foreach (Joint joint in body.Joints.Values)
                            {
                                if (joint.TrackingState == TrackingState.Tracked)
                                {
                                    // 3D space point
                                    CameraSpacePoint jointPosition = joint.Position;

                                    // 2D space point
                                    Point point = new Point();

                                    if (_mode == CameraMode.Color)
                                    {
                                        ColorSpacePoint colorPoint = _sensor.CoordinateMapper.MapCameraPointToColorSpace(jointPosition);

                                        point.X = float.IsInfinity(colorPoint.X) ? 0 : colorPoint.X;
                                        point.Y = float.IsInfinity(colorPoint.Y) ? 0 : colorPoint.Y;
                                    }
                                    else if (_mode == CameraMode.Depth || _mode == CameraMode.Infrared) // Change the Image and Canvas dimensions to 512x424
                                    {
                                        DepthSpacePoint depthPoint = _sensor.CoordinateMapper.MapCameraPointToDepthSpace(jointPosition);

                                        point.X = float.IsInfinity(depthPoint.X) ? 0 : depthPoint.X;
                                        point.Y = float.IsInfinity(depthPoint.Y) ? 0 : depthPoint.Y;
                                    }

                                    // Draw
                                    Ellipse ellipse = new Ellipse
//.........这里部分代码省略.........
开发者ID:awais045,项目名称:kinect-1,代码行数:101,代码来源:MainWindow.xaml.cs


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