I have installed KinectV2 SDK on my Windows 10 system and test it successfully inside SDK browsers.
I tried to run some code from Pykinect2 library but there was an issues while importing:
from pykinect2 import PyKinectV2
Error:
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
Cell In[2], line 1
----> 1 from pykinect2 import PyKinectV2
2 from pykinect2.PyKinectV2 import *
File ~\Anaconda3\envs\kinect-env\lib\site-packages\pykinect2\PyKinectV2.py:2216
2131 ################################################################
2132 ## code template for ICoordinateMapper implementation
2133 ##class ICoordinateMapper_Impl(object):
(...)
2200 ## #return colorPoint
2201 ##
2203 tagSTATSTG._fields_ = [
2204 ('pwcsName', WSTRING),
2205 ('type', c_ulong),
(...)
2214 ('reserved', c_ulong),
2215 ]
-> 2216 assert sizeof(tagSTATSTG) == 72, sizeof(tagSTATSTG)
2217 assert alignment(tagSTATSTG) == 8, alignment(tagSTATSTG)
2218 IAudioBeamList._methods_ = [
2219 COMMETHOD(['propget'], HRESULT, 'BeamCount',
2220 ( ['retval', 'out'], POINTER(c_uint), 'count' )),
(...)
2223 ( ['out'], POINTER(POINTER(IAudioBeam)), 'AudioBeam' )),
2224 ]
AssertionError: 80
How to resolve it?
This seems to be a rather usual error (see here and here). Here is the remedy according to a thread in the PyKinect2 Github repo:
Notice that, according to your error trace, the error stems exactly from
assert sizeof(tagSTATSTG) == 72on line 2216 ofPyKinectV2.py, as argued in the Github thread.According to a relevant Reddit thread, changing the line to
assert sizeof(tagSTATSTG) == 80should also work.In any case, you should keep in mind that PyKinect2 seems abandoned since ~8 years ago.