Permalink
Browse files

Initial kinect compatability

  • Loading branch information...
1 parent 7c57716 commit 75d38d767384b0bee0a6f5fcb252e3b5593aa07a @avin2 committed Dec 9, 2010
Showing with 98 additions and 39 deletions.
  1. +43 −30 Platform/Win32/Build/Engine.sln
  2. +27 −2 README
  3. +28 −7 Source/XnDeviceSensorV2/Registration.cpp
View
73 Platform/Win32/Build/Engine.sln
@@ -1,36 +1,49 @@
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{19091980-2008-4CFA-1491-04CC20D8BCF9}") = "XnCore", "XnCore\XnCore.vcproj", "{7410A46D-8120-4C95-B7B4-BC8AFEBBBD5A}"
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XnCore", "XnCore\XnCore.vcxproj", "{7410A46D-8120-4C95-B7B4-BC8AFEBBBD5A}"
EndProject
-Project("{19091980-2008-4CFA-1491-04CC20D8BCF9}") = "XnFormats", "XnFormats\XnFormats.vcproj", "{9CAEC325-EEE6-4A91-8819-004E20C419C0}"
- ProjectSection(ProjectDependencies) = postProject
- {7410A46D-8120-4C95-B7B4-BC8AFEBBBD5A} = {7410A46D-8120-4C95-B7B4-BC8AFEBBBD5A}
- EndProjectSection
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XnFormats", "XnFormats\XnFormats.vcxproj", "{9CAEC325-EEE6-4A91-8819-004E20C419C0}"
EndProject
-Project("{19091980-2008-4CFA-1491-04CC20D8BCF9}") = "XnDDK", "XnDDK\XnDDK.vcproj", "{FB08A9D1-10AF-418D-8786-F58FDF11254D}"
- ProjectSection(ProjectDependencies) = postProject
- {7410A46D-8120-4C95-B7B4-BC8AFEBBBD5A} = {7410A46D-8120-4C95-B7B4-BC8AFEBBBD5A}
- {9CAEC325-EEE6-4A91-8819-004E20C419C0} = {9CAEC325-EEE6-4A91-8819-004E20C419C0}
- EndProjectSection
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XnDDK", "XnDDK\XnDDK.vcxproj", "{FB08A9D1-10AF-418D-8786-F58FDF11254D}"
EndProject
-Project("{19091980-2008-4CFA-1491-04CC20D8BCF9}") = "XnDeviceSensorV2", "XnDeviceSensorV2\XnDeviceSensorV2.vcproj", "{1653839A-ABA5-4c0e-9EA2-2640B0275894}"
- ProjectSection(ProjectDependencies) = postProject
- {FB08A9D1-10AF-418D-8786-F58FDF11254D} = {FB08A9D1-10AF-418D-8786-F58FDF11254D}
- {9CAEC325-EEE6-4A91-8819-004E20C419C0} = {9CAEC325-EEE6-4A91-8819-004E20C419C0}
- {7410A46D-8120-4C95-B7B4-BC8AFEBBBD5A} = {7410A46D-8120-4C95-B7B4-BC8AFEBBBD5A}
- EndProjectSection
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XnDeviceSensorV2", "XnDeviceSensorV2\XnDeviceSensorV2.vcxproj", "{1653839A-ABA5-4C0E-9EA2-2640B0275894}"
EndProject
-Project("{19091980-2008-4CFA-1491-04CC20D8BCF9}") = "Utils\XnSensorServer", "Utils\XnSensorServer\XnSensorServer.vcproj", "{F68C824E-EA49-4A3C-A233-ADE2B3ECC375}"
- ProjectSection(ProjectDependencies) = postProject
- {FB08A9D1-10AF-418D-8786-F58FDF11254D} = {FB08A9D1-10AF-418D-8786-F58FDF11254D}
- {1653839A-ABA5-4c0e-9EA2-2640B0275894} = {1653839A-ABA5-4c0e-9EA2-2640B0275894}
- {9CAEC325-EEE6-4A91-8819-004E20C419C0} = {9CAEC325-EEE6-4A91-8819-004E20C419C0}
- EndProjectSection
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XnSensorServer", "Utils\XnSensorServer\XnSensorServer.vcxproj", "{F68C824E-EA49-4A3C-A233-ADE2B3ECC375}"
EndProject
-Project("{19091980-2008-4CFA-1491-04CC20D8BCF9}") = "XnDeviceFile", "XnDeviceFile\XnDeviceFile.vcproj", "{7410A46D-8120-4C95-B7B4-BC8AFEBBBD5B}"
- ProjectSection(ProjectDependencies) = postProject
- {7410A46D-8120-4C95-B7B4-BC8AFEBBBD5A} = {7410A46D-8120-4C95-B7B4-BC8AFEBBBD5A}
- {FB08A9D1-10AF-418D-8786-F58FDF11254D} = {FB08A9D1-10AF-418D-8786-F58FDF11254D}
- {9CAEC325-EEE6-4A91-8819-004E20C419C0} = {9CAEC325-EEE6-4A91-8819-004E20C419C0}
- EndProjectSection
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XnDeviceFile", "XnDeviceFile\XnDeviceFile.vcxproj", "{7410A46D-8120-4C95-B7B4-BC8AFEBBBD5B}"
EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {7410A46D-8120-4C95-B7B4-BC8AFEBBBD5A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7410A46D-8120-4C95-B7B4-BC8AFEBBBD5A}.Debug|Win32.Build.0 = Debug|Win32
+ {7410A46D-8120-4C95-B7B4-BC8AFEBBBD5A}.Release|Win32.ActiveCfg = Release|Win32
+ {7410A46D-8120-4C95-B7B4-BC8AFEBBBD5A}.Release|Win32.Build.0 = Release|Win32
+ {9CAEC325-EEE6-4A91-8819-004E20C419C0}.Debug|Win32.ActiveCfg = Debug|Win32
+ {9CAEC325-EEE6-4A91-8819-004E20C419C0}.Debug|Win32.Build.0 = Debug|Win32
+ {9CAEC325-EEE6-4A91-8819-004E20C419C0}.Release|Win32.ActiveCfg = Release|Win32
+ {9CAEC325-EEE6-4A91-8819-004E20C419C0}.Release|Win32.Build.0 = Release|Win32
+ {FB08A9D1-10AF-418D-8786-F58FDF11254D}.Debug|Win32.ActiveCfg = Debug|Win32
+ {FB08A9D1-10AF-418D-8786-F58FDF11254D}.Debug|Win32.Build.0 = Debug|Win32
+ {FB08A9D1-10AF-418D-8786-F58FDF11254D}.Release|Win32.ActiveCfg = Release|Win32
+ {FB08A9D1-10AF-418D-8786-F58FDF11254D}.Release|Win32.Build.0 = Release|Win32
+ {1653839A-ABA5-4C0E-9EA2-2640B0275894}.Debug|Win32.ActiveCfg = Debug|Win32
+ {1653839A-ABA5-4C0E-9EA2-2640B0275894}.Debug|Win32.Build.0 = Debug|Win32
+ {1653839A-ABA5-4C0E-9EA2-2640B0275894}.Release|Win32.ActiveCfg = Release|Win32
+ {1653839A-ABA5-4C0E-9EA2-2640B0275894}.Release|Win32.Build.0 = Release|Win32
+ {F68C824E-EA49-4A3C-A233-ADE2B3ECC375}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F68C824E-EA49-4A3C-A233-ADE2B3ECC375}.Debug|Win32.Build.0 = Debug|Win32
+ {F68C824E-EA49-4A3C-A233-ADE2B3ECC375}.Release|Win32.ActiveCfg = Release|Win32
+ {F68C824E-EA49-4A3C-A233-ADE2B3ECC375}.Release|Win32.Build.0 = Release|Win32
+ {7410A46D-8120-4C95-B7B4-BC8AFEBBBD5B}.Debug|Win32.ActiveCfg = Debug|Win32
+ {7410A46D-8120-4C95-B7B4-BC8AFEBBBD5B}.Debug|Win32.Build.0 = Debug|Win32
+ {7410A46D-8120-4C95-B7B4-BC8AFEBBBD5B}.Release|Win32.ActiveCfg = Release|Win32
+ {7410A46D-8120-4C95-B7B4-BC8AFEBBBD5B}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
View
29 README
@@ -1,6 +1,31 @@
-PrimeSensor Modules for OpenNI
+SensorKinect Module for OpenNI
------------------------------
-Website: www.primesense.com
+
+Kinect Mod:
+-----------
+
+It seems that the PrimeSensor and the Kinect are almost 100% identical!
+
+Changes:
+ 1) Added the kinect USB VID/PID to the PSDrv3 driver and to the code.
+ 2) Changed the packet sequence field from 16-bit to 8-bit (don't know why it's different...)
+ 3) Changed the image format from YUV to 8-bit uncompressed bayer in the GlobalDefaults.ini file.
+ 4) Fixed the software depth-to-RGB registration. (Thanks ROS.org for that!)
+
+Notes:
+ 1) The precompiled windows version is inside the BIN directory. Since the driver is not signed, you might have to install it manually.
+ 2) Since I've used VS2010 to build the driver, you will need to have the VS2010 redist installed.
+ 3) Many resolutions/formats are not working yet... For example: The kinect will only agree to output VGA resolution.
+ 4) I don't have a linux machine so I didn't try it, but my guess is that it would work just fine...
+
+PrimeSense NITE algorithim:
+ If you want to try it please do the following:
+ 1) Install OpenNI (from www.openni.org)
+ 2) Install Sensor (this version...)
+ 3) Install NITE (from www.openni.org)
+ 4) Run the NiViewer sample to make sure depth & image streams are working.
+ 5) Run the NiUserTracker sample play with the skeleton.
+
Release Notes:
--------------
View
35 Source/XnDeviceSensorV2/Registration.cpp
@@ -480,17 +480,29 @@ void XnRegistration::Apply1000(XnDepthPixel* pInput, XnDepthPixel* pOutput)
nNewX = (XnInt32)(XnDouble(*pRegTable)/XN_REG_X_SCALE + XnInt32(pDepth2ShiftTable[nValue]/XN_REG_PARAB_COEFF - nConstShift) * dShiftFactor);
nNewY = *(pRegTable+1);
- if ((XnUInt32)nNewX-1 < (XnUInt32)nDepthXRes-1)
+ if ( nNewX < nDepthXRes && nNewY < nDepthYRes )
{
nArrPos = nNewY * nDepthXRes + nNewX;
nOutValue = pOutput[nArrPos];
if (nOutValue == 0 || nOutValue > nValue)
{
+ if ( nNewX > 0 && nNewY > 0 )
+ {
+ pOutput[nArrPos-nDepthXRes] = nValue;
+ pOutput[nArrPos-nDepthXRes-1] = nValue;
+ pOutput[nArrPos-1] = nValue;
+ }
+ else if( nNewY > 0 )
+ {
+ pOutput[nArrPos-nDepthXRes] = nValue;
+ }
+ else if( nNewX > 0 )
+ {
+ pOutput[nArrPos-1] = nValue;
+ }
+
pOutput[nArrPos] = nValue;
- pOutput[nArrPos-1] = nValue;
- pOutput[nArrPos-nDepthXRes] = nValue;
- pOutput[nArrPos-nDepthXRes-1] = nValue;
}
}
}
@@ -533,7 +545,7 @@ void XnRegistration::Apply1080(XnDepthPixel* pInput, XnDepthPixel* pOutput)
nNewX = (XnUInt32)(*pRegTable + pRGBRegDepthToShiftTable[nValue]) / RGB_REG_X_VAL_SCALE;
nNewY = *(pRegTable+1);
- if (nNewX < nDepthXRes)
+ if (nNewX < nDepthXRes && nNewY < nDepthYRes )
{
nArrPos = bMirror ? (nNewY+1)*nDepthXRes - nNewX - 2 : (nNewY*nDepthXRes) + nNewX;
nArrPos -= nConstOffset;
@@ -542,12 +554,21 @@ void XnRegistration::Apply1080(XnDepthPixel* pInput, XnDepthPixel* pOutput)
if ((nOutValue == XN_DEVICE_SENSOR_NO_DEPTH_VALUE) || (nOutValue > nValue))
{
- if (nArrPos > nDepthXRes+1)
+ if ( nNewX > 0 && nNewY > 0 )
{
+ pOutput[nArrPos-nDepthXRes] = nValue;
pOutput[nArrPos-nDepthXRes-1] = nValue;
+ pOutput[nArrPos-1] = nValue;
+ }
+ else if( nNewY > 0 )
+ {
pOutput[nArrPos-nDepthXRes] = nValue;
}
- pOutput[nArrPos-1] = nValue;
+ else if( nNewX > 0 )
+ {
+ pOutput[nArrPos-1] = nValue;
+ }
+
pOutput[nArrPos] = nValue;
}
}

0 comments on commit 75d38d7

Please sign in to comment.