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


C# CameraSpacePoint类代码示例

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


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

示例1: GetHighestValidPointIndexInRectangle

        public static int GetHighestValidPointIndexInRectangle(int bIndex, int cIndex)
        {
            Point pB = GetPoint(bIndex);
            Point pC = GetPoint(cIndex);
            int rectangleWidth = pB.X - pC.X;

            CameraSpacePoint highestPoint = new CameraSpacePoint()
            {
                X = float.PositiveInfinity,
                Y = float.PositiveInfinity,
                Z = float.PositiveInfinity
            };

            int highestPointIndex = -1;

            for (int i = 0; i < rectangleWidth; i++)
            {
                for (int j = 0; j < rectangleWidth; j++)
                {
                    int currentIndex = GetIndex(pC.X + j, pB.Y + i);
                    if (BoundaryCheck(currentIndex))
                    {
                        CameraSpacePoint currentPoint = GlobVar.SubtractedFilteredPointCloud[currentIndex];

                        if (currentPoint.Z < highestPoint.Z && !float.IsInfinity(currentPoint.X) && !float.IsInfinity(currentPoint.Y))
                        {
                            highestPoint = currentPoint;
                            highestPointIndex = currentIndex;
                        }
                    }
                }
            }
            return highestPointIndex;
        }
开发者ID:leiferikbjorkli,项目名称:Kinect2TrackingTopView,代码行数:34,代码来源:GlobUtils.cs

示例2: GetEuclideanDistance

        public static float GetEuclideanDistance(CameraSpacePoint a, CameraSpacePoint b)
        {
            float distance =
                (float)Math.Sqrt((a.X - b.X) * (a.X - b.X) + (a.Y - b.Y) * (a.Y - b.Y) + (a.Z - b.Z) * (a.Z - b.Z));

            return float.IsNaN(distance) ? float.MaxValue : distance;
        }
开发者ID:leiferikbjorkli,项目名称:Kinect2TrackingTopView,代码行数:7,代码来源:GlobUtils.cs

示例3: CalculateIntensityFromCameraSpacePoints

        /// <summary>
        ///  Normalizes the depths in the input frame into a 0-255 byte gray-value array.
        /// </summary>
        public static byte[] CalculateIntensityFromCameraSpacePoints(CameraSpacePoint[] cameraSpacePoint)
        {
            var intensityMap = new byte[cameraSpacePoint.Length];

            for (int i = 0; i < cameraSpacePoint.Length; i++)
            {
                float depth = cameraSpacePoint[i].Z;
                if (depth != 0)
                {
                    float currentMax = depth - GlobVar.MinSensingDepth;
                    const float currentDepthRange = GlobVar.MaxSensingDepth - GlobVar.MinSensingDepth;

                    if (depth < GlobVar.MaxSensingDepth && depth > GlobVar.MinSensingDepth)
                    {
                        intensityMap[i] = (byte)(255 - (255 * currentMax / currentDepthRange));
                    }
                    else
                    {
                        intensityMap[i] = (byte)0;
                    }
                }
                else
                {
                    intensityMap[i] = (byte)0;
                }
            }
            return intensityMap;
        }
开发者ID:leiferikbjorkli,项目名称:Kinect2TrackingTopView,代码行数:31,代码来源:ImageUtils.cs

示例4: CreateIntegralImage

        private static float[] CreateIntegralImage(CameraSpacePoint[] cameraSpacePoints)
        {
            float[] integralImage = new float[GlobVar.ScaledFrameLength];
            for (var i = 0; i < GlobVar.ScaledFrameHeight; i++)
            {
                for (var j = 0; j < GlobVar.ScaledFrameWidth; j++)
                {
                    int indexCurrent = i * GlobVar.ScaledFrameWidth + j;
                    int indexUpLeft = (i - 1) * GlobVar.ScaledFrameWidth + j - 1;
                    int indexUp = (i - 1) * GlobVar.ScaledFrameWidth + j;
                    int indexLeft = i * GlobVar.ScaledFrameWidth + j - 1;

                    if (i==0 && j==0)
                    {
                        integralImage[indexCurrent] = cameraSpacePoints[indexCurrent].Z;
                    }
                    else if (i==0)
                    {
                        integralImage[indexCurrent] = cameraSpacePoints[indexCurrent].Z + integralImage[indexLeft];
                    }
                    else if (j == 0)
                    {
                        integralImage[indexCurrent] = cameraSpacePoints[indexCurrent].Z + integralImage[indexUp];
                    }
                    else
                    {
                        integralImage[indexCurrent] = cameraSpacePoints[indexCurrent].Z + integralImage[indexUp] + integralImage[indexLeft] - integralImage[indexUpLeft];
                    }
                }
            }
            return integralImage;
        }
开发者ID:leiferikbjorkli,项目名称:Kinect2TrackingTopView,代码行数:32,代码来源:HaarDetector.cs

示例5: CheckActiveWorkspace

 public void CheckActiveWorkspace(CameraSpacePoint[] handPositions)
 {
     if (handPositions.Length > 0)
     {
         CheckActiveWorkspace(Converter.CameraSpacePointsToPoint3Ds(handPositions).ToArray());
     }
 }
开发者ID:frksptr,项目名称:kinect-demo,代码行数:7,代码来源:RoomPointCloudView.xaml.cs

示例6: CameraSpacePointsToPoint3Ds

        public static List<Point3D> CameraSpacePointsToPoint3Ds(CameraSpacePoint[] cameraSpacePoints)
        {
            if (cameraSpacePoints == null)
            {
                return null;
            }
            if (cameraSpacePoints.Length == 0)
            {
                return null;
            }
            List<Point3D> point3Ds = new List<Point3D>();

            foreach (CameraSpacePoint point in cameraSpacePoints)
            {
                if (GeometryHelper.IsValidPoint(point))
                {
                    point3Ds.Add(new Point3D
                    {
                        X = point.X,
                        Y = point.Y,
                        Z = point.Z
                    });
                }
            }

            return point3Ds;
        }
开发者ID:frksptr,项目名称:kinect-demo,代码行数:27,代码来源:Converter.cs

示例7: Angle

        /// <summary>
        /// Calculates the angle between the specified points around the specified axis.
        /// </summary>
        /// <param name="center">The center of the angle.</param>
        /// <param name="start">The start of the angle.</param>
        /// <param name="end">The end of the angle.</param>
        /// <param name="axis">The axis around which the angle is calculated.</param>
        /// <returns>The angle, in degrees.</returns>
        public static double Angle(this CameraSpacePoint center, CameraSpacePoint start, CameraSpacePoint end, Axis axis)
        {
            switch (axis)
            {
                case Axis.X:
                    start.X = 0f;
                    center.X = 0f;
                    end.X = 0f;
                    break;
                case Axis.Y:
                    start.Y = 0f;
                    center.Y = 0f;
                    end.Y = 0f;
                    break;
                case Axis.Z:
                    start.Z = 0f;
                    center.Z = 0f;
                    end.Z = 0f;
                    break;
            }

            Vector3D first = start.ToVector3() - center.ToVector3();
            Vector3D second = end.ToVector3() - center.ToVector3();

            return Vector3D.AngleBetween(first, second);
        }
开发者ID:reeonce,项目名称:Vitruvius,代码行数:34,代码来源:MathExtensions.cs

示例8: Filter

        public CameraSpacePoint Filter(CameraSpacePoint point)
        {
            if (this.lastTrend == null || this.lastOutput == null)
            {
                this.lastTrend = point;
                this.lastOutput = point;
                return point;
            }

            var newTrend = new CameraSpacePoint
            {
                X = gamma * (point.X - lastOutput.Value.X) + (1 - gamma) * lastTrend.Value.X,
                Y = gamma * (point.Y - lastOutput.Value.Y) + (1 - gamma) * lastTrend.Value.Y,
                Z = gamma * (point.Z - lastOutput.Value.Z) + (1 - gamma) * lastTrend.Value.Z
            };

            var newOutput = new CameraSpacePoint
            {
                X = alpha * point.X + (1 - alpha) * (lastOutput.Value.X + lastTrend.Value.X),
                Y = alpha * point.Y + (1 - alpha) * (lastOutput.Value.Y + lastTrend.Value.Y),
                Z = alpha * point.Z + (1 - alpha) * (lastOutput.Value.Z + lastTrend.Value.Z)
            };

            this.lastTrend = newTrend;
            this.lastOutput = newOutput;
            return newOutput;
        }
开发者ID:primarilysoftware,项目名称:kinect-cursor,代码行数:27,代码来源:DoubleExponentialSmoothingFilter.cs

示例9: Distance

 /// <summary>
 /// Returns the length of the segment defined by the specified points.
 /// </summary>
 /// <param name="p1">The first point (start of the segment).</param>
 /// <param name="p2">The second point (end of the segment).</param>
 /// <returns>The length of the segment in meters.</returns>
 public static double Distance(CameraSpacePoint p1, CameraSpacePoint p2)
 {
     return Math.Sqrt(
         Math.Pow(p1.X - p2.X, 2) +
         Math.Pow(p1.Y - p2.Y, 2) +
         Math.Pow(p1.Z - p2.Z, 2));
 }
开发者ID:etrigger,项目名称:Vitruvius,代码行数:13,代码来源:CameraExtensions.cs

示例10: SetValues

 private void SetValues(CameraSpacePoint hand)
 {
     KinectX = hand.X;
     KinectY = hand.Y;
     ScreenX = (MaxValue / 2) + (KinectX * MaxValue);
     ScreenY = (MaxValue / 2) - (KinectY * MaxValue);
 }
开发者ID:jansaris,项目名称:KinectV2,代码行数:7,代码来源:HandTracker.cs

示例11: CustomJoint

 /// <summary>
 /// Create a new <c>CustomJoint</c> object based on the supplied
 /// <c>JointType</c> value.
 /// </summary>
 public CustomJoint(JointType type)
 {
     _jointType = type;
     _position = new CameraSpacePoint();
     _depthPosition = new DepthSpacePoint();
     _colorPosition = new ColorSpacePoint();
     _trackingState = TrackingState.NotTracked;
 }
开发者ID:douglaswinstonr,项目名称:KinectDL,代码行数:12,代码来源:CustomJoint.cs

示例12: CopyPosition

 private static CameraSpacePoint CopyPosition(CameraSpacePoint position)
 {
     CameraSpacePoint result = new CameraSpacePoint();
     result.X = position.X;
     result.Y = position.Y;
     result.Z = position.Z;
     return result;
 }
开发者ID:rachelriv,项目名称:Instrumovement,代码行数:8,代码来源:JointRecords.cs

示例13: CameraSpacePointToPoint3D

 public static Point3D CameraSpacePointToPoint3D(CameraSpacePoint cameraSpacePoint)
 {
     return new Point3D
     {
         X = cameraSpacePoint.X,
         Y = cameraSpacePoint.Y,
         Z = cameraSpacePoint.Z
     };
 }
开发者ID:frksptr,项目名称:kinect-demo,代码行数:9,代码来源:Converter.cs

示例14: SubstractPoints

        private static CameraSpacePoint SubstractPoints(CameraSpacePoint position1, CameraSpacePoint position2)
        {
            CameraSpacePoint result = new CameraSpacePoint();
            result.X = position1.X - position2.X;
            result.Y = position1.Y - position2.Y;
            result.Z = position1.Z - position2.Z;
            return result;

        }
开发者ID:rachelriv,项目名称:Instrumovement,代码行数:9,代码来源:VelocityComputer.cs

示例15: DistanceBetweenPoints

        private static double DistanceBetweenPoints(CameraSpacePoint point1, CameraSpacePoint point2)
        {
            double dx = Math.Abs(point2.X - point1.X);
            double dy = Math.Abs(point2.Y - point1.Y);

            double dz = Math.Abs(point2.Z - point1.Z);

            return Math.Sqrt(dx * dx + dy * dy + dz * dz);
        }
开发者ID:rachelriv,项目名称:Instrumovement,代码行数:9,代码来源:VelocityComputer.cs


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