在這裏,你有很多的例子:
PowerPoint演示控制例子演示瞭如何檢測和跟蹤的手,甚至如何檢測一些手勢。
編輯:
以下的PowerPoint控制的例子,下面的代碼我告訴你如何跟蹤我的手用橢圓:
void sensor_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
{
try
{
using (var skeletonFrame = e.OpenSkeletonFrame())
{
if (skeletonFrame == null)
return;
if (skeletons == null ||
skeletons.Length != skeletonFrame.SkeletonArrayLength)
{
skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength];
}
skeletonFrame.CopySkeletonDataTo(skeletons);
}
Skeleton closestSkeleton = skeletons.Where(s => s.TrackingState == SkeletonTrackingState.Tracked)
.OrderBy(s => s.Position.Z * Math.Abs(s.Position.X))
.FirstOrDefault();
if (closestSkeleton == null)
return;
var rightFoot = closestSkeleton.Joints[JointType.FootRight];
var leftFoot = closestSkeleton.Joints[JointType.FootLeft];
var rightHand = closestSkeleton.Joints[JointType.HandRight];
var leftHand = closestSkeleton.Joints[JointType.HandLeft];
if (rightFoot.TrackingState == JointTrackingState.NotTracked ||
rightHand.TrackingState == JointTrackingState.NotTracked ||
leftHand.TrackingState == JointTrackingState.NotTracked)
{
//Don't have a good read on the joints so we cannot process gestures
return;
}
CoordinateMapper mapper = sensor.CoordinateMapper;
var point = mapper.MapSkeletonPointToColorPoint(closestSkeleton.Joints[JointType.Head].Position, sensor.ColorStream.Format);
var point1 = mapper.MapSkeletonPointToColorPoint(rightHand.Position, sensor.ColorStream.Format);
var point2 = mapper.MapSkeletonPointToColorPoint(leftHand.Position, sensor.ColorStream.Format);
// - Put Your Draw Code Here insted of the following:
SetEllipsePosition(ellipseRightFoot, rightFoot, false);
SetEllipsePosition(ellipseLeftFoot, leftFoot, false);
SetEllipsePosition(ellipseLeftHand, leftHand, isBackGestureActive);
SetEllipsePosition(ellipseRightHand, rightHand, isForwardGestureActive);
SetImagePosition(punhal, rightHand);
SetImagePosition2(punhal2, leftHand);
// -------------------------------------------------
catch
{
myException(this, new EventArgs());
}
}
這是來自微軟SDK中的方法每次Kinect都會有效地傳遞你的骨架。你只需要把你的代碼繪製到任何你想要的地方,我有我的SetEllipsePosition和SetImagePosition。
感謝你的興趣,但我寫我知道如何跟蹤每個關節 我試圖創建簡單的應用程序,跟蹤的右手腕/手的位置,並在畫布上繪製 行我知道如何追蹤手腕/手,但我不知道如何畫線或inkcanvas或圖像或位圖,這是我唯一的問題 任何人都有某種建議? – KinectUser 2014-09-03 07:51:41
你有試過嗎? http://msdn.microsoft.com/en-us/library/ms747393(v=vs.110).aspx – 2014-09-03 13:14:05
我們之間存在某種誤解。我知道如何在畫布上用鼠標/功能畫東西。 我對這樣的事情很感興趣(https://www.youtube.com/watch?v=_leF3v1vm_o) 我不知道如何讓功能在我的手部運動畫布上畫一條線。這是我的問題。 – KinectUser 2014-09-03 13:56:51