简体   繁体   English

Kinect Paint-手跟踪C#,kinect SDK 1.7

[英]Kinect paint - hand tracking c#, kinect SDK 1.7

I am trying to make some simple app which allows you to paint on canvas with your right hand. 我正在尝试制作一些简单的应用程序,使您可以用右手在画布上绘画。 Fortunately I know how to make painting function but I have a little problem with other thing. 幸运的是,我知道如何使绘画功能起作用,但是我在其他方面有一点问题。 As you know SDK provides you to use a control named KinectRegion which has KinectCursor which is the representation of user's hand. 众所周知,SDK为您提供了一个名为KinectRegion的控件,该控件具有KinectCursor,它是用户手的代表。

The problem is that I don't know why when I am trying to paint something my painting path starts in different position than my KinectCursor is ? 问题是我不知道为什么当我尝试绘画某些东西时,我的绘画路径开始于与KinectCursor不同的位置?

I don't have this problem when I use my own right hand mapping function but in that case I can't use other things like KinectCircleButton because I don't have KinectRegion. 使用我自己的右手映射函数时,我没有这个问题,但是在那种情况下,由于我没有KinectRegion,因此无法使用KinectCircleButton之类的其他功能。

Anyone know how to get or to map KinectCursor position(x,y) from KinectRegion ? 任何人都知道如何从KinectRegion获取或映射KinectCursor位置(x,y)吗?

visualisation of my problem: [IMG] http://i58.tinypic.com/iqgemt.png[/IMG] 我的问题的可视化:[IMG] http://i58.tinypic.com/iqgemt.png[/IMG]

I'm working on the similar project on painting with Kinect. 我正在与Kinect进行类似的绘画项目。 Actually the position you need is in the HandPointer. 实际上,您需要的位置是在HandPointer中。 You can get the position of your hand relative to UIElement by a method called GetPosition(UIElement element) which obviously takes that element as parameter. 您可以通过一个名为GetPosition(UIElement element)的方法来获取手相对于UIElement的位置,该方法显然以该元素为参数。

An example of using the method looks like this: 使用该方法的示例如下所示:

public partial class MainWindow
{
    public Point position;

    public MainWindow
    {
        KinectRegion.AddHandPointerMoveHandler(this, OnHandPointerMove);
    }

    private void OnHandPointerMove(object sender, HandPointerEventArgs e)
    {
        position = e.HandPointer.GetPosition(myCanvas);
    }
}

Now the thing is your hand position and kinect hand position has a gap in both X and Y. Try to make these gaps zero. 现在的事情是您的手的位置,而Kinect的手的位置在X和Y上都有一个间隙。请尝试使这些间隙为零。 Then your hand will exactly map the painting point. 然后,您的手将精确绘制绘制点。 For example output x,y coordinates at once for both hand point and painting brush point. 例如,同时为手形点和画笔点输出x,y坐标。 and get the individual gap for both x coordinates and y coordinates. 并获得x坐标和y坐标的个体间隙。 now these difference should be deducted form x and y respectively. 现在,这些差异应分别从x和y中扣除。 So then your hand and paint brush points will map accordingly. 因此,您的手和画笔点将相应地映射。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM