Need help Installing OpenNI to get the Kinect working.

Has anyone here managed to install OpenNI in Windows 7 64-bit and got the Kinect working with it? I keep running into issues. As far as I understand I need OpenNI installed before I can run the Unity project.

I’ve installed all of the dependencies - Python 3.1, PyWin32, NSIS 2.46, copied the patch over the NSIS executables, Doxygen, and GraphViz.

When I run the RedistMaker.bat I get:

************************
*** ONI Redist Maker ***
************************
Going to build redist for version: 1.0.0.23!

******************************************
*** Erasing the old Final directory... ***
******************************************

*******************************************
*** Running the Redist Engine script... ***
*******************************************
Traceback (most recent call last):
  File "C:\Users\Neil_2\Downloads\Kinect\OpenNI-OpenNI-543dcc2\Platform\Win32\CreateRedist\Redist_OpenNi.py", line 140, in get_reg_values
    values = [(win32api.RegQueryValueEx(reg_key, name), data_type) for name, data_type in value_list]
  File "C:\Users\Neil_2\Downloads\Kinect\OpenNI-OpenNI-543dcc2\Platform\Win32\CreateRedist\Redist_OpenNi.py", line 140, in <listcomp>
    values = [(win32api.RegQueryValueEx(reg_key, name), data_type) for name, data_type in value_list]
pywintypes.error: (2, 'RegQueryValueEx', 'The system cannot find the file specified.')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Neil_2\Downloads\Kinect\OpenNI-OpenNI-543dcc2\Platform\Win32\CreateRedist\Redist_OpenNi.py", line 161, in <module>
    VS_INST_DIR = get_reg_values(MSVC_KEY, MSVC_VALUES)[0]
  File "C:\Users\Neil_2\Downloads\Kinect\OpenNI-OpenNI-543dcc2\Platform\Win32\CreateRedist\Redist_OpenNi.py", line 148, in get_reg_values
    raise Exception("Failed to get registry value!")
Exception: Failed to get registry value!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Neil_2\Downloads\Kinect\OpenNI-OpenNI-543dcc2\Platform\Win32\CreateRedist\Redist_OpenNi.py", line 140, in get_reg_values
    values = [(win32api.RegQueryValueEx(reg_key, name), data_type) for name, data_type in value_list]
  File "C:\Users\Neil_2\Downloads\Kinect\OpenNI-OpenNI-543dcc2\Platform\Win32\CreateRedist\Redist_OpenNi.py", line 140, in <listcomp>
    values = [(win32api.RegQueryValueEx(reg_key, name), data_type) for name, data_type in value_list]
pywintypes.error: (2, 'RegQueryValueEx', 'The system cannot find the file specified.')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Neil_2\Downloads\Kinect\OpenNI-OpenNI-543dcc2\Platform\Win32\CreateRedist\Redist_OpenNi.py", line 166, in <module>
    VS_INST_DIR = get_reg_values(MSVC_KEY, MSVC_VALUES)[0]
  File "C:\Users\Neil_2\Downloads\Kinect\OpenNI-OpenNI-543dcc2\Platform\Win32\CreateRedist\Redist_OpenNi.py", line 148, in get_reg_values
    raise Exception("Failed to get registry value!")
Exception: Failed to get registry value!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! An error occured while running a script !!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Press any key to continue . . .

Do I need to fully install OpenNI to get the DLL to work in Unity? Does anyone know what I’m doing wrong?

Installation of this stuff on Windows should be a lot easier than on Linux and OS X, but there are still a few different areas that people can get into trouble.

Three parts are required to make this stuff work:

OpenNI
NITE
Sensor Driver.

There are binary versions of OpenNI and NITE available to download, and for Windows these have installers that should be very easy. The problem you are having sounds like it is coming from doing things that are necessary to recompile OpenNI, which I dont think you have any need to do, and you may have downloaded the wrong thing. Look for the binary downloads on their site instead. Or you may have downloaded and installed the right thing but are performing additional steps with some of the files that it installed, that you really dont need to be doing.

The mistake to avoid with the sensor driver is that the driver on PrimeSenses own website is for their own reference hardware, not the Kinect. There are versions elsewhere on the net that are modified to work with the Kinect, I dont have links handy right now and havent tried with the newer version of OpenNI NITE on Windows yet but hopefully it will not be too hard for you to find what you need.

I have forgotten whether Windows users also need to install a certain version of libusb to get this working, Ive installed OpenNI etc on Windows,Linux and OS X in recent weeks and my brain has slightly scrambled the details on what was required on each platform, but installation of all the above stuff on Windows was certainly way easier than with the other OS’s.

OK I just tried my windows system with the latest unstable binaries and everything still seems to work OK with the Unity wrapper.

These are the files I installed (ignoring the small print stuff at the top of these pages and just choosing the windows ones from the lower section of these next 2 pages):

And this is the driver I used:

GitHub - avin2/SensorKinect: PrimeSensor Modules for OpenNI (run the windows exe that is in the Bin directory)

Hm, I’ve done all of that, but now Unity crashes when I run the kinect sample and none of the OpenNI/Nite samples work.

openNI.dll caused an Access Violation (0xc0000005)
  in module openNI.dll at 0023:6b4fe084.

Error occurred at 2011-01-09_225240.
C:\Program Files (x86)\Unity3\Editor\Unity.exe, run by Neil_2.
51% memory in use.
Unloading 286 unused Assets to reduce memory usage. Loaded Objects now: 1415.
System memory in use: 149.8 MB.
Unloading 4 Unused Serialized files (Serialized files now loaded: 2 / Dirty serialized files: 2)
Non platform assembly: data-0BE190B8 (this message is harmless)
Non platform assembly: data-0BE29D80 (this message is harmless)
Non platform assembly: data-0BED8638 (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity3\Editor\Data\Mono\lib\mono\2.0\I18N.dll (this message is harmless)
Platform assembly: C:\Program Files (x86)\Unity3\Editor\Data\Mono\lib\mono\2.0\I18N.West.dll (this message is harmless)
Mono: successfully reloaded assembly

Unloading 665 unused Assets to reduce memory usage. Loaded Objects now: 1027.
System memory in use: 151.3 MB.
Unloading 8 Unused Serialized files (Serialized files now loaded: 2 / Dirty serialized files: 2)
Error initing OpenNI: File not found!
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:Log(Object)
Nite:Start() (at Assets\Nite.cs:372)
 
(Filename: Assets/Nite.cs Line: 372)

It seems like line 372 is looking for that file and can’t find it. I’ve tried a full path, …/, …\, etc, all the combination I can think of and it still crashes every time :frowning:

Line 372 is this:

        uint rc = NiteWrapper.Init(new StringBuilder("../OpenNI.xml"));

        if (rc != 0)

        {

            Debug.Log(String.Format("Error initing OpenNI: {0}", Marshal.PtrToStringAnsi(NiteWrapper.GetStatusString(rc))));

        }

Do I have to put the primesense key of “0KOIk2JeIBYClPWVnMoRKn5cdY4=” into the .xml file?

I feel like I’m so close, yet so far. heh.

I will struggle to help you there because I havent had that problem myself and I cant remember doing anything special with that file.

Try asking here if you remain stuck:

http://groups.google.com/group/openni-dev

Are you using the pre-compiled binaries? There are some issues when using them when running on Windows 64-bits. The source code available from github seams to work. I will check that latter.

Damnnit. Yeah, Windows 7 64-bit. Now I’m back to the source code problem. Which source needs to be recompiled? OpenNI, NITE, or the Kinect driver?

I am having the same problem for Windows 7 64-bit. I cant seem to compile the OpenNI code for 64 bit. I get the same error message as NeilM.

In order to interface the kinect to Matlab using Kinect for MATLAB download | SourceForge.net the the 64 bit dll files :frowning:

I got it working by using another Kinect driver and by making sure to uninstall the Freenect drivers (In case you have them installed)
https://github.com/avin2/SensorKinect

If anyone is running into this error when trying to run the redistmaker.bat file, make sure you have extracted the openni unstable branch .zip file to your programfiles(x86) and run the .bat from there, it will then proceed as expected.

Was anyone able to find a solution for this error? This comes up on Windows 7 64bit OS. I get the “Failed to get registry value!” error with the OpenNI installation. I have the Visual Studio 2010 installed.

Got the solution:
You need to change the Registry values in “\Platform\Win32\CreateRedist\Redist_OpenNi.py”

Line 159: MSVC_KEY = (win32con.HKEY_LOCAL_MACHINE, r"SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0")

Line 164: MSVC_KEY = (win32con.HKEY_LOCAL_MACHINE, r"SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0")

Line 169: NSIS_KEY = (win32con.HKEY_LOCAL_MACHINE, r"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\NSIS")

This created the “OPENNI-Win32-1.0.0.exe” for me.

Unfortunately, I tried this but still won’t work

Thank you so much!!! This was my final solution!!!

Hey guys, sorry about resurrecting this oldish thread, but I am having a similar problem to the one above. When I run the Redistmaker.bat I get:

I have Windows 7 64bit, I have installed Visual Studio Basic 10.0, Python 2.7.1, PYWin 2.7, and the patch as ordered from the readme. I have also tried the above fixes of moving around my folder and changing the locations in Redist_OpenNI.py. As far as I can tell the problem seems to be occuring in:

Specifically, the problem seems to be occurring when get_reg_values fails. Maybe Windows is blocking it from getting the registry values in some way? I have tried turning the slider on UAC all the way down, and installing using both normal and administrator priveledges.

Any help would be greatly appreciated :slight_smile:

If your OpenNi.dll is missing, go to control panel > system > advanced settings > environment variables > find OPEN_NI_BIN in your variables list > make sure the path is correct and is pointing to C:\Program Files\OpenNI\Bin NOT C:\Program Files\OpenNI_bin_