How to use a Visual Gesture Builder database with Unity3D Plugin?

China☆狼群 提交于 2019-12-23 01:52:49

问题


I'm trying to use a .gbd file from Visual Gesture Builder in my Unity3D scene. I have imported both plugins to Unity( the Kinect.2.0.1410.19000.unitypackageand Kinect.VisualGestureBuilder.2.0.1410.19000.unitypackage). The included demos and skeleton data work fine.

When tyring to import my gesture database like this:

using Windows.Kinect;
using Microsoft.Kinect.VisualGestureBuilder;

void Start () 
{
    _Sensor = KinectSensor.GetDefault();
    // compilation error for the following line, see below
    _gestureDatabase = new VisualGestureBuilderDatabase(@"gestures.gbd");
    // check if sensor is there....
    _gestureFrameSource = new VisualGestureBuilderFrameSource(_Sensor, 0);
    _gestureFrameSource.AddGestures(_gestureDatabase.AvailableGestures);
}

Compilation fails:

Microsoft.Kinect.VisualGestureBuilder.VisualGestureBuilderDatabase.VisualGestureBuilderDatabase(System.IntPtr)' is inaccessible due to its protection level'

and

The best overloaded method match for `Microsoft.Kinect.VisualGestureBuilder.VisualGestureBuilderDatabase.VisualGestureBuilderDatabase(System.IntPtr)' has some invalid arguments

What am I missing? Is the Kinect API any different in Unity?


回答1:


I was running into the same problem. As far as I can tell, you cannot call these constructors directly, but you instead need to call on the static method Create. For example, in your case you would say...

        _gestureDatabase = VisualGestureBuilderDatabase.Create(@"gestures.gbd");
        _gestureFrameSource = VisualGestureBuilderFrameSource.Create(_Sensor,0);

This seems to resolve the issue, at least for me. I'm still running into compilation errors later in the code where I try and retrieve the DiscreteGestureResult, but I'll keep going through the source code looking for answers.



来源:https://stackoverflow.com/questions/26873523/how-to-use-a-visual-gesture-builder-database-with-unity3d-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!