我一直在研究這個問題已經好幾天了,但沒有成功,看着其他問題,堆棧溢出是我的一個來源。 我正在使用Kinect for Windows創建一個程序,該程序將跟蹤用戶的關節,並在單獨的「屏幕」上繪製骨骼,我已經映射了關節本身,並使用圖像(紅點)來演示映射關節的位置。映射骨架關節以創建骨架
我的下一步是通過從一個關節繪製一條線來構建骨骼本身,我遇到的問題是如何繪製線...我有一種傾向於過度複雜的東西,所以我想知道是否我只是爲自己製造困難,而不是僅僅發現 最簡單的解決方案。
我覺得我有99%的路,但仍然遇到一個錯誤,我無法得到我的頭,請在下面找到錯誤消息和相關的C#代碼。
"cannot convert from 'Microsoft.Kinect.SkeletonPoint' to 'System.Windows.Point"
代碼:
private void DrawBone (Joint jointFrom, Joint jointTo)
{
Brush centerPointBrush;
Pen trackedBonePen = new Pen(Brushes.White, TrackedBoneThickness);
inferredBonePen = new Pen(Brushes.Gray, InferredBoneThickness);
DrawingVisual visual = new DrawingVisual();
DrawingContext context = visual.RenderOpen();
centerPointBrush = Brushes.Red;
if (jointFrom.TrackingState == JointTrackingState.NotTracked
|| jointTo.TrackingState == JointTrackingState.NotTracked)
{
return;
}
if (jointFrom.TrackingState == JointTrackingState.Inferred
|| jointTo.TrackingState == JointTrackingState.Inferred)
{
context.DrawLine(inferredBonePen,jointFrom.Position, jointTo.Position);
}
if (jointFrom.TrackingState == JointTrackingState.Tracked
|| jointTo.TrackingState == JointTrackingState.Tracked)
{
context.DrawLine(trackedBonePen, jointFrom.Position, jointTo.Position);
}
}
與啓動context.DrawLine
的線條,這些都是不正確的參數爲DrawLine
功能,我得到的一個伴隨的錯誤錯誤:
Error 4 The best overloaded method match for
'System.Windows.Media.DrawingContext.DrawLine(System.Windows.Media.Pen,
System.Windows.Point, System.Windows.Point)' has some invalid arguments