http://www.youtube.com/watch?v=fK7wLhdLDpU
Amir
Interesting... Any details on implementation? I'm not really sure if this is showing two Kinects or an OpenNI plug in for the Kinect SDK.
I've been able to build the NiSampleModule example in OpenNI with some
modifications that cause it to initialize the Kinect SDK.
I can also register it with niReg as a Depth node. the only difficult
part was you have to run niReg as administrator (I spent 2 hours on
that part and like 5 minutes on the rest)
Almost there....
Amir
I am modifying NiSampleModule to get depth from msft Kinect SDK and
feed it to OpenNI.
First the DLL hell stuff in VS2010:
your "additional dependencies" in the project properties -> linker ->
input add MSRKinectNUI.lib
MSRKinectNUI.lib;openNI.lib;%(AdditionalDependencies)
i dragged the msrkinectnui.lib into my project too for good measure
in the VC++ directories settings:
$(MSRKINECTSDK)\inc to include
$(MSRKINECTSDK)\lib to libraries
in SampleDepth.cpp i now initialize the kinect with the Kinect SDK. I
needed to include some headers:
#include "wtypes.h"
#include "MSR_NuiApi.h"
..
and modify init:
XnStatus SampleDepth::Init()
{
m_pDepthMap = new XnDepthPixel[SUPPORTED_X_RES * SUPPORTED_Y_RES];
if (m_pDepthMap == NULL)
{
return XN_STATUS_ALLOC_FAILED;
}
m_hNextDepthFrameEvent = CreateEvent( NULL, TRUE, FALSE, NULL );
HRESULT hr;
hr = NuiInitialize(
NUI_INITIALIZE_FLAG_USES_DEPTH_AND_PLAYER_INDEX |
NUI_INITIALIZE_FLAG_USES_SKELETON | NUI_INITIALIZE_FLAG_USES_COLOR);
if( FAILED( hr ) )
{
// MessageBoxResource(m_hWnd,IDS_ERROR_NUIINIT,MB_OK | MB_ICONHAND);
return XN_STATUS_ALLOC_FAILED;;
}
hr = NuiImageStreamOpen(
NUI_IMAGE_TYPE_DEPTH_AND_PLAYER_INDEX,
NUI_IMAGE_RESOLUTION_320x240,
0,
2,
m_hNextDepthFrameEvent,
&m_pDepthStreamHandle );
if( FAILED( hr ) )
{
// MessageBoxResource(m_hWnd,IDS_ERROR_DEPTHSTREAM,MB_OK | MB_ICONHAND);
return XN_STATUS_ILLEGAL_POSITION ;
}
return (XN_STATUS_OK);
}
the XnStatus return types in the hr error is just me being ridiculous.
also in SampleDepth.h
XnBool m_bMirror;
ChangeEvent m_generatingEvent;
ChangeEvent m_dataAvailableEvent;
ChangeEvent m_mirrorEvent;
//ADDED BY AMIR FOR KinectSDK binding
HANDLE m_hThNuiProcess;
HANDLE m_hEvNuiProcessStop;
HANDLE m_pDepthStreamHandle;
HANDLE m_hNextDepthFrameEvent;
};
now i build it and then register it with: nireg -r NiSampleModule.dll
(don't forget to run this step in admin mode)
nireg -l now lists my samplemodule.dll
F:\Hacking\OpenNI\OpenNI\Platform\Win32\Bin\Debug\NiSampleModule.dll (compiled w
ith OpenNI 1.1.0.39):
Depth: OpenNI/SampleDepth/1.1.0.39
i was getting problems that looked like this:
F:\Hacking\OpenNI\OpenNI\Platform\Win32\Bin\Debug\NiSampleModule.dll 26920
[WARNING] Failed to load library 'F:\Hacking\OpenNI\OpenNI\Platform\Win32\
Bin\Debug\NiSampleModule.dll'. Error code: 87
27160 [WARNING] Failed to load 'F:\Hacking\OpenNI\OpenNI\Platfor
m\Win32\Bin\Debug\NiSampleModule.dll' - missing dependencies?
this error occured until i included the MSRKinectNUI.lib in the
additional dependencies. but then after several hours discovered my
folly.
ok so then i modified samplesconfig.xml in the OpenNI/data directory
to look only for a depth node (i'm testing with usertracker which only
consumes depth)
<OpenNI>
<Licenses>
<!-- Add licenses here
<License vendor="vendor" key="key"/>
-->
</Licenses>
<Log writeToConsole="false" writeToFile="false">
<!-- 0 - Verbose, 1 - Info, 2 - Warning, 3 - Error (default) -->
<LogLevel value="3"/>
<Masks>
<Mask name="ALL" on="true"/>
</Masks>
<Dumps>
</Dumps>
</Log>
<ProductionNodes>
<Node type="Depth" name="Depth1">
<Configuration>
<Mirror on="true"/>
</Configuration>
</Node>
</ProductionNodes>
</OpenNI>
now i haven't started the NUIThread and mapped the depth frames to
OpenNI, but when i run UserTracker my kinect turns on, implying a
connection between openni and kinectsdk is working.
so now someone else can avoid my errors and probably get it done
tomorrow before i even wake up.
Amir
But when I try to use the usertracker example I get some nonsense
about maxShift:
C:\Program Files (x86)\OpenNI\Samples\Bin\Release>NiUserTracker.exe
Attempting to open \\?\USB#VID_045E&PID_02AE#B00363600976047B#{00873FDF-61A8-11D
1-EF5E-00C04F2D728B}\00
KinWinDeviceName = (\\?\USB#VID_045E&PID_02AE#B00363600976047B#{00873FDF-61A8-11
D1-EF5E-00C04F2D728B}\00\PIPE01)
KinectCamera_OpenStreamEndpoint Opened successfully.
Couldn't get maxShift.
Couldn't get maxShift.
Find user generator failed: Error!
working on it..
Amir
For everyone's reference, if you install Tomoto's dll and run
UserTracker (which uses NITE) you'll see that NITE looks for some
property called maxShift:
C:\Program Files (x86)\OpenNI\Samples\Bin\Release>NiUserTracker.exe
Attempting to open \\?\USB#VID_045E&PID_02AE#B00366707565050B#{00873FDF-61A8-11D
1-EF5E-00C04F2D728B}\00
KinWinDeviceName = (\\?\USB#VID_045E&PID_02AE#B00366707565050B#{00873FDF-61A8-11
D1-EF5E-00C04F2D728B}\00\PIPE01)
KinectCamera_OpenStreamEndpoint Opened successfully.
KinWinDeviceName = (\\?\USB#VID_045E&PID_02AE#B00366707565050B#{00873FDF-61A8-11
D1-EF5E-00C04F2D728B}\00\PIPE00)
KinectCamera_OpenStreamEndpoint Opened successfully.
Couldn't get maxShift.
Couldn't get maxShift.
Find user generator failed: Error!
I've gone down the rabbit hole of the Sensor code inheritance (someone
at PrimeSense really likes extending classes, huh?) I've discovered
that the MaxShift is a property requested through a GetIntProperty
request in the XnSensorProductionNode:
I added this little work-around to the MSRKinectDepthGenerator which
just reports 2047 when asked for the IntProperty "MaxShift"
(frankly, i don't think this property actually matters and I wonder
why NITE has dependencies on hidden properties)
XnStatus MSRKinectDepthGenerator::GetIntProperty(const XnChar*
strName, XnUInt64& nValue) const
{
if (strName== "MaxShift")
{
nValue = 2047;
}
return XN_STATUS_OK;
}
so now it gets a MaxShift and the error looks like this saying it
can't find the shift2Depth table:
C:\Program Files (x86)\OpenNI\Samples\Bin\Release>NiUserTracker.exe
Attempting to open \\?\USB#VID_045E&PID_02AE#B00366707565050B#{00873FDF-61A8-11D
1-EF5E-00C04F2D728B}\00
KinWinDeviceName = (\\?\USB#VID_045E&PID_02AE#B00366707565050B#{00873FDF-61A8-11
D1-EF5E-00C04F2D728B}\00\PIPE01)
KinectCamera_OpenStreamEndpoint Opened successfully.
KinWinDeviceName = (\\?\USB#VID_045E&PID_02AE#B00366707565050B#{00873FDF-61A8-11
D1-EF5E-00C04F2D728B}\00\PIPE00)
KinectCamera_OpenStreamEndpoint Opened successfully.
Couldn't get shift2Depth table.
Couldn't get shift2Depth table.
ONWARD.
2011/6/22 Tomoto <tom...@gmail.com>:
>> もっと読む ≫
XnStatus MSRKinectDepthGenerator::GetIntProperty(const XnChar*
strName, XnUInt64& nValue) const
{
return XN_STATUS_OK;
}
XnStatus MSRKinectDepthGenerator::GetGeneralProperty(const XnChar*
strName, XnUInt32 nBufferSize, void* pBuffer) const
{
return XN_STATUS_OK;
}
2011/6/23 Amir Hirsch <am...@tinkerheavy.com>:
dValue in the GetRealProperty
nValue in the GetIntProperty
Unfortunately it doesn't track the user.... but it runs.
XnStatus MSRKinectDepthGenerator::GetIntProperty(const XnChar*
strName, XnUInt64& nValue) const
{
nValue = 2047;
return XN_STATUS_OK;
}
XnStatus MSRKinectDepthGenerator::GetGeneralProperty(const XnChar*
strName, XnUInt32 nBufferSize, void* pBuffer) const
{
return XN_STATUS_OK;
}
XnStatus MSRKinectDepthGenerator::GetStringProperty(const XnChar*
strName, XnChar* csValue, XnUInt32 nBufSize) const
{
return XN_STATUS_OK;
}
XnStatus MSRKinectDepthGenerator::GetRealProperty(const XnChar*
strName, XnDouble& dValue) const
{
dValue = 1.0;
return XN_STATUS_OK;
}
On Thu, Jun 23, 2011 at 1:32 AM, Tomoto <tom...@gmail.com> wrote:
GetProperty (INT): SupportedModesCount : 15
GetProperty (INT): ZPD : 120
GetProperty (REAL): ZPPS : 536870912
GetProperty (INT): SupportedModesCount : 11
GetProperty (INT): MaxShift : 2047
GetProperty (INT): ZPD : 120
GetProperty (REAL): ZPPS : 536870912
GetProperty (REAL): LDDIS : 0
GetProperty (REAL): ZPPS : 536870912
GetProperty (INT): ZPD : 120
GetProperty (REAL): ZPPS : 536870912
GetProperty (INT): ZPD : 120
GetProperty (REAL): ZPPS : 536870912
GetProperty (INT): ZPD : 120
GetProperty (INT): ConstShift : 200
GetProperty (INT): ConstShift : 200
2011/6/23 Amir Hirsch <am...@tinkerheavy.com>:
GetProperty (INT): SupportedModesCount : 15
GetProperty (INT): ZPD : 120
GetProperty (REAL): ZPPS : 0.105200
GetProperty (INT): SupportedModesCount : 11
GetProperty (INT): MaxShift : 2047
GetProperty (INT): ZPD : 120
GetProperty (REAL): ZPPS : 0.105200
GetProperty (REAL): LDDIS : 7.500000
GetProperty (REAL): ZPPS : 0.105200
GetProperty (INT): ZPD : 120
GetProperty (REAL): ZPPS : 0.105200
GetProperty (INT): ZPD : 120
GetProperty (REAL): ZPPS : 0.105200
GetProperty (INT): MaxShift : 2047
GetProperty (INT): ZPD : 120
GetProperty (REAL): ZPPS : 0.105200
GetProperty (REAL): LDDIS : 7.500000
GetProperty (REAL): ZPPS : 0.105200
GetProperty (INT): ZPD : 120
GetProperty (REAL): ZPPS : 0.105200
GetProperty (INT): ZPD : 120
GetProperty (REAL): ZPPS : 0.105200
GetProperty (INT): ZPD : 120
GetProperty (REAL): ZPPS : 0.105200
GetProperty (INT): ZPD : 120
GetProperty (INT): ConstShift : 200
GetProperty (INT): ConstShift : 200
This all came up back in December, this thread is great:
http://groups.google.com/group/openni-dev/browse_thread/thread/f9dbfd4069722f9d
I'm nearly certain I can make a module that tricks NITE into thinking
our KinectSDK depth node is a sensorkinect equivalent.
But it's more interesting to get the user-map and their skeleton data
into OpenNI. We can generate the rotation matrices from the Position
data and also add in some pose detection capabilities. We'll need to
establish a user acquisition method that takes advantage of not
needing any calibration.
Amir
2011/6/23 Amir Hirsch <am...@tinkerheavy.com>:
Amir
2011/6/26 Tomoto <tom...@gmail.com>:
virtual XnBool NeedPoseForCalibration() { return FALSE; // yay! }
> ...
>
> もっと読む ≫