本文整理汇总了C#中Microsoft.Kinect.Joint.Project方法的典型用法代码示例。如果您正苦于以下问题:C# Joint.Project方法的具体用法?C# Joint.Project怎么用?C# Joint.Project使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Kinect.Joint
的用法示例。
在下文中一共展示了Joint.Project方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawJoint
public static void DrawJoint(this Canvas canvas, Joint joint, KinectSensor sensor)
{
if (joint.TrackingState == TrackingState.NotTracked) return;
Color c;
if (steadyFlag)
c = Colors.CadetBlue;
else
c = Colors.SandyBrown;
Boolean inferred = false;
if (joint.TrackingState == TrackingState.Inferred)
{
c = Colors.Gray;
inferred = true;
}
// joint = joint.ScaleTo(canvas.ActualWidth, canvas.ActualHeight);
Point p = scalePoint(joint.Project(sensor), canvas.ActualWidth, canvas.ActualHeight);
// Console.WriteLine("Position: " + p.X + " " + p.Y + "canvas size: " + canvas.Width + " " + canvas.Height);
// WirteText(canvas, joint.Project(sensor), "Position: " + joint.Project(sensor).X + ":" + joint.Project(sensor).Y);
DrawPoint(canvas, p, c, inferred);
// WirteText(canvas, p, "Position: " + joint.Project(sensor).X + ":" + joint.Project(sensor).Y);
}
示例2: DrawBone
public static void DrawBone(this Canvas canvas, Joint first, Joint second, KinectSensor sensor)
{
if (first.TrackingState == TrackingState.NotTracked || second.TrackingState == TrackingState.NotTracked) return;
// first = first.ScaleTo(canvas.ActualWidth, canvas.ActualHeight);
// second = second.ScaleTo(canvas.ActualWidth, canvas.ActualHeight);
Color c;
if (steadyFlag)
c = Colors.LightSeaGreen;
else
c = Colors.Yellow;
Boolean inferred = false;
if (first.TrackingState == TrackingState.Inferred || second.TrackingState == TrackingState.Inferred)
{
c = Colors.Black;
inferred = true;
}
Point firstP = scalePoint(first.Project(sensor), canvas.ActualWidth, canvas.ActualHeight);
Point secondP = scalePoint(second.Project(sensor), canvas.ActualWidth, canvas.ActualHeight);
DrawLine(canvas, firstP, secondP, c, inferred);
}
示例3: DrawWrongJoint
private static void DrawWrongJoint(this Canvas canvas, Joint joint, KinectSensor sensor)
{
if (joint.TrackingState == TrackingState.NotTracked) return;
Color c = Colors.Red;
double alpha = 1.0;
if (joint.TrackingState == TrackingState.Inferred)
{
alpha = 0.75;
}
// joint = joint.ScaleTo(canvas.ActualWidth, canvas.ActualHeight);
Point p = scalePoint(joint.Project(sensor), canvas.ActualWidth, canvas.ActualHeight);
if (!inCanvas(canvas, p))
return;
SolidColorBrush fill = new SolidColorBrush(c);
fill.Opacity = alpha;
Ellipse ellipse = new Ellipse
{
Width = 20,
Height = 20,
Fill = fill
};
Canvas.SetLeft(ellipse, p.X - ellipse.Width / 2);
Canvas.SetTop(ellipse, p.Y - ellipse.Height / 2);
canvas.Children.Add(ellipse);
}