kinect骨骼关节的相对跟踪? [英] Relative tracking of a kinect skeleton joint ?
问题描述
您好,
目前我正在使用Coding4fun ScaleTo()跟踪右手,如下所示:
Currently I am using Coding4fun ScaleTo() to track the right hand , like this :
Joint scaledJoint = joint.ScaleTo(1920, 1080, .3f, .3f);
System.Drawing.Point p = new System.Drawing.Point(Convert.ToInt32(scaledJoint.Position.X), Convert.ToInt32(scaledJoint.Position.Y));
MouseLibrary.SetCursorPosition(p);
我想通过使用相对于我头部的右手的相对跟踪来改善这一点。
I would like to improve this by using relative tracking of my right hand relative to my head.
例如,如果我蹲下,鼠标光标不会改变,因为我的头手关系是相同的。
For example, if I crouched down, the mouse cursor would not change because my head-hand relationship is the same.
有什么建议吗?
谢谢,彼得
推荐答案
您可以创建一个虚拟屏幕,其边缘从您的头部开始,作为虚拟屏幕的零位置。
You could create a virtual screen its edges starts from you head as the zero based position of your virtual screen.
使您的手相对于您的手位置从零位置( (点头)你可以减去手的Position.X - 你头部的Position.X也是Y位置并尝试将这一点相对于屏幕上的光标点
To get your hand position relative to you zero based position (the head point) you can subtract your Position.X of your hand - Position.X of your head also the Y position and try to relative this point to the cursor point on the screen
试试这个它通过其他方式得到屏幕点
try this it get the screen point but by other way
/// <summary>
/// Updates the cursor position.
/// </summary>
/// <param name="hand">The hand.</param>
/// <param name="head">The head</param>
/// <Author>MOHAMED A. SAKR</Author>
private void SetCursor(Joint hand, Joint head)
{
var point = _kinectSensor.MapSkeletonPointToDepth(head.Position, _kinectSensor.DepthStream.Format);
float x = point.X;
float y = point.Y;
float z = point.Depth;
x = (float)(x * _window.ActualWidth / _kinectSensor.DepthStream.FrameWidth);
y = (float)(y * _window.ActualHeight / _kinectSensor.DepthStream.FrameHeight);
x += ((float)(_window.ActualWidth * hand.Position.X * 4));
y -= ((float)(_window.ActualHeight * hand.Position.Y * 3));
Point cursorPoint = new Point(x, y);
}
这篇关于kinect骨骼关节的相对跟踪?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!