The type or namespace name 'InteractionHandTyp

2019-09-07 13:44发布

问题:

I am trying to detect closing fist (grip) gesture to control my mouse cursor in Kinect. I followed this tutorial to setup : http://dotneteers.net/blogs/vbandi/archive/2013/05/03/kinect-interactions-with-wpf-part-iii-demystifying-the-interaction-stream.aspx

However, in the DummyInteractionClient.cs file, I am getting this error on the following line:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Kinect.Toolkit.Interaction;

using Microsoft.Kinect.Toolkit;
using Microsoft.Kinect.Toolkit.Controls;


namespace Microsoft.Kinect.Toolkit.Controls
{
    public class DummyInteractionClient : IInteractionClient
  {
    public InteractionInfo GetInteractionInfoAtLocation(
        int skeletonTrackingId,
        InteractionHandType handType,
        double x,
        double y)
    {
        var result = new InteractionInfo();
        result.IsGripTarget = true;
        result.IsPressTarget = true;
        result.PressAttractionPointX = 0.5;
        result.PressAttractionPointY = 0.5;
        result.PressTargetControlId = 1;

        return result;
     }
  }
}

The error is at InteractionHandType handType. it says , Error 1 The type or namespace name 'InteractionHandType' could not be found (are you missing a using directive or an assembly reference?) E:\work\FYP\working\Kinect Mouse Controller switcher\kinectmouse CODE-96133\C Sharp zoom in both hands\DummyInteractionClient.cs 18 13 Microsoft.Kinect.Samples.CursorControlWhat does it error means? Am I missing or using wrong namespace names? Please help i am not expert in C# Kinect SDK 1.8.

回答1:

The InteractionHandType enumeration is defined in the namespace Microsoft.Kinect.Toolkit.Interaction. You need to add a reference to microsoft.kinect.toolkit.interaction.dll to your project (you will find the toolkit assemblies in C:\Program Files\Microsoft SDKs\Kinect\Developer Toolkit v1.8.0\Assemblies).



回答2:

First of all, you need to add a reference to the following .dll files:

  • Microsoft.Kinect.Toolkit.Interaction.dll
  • Microsoft.Kinect.Toolkit.dll

They are both placed in C:\Program Files\Microsoft SDKs\Kinect\Developer Toolkit v1.8.0\Assemblies.

After that, you also need to copy the following .dll files in your project build folder:

  • KinectInteraction180_32.dll
  • KinectInteraction180_64.dll

You can find them in C:\Program Files\Microsoft SDKs\Kinect\Developer Toolkit v1.8.0\bin.