0
我正在使用kinect,我想在屏幕上打印單個關節。這個例子做到這一點:訪問joincollection kinect的成員
foreach (Joint joint in skeleton.Joints){
Brush drawBrush = null;
drawingContext.DrawEllipse(drawBrush, null, this.SkeletonPointToScreen(joint.Position),JointThickness,JointThickness)
}
,吸引了所有的關節,目前我希望能夠只畫那些我感興趣的這是我一直在做:
Joint Cadera = skeleton.Joints[0];
Brush drawBrush = null;
if (drawBrush != null)
{
drawingContext.DrawEllipse(drawBrush, null, this.SkeletonPointToScreen(Cadera.Position), JointThickness, JointThickness);
}
但是當我改變skeleton.Joints [0]到skeleton.Joint [1]我得到以下錯誤:
cannot convert from 'int' to 'Microsoft.Kinect.JointType'
使用0時,由於我是新手C#程序員,我想這不會發生知道如何訪問指定一個集合的c元素。我已經採取了看看類JointCollection,它顯示了這一點:
namespace Microsoft.Kinect
{
// Summary:
// This class contains a collection of joints returned for a given skeleton.
[Serializable]
public class JointCollection : IEnumerable<Joint>, IEnumerable
{
// Summary:
// Gets the number of joints available.
public int Count { get; }
// Summary:
// Accesses the requested joint.
//
// Parameters:
// jointType:
// The JointType being requested.
//
// Returns:
// The requested joint.
public Joint this[JointType jointType] { get; set; }
// Summary:
// This method is used to enumerate the list of joints.
//
// Returns:
// The related enumerator.
public IEnumerator GetEnumerator();
}
}
所以,我認爲我需要使用聯合,但我不知道怎麼辦。在此先感謝您的幫助