本文整理汇总了C#中Joint.ScaleTo方法的典型用法代码示例。如果您正苦于以下问题:C# Joint.ScaleTo方法的具体用法?C# Joint.ScaleTo怎么用?C# Joint.ScaleTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Joint
的用法示例。
在下文中一共展示了Joint.ScaleTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUIElementPosition
private void SetUIElementPosition(FrameworkElement element, Joint joint, int yOffset)
{
var scaledJoint = joint.ScaleTo(1024, 768, .99f, .99f);
Canvas.SetLeft(element, scaledJoint.Position.X);
Canvas.SetTop(element, scaledJoint.Position.Y - yOffset);
}
示例2: DrawJoint
/// <summary>
/// Draws an ellipse to the specified joint.
/// </summary>
/// <param name="canvas">The Canvas element to draw the ellipse.</param>
/// <param name="joint">The joint represented by the ellipse.</param>
/// <param name="color">The desired color for the ellipse.</param>
/// <param name="radius">The desired length for the ellipse.</param>
public static void DrawJoint(this Canvas canvas, Joint joint, Color color, double radius)
{
if (joint.TrackingState == TrackingState.NotTracked) return;
joint = joint.ScaleTo(canvas.ActualWidth, canvas.ActualHeight);
Ellipse ellipse = new Ellipse
{
Tag = TAG,
Width = radius,
Height = radius,
Fill = new SolidColorBrush(color)
};
Canvas.SetLeft(ellipse, joint.Position.X - ellipse.Width / 2);
Canvas.SetTop(ellipse, joint.Position.Y - ellipse.Height / 2);
canvas.Children.Add(ellipse);
}
示例3: DrawEllipse
private void DrawEllipse(Canvas cvs, double X, double Y, Joint joint)
{
var scaledJoint = joint.ScaleTo((int)cvsSkeleton.Width, (int)cvsSkeleton.Height, 1, 1);
Ellipse ellipse = new Ellipse();
ellipse.Width = 30;
ellipse.Height = 30;
Canvas.SetLeft(ellipse, scaledJoint.Position.X - ellipse.Width / 2);
Canvas.SetTop(ellipse, scaledJoint.Position.Y - ellipse.Height / 2);
ellipse.Fill = new SolidColorBrush(Colors.Purple);
cvs.Children.Add(ellipse);
}
示例4: setpositionellipse
private void setpositionellipse(FrameworkElement ellipse , Joint joint )
{
// it sets the end of the skeleton coordinates which means the maximum x for the skeleton is 0.5 x , but still it can get more than 0.5 but skeleton wont move
var scaledjoint = joint.ScaleTo(640, 480, 1f, 1f);
Canvas.SetLeft(ellipse, scaledjoint.Position.X);
Canvas.SetTop(ellipse, scaledjoint.Position.Y);
}
示例5: SetEllipsePosition
private void SetEllipsePosition(FrameworkElement ellipse, Joint joint)
{
var scaledJoint = joint.ScaleTo(320, 240, .5f, .5f);
//System.Windows.Point relativePoint = ellipse.TransformToAncestor(dynElementSettings.SharedInstance.Bench.workBench)
// .Transform(new System.Windows.Point(scaledJoint.Position.X, scaledJoint.Position.Y));
//Canvas.SetLeft(ellipse, relativePoint.X);
//Canvas.SetTop(ellipse, relativePoint.Y);
Canvas.SetLeft(ellipse, scaledJoint.Position.X);
Canvas.SetTop(ellipse, scaledJoint.Position.Y);
}
示例6: SetEllipsePosition
private void SetEllipsePosition(FrameworkElement ellipse, Joint joint)
{
var scaledJoint = joint.ScaleTo(1230, 750, .5f, .5f);
if (joint.ID == JointID.HandRight)
{
Canvas.SetLeft(ellipse, scaledJoint.Position.X);
Canvas.SetTop(ellipse, scaledJoint.Position.Y);
if (currentButton.Name == "LoadImage" && hoverTrigger == true)
{
if (hoverWatch.ElapsedMilliseconds > WaitTime)
{
OpenFileDialog();
hoverTrigger = false;
popupWindow = true;
}
//Console.WriteLine(hoverWatch.ElapsedMilliseconds);
}
//Console.WriteLine("right hand");
}
else if (joint.ID == JointID.HandLeft)
{
Canvas.SetLeft(ellipse, scaledJoint.Position.X);
Canvas.SetTop(ellipse, scaledJoint.Position.Y);
}
else if (joint.ID == JointID.Head)
{
Canvas.SetLeft(ellipse, scaledJoint.Position.X);
Canvas.SetTop(ellipse, scaledJoint.Position.Y);
}
}
示例7: Jointure
public Jointure(string name, Joint point)
{
var scaledJoint = point.ScaleTo(640, 480, .6f, .6f);
this.name = name;
this.x = scaledJoint.Position.X.ToString();
this.y = scaledJoint.Position.Y.ToString();
this.z = scaledJoint.Position.Z.ToString();
}
示例8: SetEllipsePosition
private void SetEllipsePosition(FrameworkElement ellipse, Joint joint)
{
var scaledJoint = joint.ScaleTo(640, 480, .5f, .5f);
Canvas.SetLeft(ellipse, scaledJoint.Position.X);
Canvas.SetTop(ellipse, scaledJoint.Position.Y);
}
示例9: scaleJoint
private Joint scaleJoint(Joint joint)
{
// scale to the UI window size
return joint.ScaleTo(this.window_width, this.window_height, .5f, .5f);
}
示例10: SetImagePosition
private void SetImagePosition(Image image, Joint joint)
{
var scaledJoint = joint.ScaleTo(640, 480, k_xMaxJointScale, k_yMaxJointScale);
Canvas.SetLeft(image, scaledJoint.Position.X - (double)image.GetValue(Canvas.WidthProperty) / 2);
Canvas.SetTop(image, scaledJoint.Position.Y - (double)image.GetValue(Canvas.WidthProperty) / 2);
Canvas.SetZIndex(image, (int)-Math.Floor(scaledJoint.Position.Z * 100));
}
示例11: DrawLine
/// <summary>
/// Draws a line connecting the specified joints.
/// </summary>
/// <param name="canvas">The Canvas element to draw the line.</param>
/// <param name="first">The first joint (start of the line).</param>
/// <param name="second">The second joint (end of the line)</param>
/// <param name="color">The desired color for the line.</param>
/// <param name="thickness">The desired line thickness.</param>
public static void DrawLine(this Canvas canvas, Joint first, Joint second, Color color, double thickness)
{
if (first.TrackingState == TrackingState.NotTracked || second.TrackingState == TrackingState.NotTracked) return;
first = first.ScaleTo(canvas.ActualWidth, canvas.ActualHeight);
second = second.ScaleTo(canvas.ActualWidth, canvas.ActualHeight);
Line line = new Line
{
Tag = TAG,
X1 = first.Position.X,
Y1 = first.Position.Y,
X2 = second.Position.X,
Y2 = second.Position.Y,
StrokeThickness = thickness,
Stroke = new SolidColorBrush(color)
};
canvas.Children.Add(line);
}
示例12: SetHandPosition
private static void SetHandPosition(Joint joint)
{
var scaledJoint = joint.ScaleTo(movement.ViewWidth, movement.ViewHeight, 0.3f, 0.3f);
movement.HandX = (int)scaledJoint.Position.X;
movement.HandY = (int)scaledJoint.Position.Y;
}
示例13: SetEllipsePosition
private void SetEllipsePosition(FrameworkElement ellipse, Joint joint)
{
var scaledJoint = joint.ScaleTo(640 * 3, 480 * 3, .5f, .5f);
Canvas.SetLeft(ellipse, scaledJoint.Position.X - 640);
Canvas.SetTop(ellipse, scaledJoint.Position.Y - 480);
RightHandX = scaledJoint.Position.X - 640;
RightHandY = scaledJoint.Position.Y - 480;
}
示例14: SetPosition
public void SetPosition(Joint joint)
{
var scaledJoint = joint.ScaleTo(800, 600, 0.5f, 0.5f);
Canvas.SetLeft(this, scaledJoint.Position.X);
Canvas.SetTop(this, scaledJoint.Position.Y);
}
示例15: GetDisplayPosition
private Point3D GetDisplayPosition(Joint joint)
{
//TODO: Implementeer logica voor de trackingstate. Zodat we ook weten of hij ook echt alles ziet
//if (joint.TrackingState != JointTrackingState.Tracked)
//{
// //Als hij hem niet ziet, laat hem dan ook links boven in beeld zien.
// return new Point3D(0, 0, 0);
//}
var newPoint = joint.ScaleTo(640, 480, _maxSkeletonX, _maxSkeletonY);
//return coordinates and return z in millimeters
return new Point3D(newPoint.Position.X, newPoint.Position.Y, newPoint.Position.Z * 1000);
}