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


C# CameraSpacePoint.Count方法代码示例

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


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

示例1: calculateProject

        public static void calculateProject( CoordinateMapper coordinateMapper, String outputFilename)
        {
            CameraSpacePoint[] spacePointBasics = new CameraSpacePoint[] {
                new CameraSpacePoint { X = -0.1f, Y = 0.0f, Z = 1.0f },
                new CameraSpacePoint { X = -0.7f, Y = 0.0f, Z = 1.0f },
                new CameraSpacePoint { X = 0.0f, Y = -0.1f, Z = 1.0f },
                new CameraSpacePoint { X = 0.0f, Y = -0.7f, Z = 1.0f },
                new CameraSpacePoint { X = 0.7f, Y = 0.0f, Z = 1.0f },
                new CameraSpacePoint { X = 0.35f, Y = 0.0f, Z = 1.0f },
                new CameraSpacePoint { X = 0.0f, Y = 0.3f, Z = 1.0f },
                new CameraSpacePoint { X = 0.0f, Y = 0.0f, Z = 1.0f },

                //Skeleton_Joint_Locations 0.51399,0.163888,1.20627,0.494376,0.362051,1.19127
                new CameraSpacePoint { X = 0.51399f, Y = 0.163888f, Z = 1.20627f },
                new CameraSpacePoint { X = 0.494376f, Y = 0.362051f, Z = 1.19127f },

                //Skeleton_Joint_Locations_Orig 0.534418,-0.159339,1.38631,0.523629,0.0243074,1.30818 
                new CameraSpacePoint { X = 0.534418f, Y = -0.159339f, Z = 1.38631f },
                new CameraSpacePoint { X = 0.523629f, Y = 0.0243074f, Z = 1.30818f }, };

            DepthSpacePoint[] spaceBasicToDepth = new DepthSpacePoint[spacePointBasics.Count()];

            coordinateMapper.MapCameraPointsToDepthSpace(spacePointBasics, spaceBasicToDepth);

            ColorSpacePoint[] spaceBasicToColor = new ColorSpacePoint[spacePointBasics.Count()];

            coordinateMapper.MapCameraPointsToColorSpace(spacePointBasics, spaceBasicToColor);

            ColorSpacePoint[] spaceBasicToDepthToColor = new ColorSpacePoint[spacePointBasics.Count()];

            coordinateMapper.MapDepthPointsToColorSpace(spaceBasicToDepth, Enumerable.Repeat((ushort)1000, spacePointBasics.Count()).ToArray(), spaceBasicToDepthToColor);

            Console.WriteLine("Camera space points to depth space points");
            foreach (var t in spaceBasicToDepth)
            {
                Console.WriteLine(t.ToSString());
            }


            Console.WriteLine("Camera space points to color space points");
            foreach (var t in spaceBasicToColor)
            {
                Console.WriteLine(t.ToSString());
            }
            Console.WriteLine("Camera space points to depth space points then to color space points");
            foreach (var t in spaceBasicToDepthToColor)
            {
                Console.WriteLine(t.ToSString());
            }

            DepthSpacePoint[] depthBasics = new DepthSpacePoint[]
            {
                new DepthSpacePoint() {  X = 0.0f, Y = 30.0f },
                new DepthSpacePoint() {  X = 0.0f, Y = 380.0f },
                new DepthSpacePoint() {  X = 511.0f, Y = 30.0f },
                new DepthSpacePoint() {  X = 511.0f, Y = 380.0f },
                new DepthSpacePoint() {  X = 262.7343f, Y = 203.6235f }, // Center of origin
            };

            int noOfPoints = depthBasics.Count();
            ColorSpacePoint[] depthBasicToColor = new ColorSpacePoint[noOfPoints];
            CameraSpacePoint[] depthBasicToCamera = new CameraSpacePoint[noOfPoints];

            // Depth used for depth field are the same as z-axis
            // Not the distance from IR sensor to the point
            ushort[] distances = new ushort[] { 1, 10, 100, 1000, 2000, 40000 };
            foreach (var distance in distances)
            {
                coordinateMapper.MapDepthPointsToColorSpace(depthBasics, Enumerable.Repeat(distance, noOfPoints).ToArray(), depthBasicToColor);

                Console.WriteLine("Projection from depth to color ");
                Console.WriteLine("z-axis = " + distance);
                foreach (var point in depthBasicToColor)
                {
                    Console.WriteLine(point.ToSString());
                }

                coordinateMapper.MapDepthPointsToCameraSpace(depthBasics, Enumerable.Repeat(distance, noOfPoints).ToArray(), depthBasicToCamera);

                Console.WriteLine("Projection from depth to camera ");
                Console.WriteLine("z-axis = " + distance);
                foreach (var point in depthBasicToCamera)
                {
                    Console.WriteLine(point.ToSString());
                }

                for (int i = 0; i < noOfPoints; i++)
                {
                    Console.WriteLine(projectDepthPixelToCameraSpacePoint(new Point3(depthBasics[i].X, depthBasics[i].Y, distance)).ToSString());
                }
            }

            // Let's X_ir(P) being P.X in depth image, X_rgb(P) being P.X in RGB

            // The calculation here is just an estimation, doesn't take into account camera calibration
            // Solve the problem on the z-plane of 1 meter
            // Center of depth field has the same X, Y as the zero point of coordinate space
            System.Drawing.PointF centerDepthField_ir = new System.Drawing.PointF(spaceBasicToDepth[4].X, spaceBasicToDepth[4].Y);

            System.Drawing.PointF centerDepthField_rgb = new System.Drawing.PointF(spaceBasicToColor[4].X, spaceBasicToColor[4].Y);
//.........这里部分代码省略.........
开发者ID:tuandnvn,项目名称:ecat,代码行数:101,代码来源:KinectUtils.cs


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