Unable to get HandMap example working due to possible OpenNI issues

Aug 12, 2011 at 10:55 AM

Hello,

I have been trying to get your HandMap example to run for a few days now and I have come across a few problems I was hoping you might be able to help with.

When I try and run the project, I get this error, however during build I get no errors:

 

System.Windows.Markup.XamlParseException was unhandled
  Message='The invocation of the constructor on type 'HandMap.SurfaceWindow1' that matches the specified binding constraints threw an exception.' Line number '10' and line position '18'.
  Source=PresentationFramework
  LineNumber=10
  LinePosition=18
  StackTrace:
       at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
       at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
       at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
       at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
       at System.Windows.Application.LoadBamlStreamWithSyncInfo(Stream stream, ParserContext pc)
       at System.Windows.Application.LoadComponent(Uri resourceLocator, Boolean bSkipJournaledProperties)
       at System.Windows.Application.DoStartup()
       at System.Windows.Application.<.ctor>b__1(Object unused)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.Run()
       at System.Windows.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at System.Windows.Application.Run()
       at HandMap.App.Main() in C:\Users\moserju\Desktop\InfoStrat -MotionFx\HandMap\obj\x86\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.InvalidOperationException
       Message=Cannot find the requested data item, such as a data key or value.
       Source=System.Speech
       StackTrace:
            at System.Speech.Recognition.RecognizerBase.SetInputToDefaultAudioDevice()
            at System.Speech.Recognition.SpeechRecognitionEngine.SetInputToDefaultAudioDevice()
            at InfoStrat.MotionFx.Speech.SpeechHelper..ctor() in C:\Users\moserju\Desktop\InfoStrat -MotionFx\InfoStrat.MotionFx.Speech\SpeechHelper.cs:line 46
            at HandMap.SurfaceWindow1.InitSpeechRecognition() in C:\Users\moserju\Desktop\InfoStrat -MotionFx\HandMap\SurfaceWindow1.xaml.cs:line 91
            at HandMap.SurfaceWindow1..ctor() in C:\Users\moserju\Desktop\InfoStrat -MotionFx\HandMap\SurfaceWindow1.xaml.cs:line 80
       InnerException: 

 

 

The version of OpenNI that I have installed is newer that the one that the OpenNI.dll in the project is from? Could this be a factor? I am also having problems even viewing any of the openNi examples; when run all I see is a blank screen where the camera feed/depth map should be. Below is a list of the drivers and softwares i have installed and their versions:

  • PrimeSense Sensor KinectMod 5.0.3.4 for Windows 64-bit
  • PrimeSense - NITE 1.4.2 for Windows 64-bit
  • OpenNI 1.3.2.3 for Windows 64-bit
  • Windows Driver Package - PrimeSense (psdrv3) Primesense (02/16/2011 3.1.2.0)
  • Windows Driver Package - PrimeSense (psdrv3) Primesense (02/16/2011 3.1.2.0)

for some reason the driver package is installed twice. Also, all these are unstable releases. I have tried installing stable releases of all that are available but I still get the same result. In device manager, my Kinect is detected as a PrimeSense device with Kinect Audio, Camera & Motor which makes me think everything is installed correctly.

 

Thanks, in advance for any help anyone can provide on this :)

Justin

Coordinator
Aug 17, 2011 at 5:43 AM

Hi Justin,

That particular exception is probably due to your system not having any microphone devices, so the speech recognition fails to initialize. Comment out the call to InitSpeechRecognition() in SurfaceWindow1's constructor.

Also if the OpenNI samples don't work then MotionFx may not work. I'd recommend uninstalling all of that and installing the 32-bit version of all of the driver packages, even if you are running 64 bit Windows.

Finally, the version of MotionFx up right now isn't updated for the latest versions of OpenNI yet. I should be posting an update very soon. If you can't wait, see if you can find the installers for the versions listed in the Readme:

OpenNI v1.1.0.41

  • NITE  v1.3.1.5

  • OpenNI compatible sensor and drivers (PrimeSensor and Sensor drivers, or Kinect and SensorKinect drivers) 5.0.1.32

    Thanks,

    Josh