本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例5: CheckActiveWorkspace
public void CheckActiveWorkspace(CameraSpacePoint[] handPositions)
{
if (handPositions.Length > 0)
{
CheckActiveWorkspace(Converter.CameraSpacePointsToPoint3Ds(handPositions).ToArray());
}
}
示例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;
}
示例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);
}
示例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;
}
示例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));
}
示例10: SetValues
private void SetValues(CameraSpacePoint hand)
{
KinectX = hand.X;
KinectY = hand.Y;
ScreenX = (MaxValue / 2) + (KinectX * MaxValue);
ScreenY = (MaxValue / 2) - (KinectY * MaxValue);
}
示例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;
}
示例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;
}
示例13: CameraSpacePointToPoint3D
public static Point3D CameraSpacePointToPoint3D(CameraSpacePoint cameraSpacePoint)
{
return new Point3D
{
X = cameraSpacePoint.X,
Y = cameraSpacePoint.Y,
Z = cameraSpacePoint.Z
};
}
示例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;
}
示例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);
}