本文整理汇总了C#中Microsoft.Kinect.SkeletonPoint类的典型用法代码示例。如果您正苦于以下问题:C# SkeletonPoint类的具体用法?C# SkeletonPoint怎么用?C# SkeletonPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SkeletonPoint类属于Microsoft.Kinect命名空间,在下文中一共展示了SkeletonPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GestureStatus
/// <summary>
/// Initializes a new Gesture Status.
/// </summary>
public GestureStatus()
{
this.isMakingAFast = false;
this.startPoint = new SkeletonPoint();
this.endPoint = new SkeletonPoint();
this.headPoint = new SkeletonPoint();
}
示例2: comparePoint
public static bool comparePoint(SkeletonPoint a, SkeletonPoint b, float dif)
{
if (compareValue(a.X, b.X, dif) && compareValue(a.Y, b.Y, dif) && compareValue(a.Z, b.Z, dif))
return true;
else
return false;
}
示例3: Test90DegreeAngle
public void Test90DegreeAngle()
{
Joint vertex = new Joint();
Joint[] otherJoints = new Joint[2];
SkeletonPoint sp = new SkeletonPoint();
sp.X = 0.0F;
sp.Y = 0.0F;
sp.Z = 0.0F;
vertex.Position = sp;
Joint joint1 = new Joint();
SkeletonPoint point = new SkeletonPoint();
point.X = 0.0F;
point.Y = 1.0F;
point.Z = 0.0F;
joint1.Position = point;
Joint joint2 = new Joint();
SkeletonPoint point2 = new SkeletonPoint();
point2.X = 1.0F;
point2.Y = 0.0F;
point2.Z = 0.0F;
joint2.Position = point2;
otherJoints[0] = joint1;
otherJoints[1] = joint2;
Assert.AreEqual(90, JointAnalyzer.findAngle(vertex,otherJoints), "Angle should be 90 degrees");
}
示例4: vecSubt
public static SkeletonPoint vecSubt(SkeletonPoint a, SkeletonPoint b)
{
a.X -= b.X;
a.Y -= b.Y;
a.Z -= b.Z;
return a;
}
示例5: Add
public virtual void Add(SkeletonPoint position, KinectSensor sensor)
{
GesturePoint entity = new GesturePoint { Position = Vector.ToVector(position), Time = DateTime.Now };
GestureEntities.Add(entity);
if (GestureCanvas != null)
{
entity.DisplayEllipse = new Ellipse
{
Width = 4,
Height = 4,
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Top,
StrokeThickness = 2.0,
Stroke = new SolidColorBrush(DisplayColor),
StrokeLineJoin = PenLineJoin.Round
};
Point point = Tools.Convert(sensor, position);
float x = (float)(point.X * GestureCanvas.ActualWidth);
float y = (float)(point.Y * GestureCanvas.ActualHeight);
Canvas.SetLeft(entity.DisplayEllipse, x - entity.DisplayEllipse.Width / 2);
Canvas.SetTop(entity.DisplayEllipse, y - entity.DisplayEllipse.Height / 2);
GestureCanvas.Children.Add(entity.DisplayEllipse);
}
if (GestureEntities.Count > WindowSize)
{
GesturePoint entryToRemove = GestureEntities[0];
if (GestureCanvas != null)
{
GestureCanvas.Children.Remove(entryToRemove.DisplayEllipse);
}
GestureEntities.Remove(entryToRemove);
}
LookForGesture();
}
示例6: vecMult
public static SkeletonPoint vecMult(float coEffish, SkeletonPoint vec)
{
vec.X *= coEffish;
vec.Y *= coEffish;
vec.Z *= coEffish;
return vec;
}
示例7: averagePoint
public static SkeletonPoint averagePoint(SkeletonPoint p1, int avgFactor)
{
p1.X = p1.X / avgFactor;
p1.Y = p1.Y / avgFactor;
p1.Z = p1.Z / avgFactor;
return p1;
}
示例8: Update
public void Update(SkeletonPoint position, int updateId, long timestamp)
{
// Movement magnitude gets scaled by this amount in order to get the current activity metric
const double DeltaScalingFactor = 10.0;
// Controls how quickly new values of the metric displace old values. 1.0 means that new values
// for metric immediately replace old values, while smaller decay amounts mean that old metric
// values influence the metric for a longer amount of time (i.e.: decay more slowly).
const double ActivityDecay = 0.1;
var delta = new SkeletonPoint
{
X = position.X - this.LastPosition.X,
Y = position.Y - this.LastPosition.Y,
Z = position.Z - this.LastPosition.Z
};
double deltaLengthSquared = (delta.X * delta.X) + (delta.Y * delta.Y) + (delta.Z * delta.Z);
double newMetric = DeltaScalingFactor * Math.Sqrt(deltaLengthSquared);
this.ActivityLevel = ((1.0 - ActivityDecay) * this.ActivityLevel) + (ActivityDecay * newMetric);
bool newIsActive = this.ActivityLevel >= ActivityMetricThreshold;
if (newIsActive != this.IsActive)
{
this.IsActive = newIsActive;
this.StateTransitionTimestamp = timestamp;
}
this.LastPosition = position;
this.LastUpdateId = updateId;
}
开发者ID:fabiocasagrande,项目名称:Research_Project_Microsoft_Kinect_SDK1.8,代码行数:33,代码来源:UserActivityRecord.cs
示例9: AssignAnglesToSkeleton
public void AssignAnglesToSkeleton(Skeleton skeleton)
{
Hashtable angles = getAllAngles();
foreach (JointType key in angles.Keys)
{
List<double> anglesInDouble = (List<double>)angles[key];
SkeletonPoint point = new SkeletonPoint();
if (!double.IsNaN(anglesInDouble[0]))
{
point.X = (int)anglesInDouble[0];
}
if (!double.IsNaN(anglesInDouble[1]))
{
point.Y = (int)anglesInDouble[1];
}
if (!double.IsNaN(anglesInDouble[2]))
{
point.Z = (int)anglesInDouble[2];
}
var joint = skeleton.Joints[key];
joint.Position = point;
skeleton.Joints[key] = joint;
}
}
示例10: DoPan
protected void DoPan(SkeletonPoint handPoint)
{
var mapExtentDeltaX = (_startExtent.XMax - _startExtent.XMin);
var mapExtentDeltaY = (_startExtent.YMax - _startExtent.YMin);
var relativeDeltaDistance = _startHandPoint.DistanceVectorFrom(handPoint, _map.ActualWidth, _map.ActualHeight);
var deltaX = relativeDeltaDistance.X * mapExtentDeltaX;
var deltaY = relativeDeltaDistance.Y * mapExtentDeltaY;
var nextExtent = new Envelope
{
XMin = _startExtent.XMin + deltaX,
XMax = _startExtent.XMax + deltaX,
YMin = _startExtent.YMin - deltaY,
YMax = _startExtent.YMax - deltaY
};
_map.Extent = nextExtent;
if (KinectPanning != null)
{
var handCoordinate = handPoint.ToEsriWebMercatorMapPoint(_map);
KinectPanning(handCoordinate.ToMapCoord());
}
}
示例11: Plane
public Plane(SkeletonPoint p1, SkeletonPoint p2, SkeletonPoint p3)
{
a = (p2.Y - p1.Y) * (p3.Z - p1.Z) - (p3.Y - p1.Y) * (p2.Z - p1.Z);
b = (p2.Z - p1.Z) * (p3.X - p1.X) - (p3.Z - p1.Z) * (p2.X - p1.X);
c = (p2.X - p1.X) * (p3.Y - p1.Y) - (p3.X - p1.X) * (p2.Y - p1.Y);
d = -(a * p1.X + b * p1.Y + c * p1.Z);
}
示例12: SkeletonPointToScreen
/// <summary>
/// Maps a SkeletonPoint to lie within our render space and converts to Point
/// </summary>
/// <param name="sensor">Sensor to proyect point</param>
/// <param name="skelpoint">point to map</param>
/// <returns>mapped point</returns>
public Point SkeletonPointToScreen(KinectSensor sensor, SkeletonPoint skelpoint)
{
// Convert point to depth space.
// We are not using depth directly, but we do want the points in our 640x480 output resolution.
DepthImagePoint depthPoint = sensor.CoordinateMapper.MapSkeletonPointToDepthPoint(skelpoint, DepthImageFormat.Resolution640x480Fps30);
return new Point(depthPoint.X, depthPoint.Y);
}
示例13: Detect
public bool Detect(SkeletonPoint shoulderCenter, SkeletonPoint rightHandPoint, bool rightHandTracked,
SkeletonPoint leftHandPoint, bool leftHandTracked)
{
var rightHandInFront = rightHandTracked && (shoulderCenter.Z - rightHandPoint.Z >= MinZDistanceFromBody);
var leftHandInFront = leftHandTracked && (shoulderCenter.Z - leftHandPoint.Z >= MinZDistanceFromBody);
// Just one hand at minimal distance from Shoulder Center
if (rightHandInFront ^ leftHandInFront)
{
SkeletonPoint handPoint;
if (rightHandInFront)
{
handPoint = rightHandPoint;
PanningHand = Hand.Right;
}
else
{
handPoint = leftHandPoint;
PanningHand = Hand.Left;
}
if (!IsPanning)
{
StartPan(handPoint);
}
RunPanning(handPoint);
}
else
{
StopZooming();
}
return IsPanning;
}
示例14: vecAdd
public static SkeletonPoint vecAdd(SkeletonPoint a, SkeletonPoint b)
{
a.X += b.X;
a.Y += b.Y;
a.Z += b.Z;
return a;
}
示例15: Detect
public bool Detect(SkeletonPoint shoulderCenter, SkeletonPoint rightHandPoint, bool rightHandTracked,
SkeletonPoint leftHandPoint, bool leftHandTracked)
{
if (rightHandTracked == false || leftHandTracked == false)
{
StopZooming();
}
// Both hands at minimal distance from Shoulder Center
else if (shoulderCenter.Z - rightHandPoint.Z >= MinZDistanceFromBody &&
shoulderCenter.Z - leftHandPoint.Z >= MinZDistanceFromBody)
{
if (!IsZooming)
{
StartZoom(rightHandPoint, leftHandPoint);
}
RunZooming(rightHandPoint, leftHandPoint);
}
else
{
StopZooming();
}
return IsZooming;
}