當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。