如何使用 libfreenect2 设置 OpenNI2 和 NITE 以在 OSX 上进行骨骼跟踪?
How to setup OpenNI2 and NITE with libfreenect2 for skeleton tracking on OSX?
我刚刚在 OSX 10.11.5 上设置了 libfreenect2,我可以成功 运行 Protonect 演示显示 RGB/IR/depth 流,但我想也使用 OpenNI/NITE 进行骨骼追踪。
我已经按照 OpenNI 的 repo README 文件中的说明进行操作,但是当我尝试 运行 NiViewer 时,我得到了这个:
NiViewer
openDevice failed:
DeviceOpen using default: no devices found
Press any key to continue . . .
我目前正在 github 上解决 libfreenect2 问题并记录我正在尝试的内容和结果 here。任何 hints/tips 都有帮助。
在 OSX 上使用 Kinect v2 使用 libfreenect2 设置和测试 OpenNI/NITE 的最简单方法是什么?
原来我应该使用 NiTE2.2 而使用 NiTE 1.5
我只是将 libfreenect2-openni2.0.dylib
从 libfreenect2/build/lib
复制到 NiTE-MacOSX-x64-2.2/Samples/Bin/OpenNI2/Drivers/
然后 运行 SimpleUserTracker
示例并且它起作用了!
还有一个问题:示例仅打印到控制台 运行,但打开 window 并呈现的示例不起作用。没有 window 被呈现,就好像那个线程被某种方式阻塞了一样。
那是我使用集成英特尔 GPU 的时候。如果我使用独立的 nVidia GPU,应用程序会崩溃:
./UserViewer
124095 INFO New log started on 2016-08-30 20:32:19
124114 INFO --- Filter Info --- Minimum Severity: VERBOSE
126001 VERBOSE No override device in configuration file
126029 VERBOSE Configuration has been read from '/Users/George/Downloads/Grouped/Projects/code+libs/NiTE-MacOSX-x64-2.2/Samples/Bin/OpenNI.ini'
126034 VERBOSE OpenNI 2.2.0 (Build 21)-MacOSX (May 29 2013 14:03:30)
126038 VERBOSE Using '/Users/George/Downloads/Grouped/Projects/code+libs/NiTE-MacOSX-x64-2.2/Samples/Bin/OpenNI2/Drivers' as driver path
126042 VERBOSE Looking for drivers in drivers repository '/Users/George/Downloads/Grouped/Projects/code+libs/NiTE-MacOSX-x64-2.2/Samples/Bin/OpenNI2/Drivers'
161329 INFO New log started on 2016-08-30 20:32:19
161447 INFO --- Filter Info --- Minimum Severity: VERBOSE
161457 VERBOSE Initializing USB...
166761 INFO USB is initialized.
286714 INFO New log started on 2016-08-30 20:32:19
286762 INFO --- Filter Info --- Minimum Severity: VERBOSE
286781 VERBOSE Initializing USB...
286804 INFO USB is initialized.
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 7 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @20:16 with serial 500722542042
[Info] [Freenect2Impl] found 1 devices
5380695 INFO Found device freenect2://0
5380723 INFO Driver: register new uri: freenect2://0
5381065 INFO Device connected: Microsoft Kinect (freenect2://0)
5381101 INFO Device state changed: Microsoft Kinect (freenect2://0) to 0
5381115 INFO Driver: register new uri: freenect2://0?depth-size=640x480
5381123 INFO Device connected: Microsoft Kinect (freenect2://0?depth-size=640x480)
5381132 INFO Device state changed: Microsoft Kinect (freenect2://0?depth-size=640x480) to 0
5381139 INFO Driver: register new uri: freenect2://0?depth-size=512x424
5381149 INFO Device connected: Microsoft Kinect (freenect2://0?depth-size=512x424)
5381157 INFO Device state changed: Microsoft Kinect (freenect2://0?depth-size=512x424) to 0
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 7 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @20:16 with serial 500722542042
[Info] [Freenect2Impl] found 1 devices
10381916 VERBOSE Trying to open device by URI '(NULL)'
10381940 INFO deiveOpen: freenect2://0
10381948 INFO Opening device freenect2://0
[Info] [Freenect2DeviceImpl] opening...
[Info] [Freenect2DeviceImpl] transfer pool sizes rgb: 20*16384 ir: 4*128*33792
[Info] [Freenect2DeviceImpl] opened
12312037 VERBOSE Initialize: Already initialized
12314810 INFO Device: createStream(depth)
12314892 INFO Freenect2Driver::Device: start()
[Info] [Freenect2DeviceImpl] starting...
[Info] [Freenect2DeviceImpl] submitting rgb transfers...
[Info] [Freenect2DeviceImpl] submitting depth transfers...
[Info] [Freenect2DeviceImpl] started
2016-08-30 20:32:31.847 UserViewer[7575:4995528] GLUT Warning: glutInit being called a second time.
[Info] [VTRgbPacketProcessor] avg. time: 19.633ms -> ~50.9346Hz
[Info] [VTRgbPacketProcessor] avg. time: 19.6306ms -> ~50.9408Hz
[Info] [VTRgbPacketProcessor] avg. time: 19.0744ms -> ~52.4262Hz
[Info] [DepthPacketStreamParser] 417 packets were lost
Segmentation fault: 11
我怎样才能解决这个问题?
以上注释作为参考,供参考。
这就是我用 libfreenect2 和它的 OpenNI2 驱动程序获得 OpenNI2/NITE2.2 骨架跟踪的方法。我有:
- 通过自制软件编译安装的 OpenNI2,并根据 github repo's readme instructions
编译带有 OpenNI2 支持的 libfreenect2
- 下载NITE2.2(替换我之前用错的Nite1.5)
- 将 libfreenect2 OpenNI2 驱动程序 (ibfreenect2/build/lib/libfreenect2-openni2.0.dylib) 复制到我需要 运行 NITE2 的
Drivers
文件夹(例如 NiTE-MacOSX-x64-2.2/Samples/Bin/OpenNI2/Drivers
)。
我通过在 OpenNI.ini 中将日志级别设置为详细来找出路径错误:
[Log]
; 0 - Verbose; 1 - Info; 2 - Warning; 3 - Error. Default - None
Verbosity=0
LogToConsole=1
LogToFile=1
[Device]
;Override=""
[Drivers]
; Location of the drivers specified by a relative path based on OpenNI's shared library or an absolute path.
; Path separator "/" can be used to be portable for any platforms.
; Default - OpenNI2/Drivers
Repository=OpenNI2/Drivers
Symon Kaliski 跟着笔记写了一篇精彩的Kinect 2 on OSX with skeleton tracking post using OpenFrameworks,一定要看看!
此外,一旦 libfreenect2 编译后支持 openni2,它甚至可以在处理中使用,只需将 libfreenect2-openni2.0.dylib 放入 /Documents/Processing3/libraries/SimpleOpenNI/library/osx/OpenNI2
(在 OSX 上):
我刚刚在 OSX 10.11.5 上设置了 libfreenect2,我可以成功 运行 Protonect 演示显示 RGB/IR/depth 流,但我想也使用 OpenNI/NITE 进行骨骼追踪。
我已经按照 OpenNI 的 repo README 文件中的说明进行操作,但是当我尝试 运行 NiViewer 时,我得到了这个:
NiViewer
openDevice failed:
DeviceOpen using default: no devices found
Press any key to continue . . .
我目前正在 github 上解决 libfreenect2 问题并记录我正在尝试的内容和结果 here。任何 hints/tips 都有帮助。
在 OSX 上使用 Kinect v2 使用 libfreenect2 设置和测试 OpenNI/NITE 的最简单方法是什么?
原来我应该使用 NiTE2.2 而使用 NiTE 1.5
我只是将 libfreenect2-openni2.0.dylib
从 libfreenect2/build/lib
复制到 NiTE-MacOSX-x64-2.2/Samples/Bin/OpenNI2/Drivers/
然后 运行 SimpleUserTracker
示例并且它起作用了!
还有一个问题:示例仅打印到控制台 运行,但打开 window 并呈现的示例不起作用。没有 window 被呈现,就好像那个线程被某种方式阻塞了一样。 那是我使用集成英特尔 GPU 的时候。如果我使用独立的 nVidia GPU,应用程序会崩溃:
./UserViewer
124095 INFO New log started on 2016-08-30 20:32:19
124114 INFO --- Filter Info --- Minimum Severity: VERBOSE
126001 VERBOSE No override device in configuration file
126029 VERBOSE Configuration has been read from '/Users/George/Downloads/Grouped/Projects/code+libs/NiTE-MacOSX-x64-2.2/Samples/Bin/OpenNI.ini'
126034 VERBOSE OpenNI 2.2.0 (Build 21)-MacOSX (May 29 2013 14:03:30)
126038 VERBOSE Using '/Users/George/Downloads/Grouped/Projects/code+libs/NiTE-MacOSX-x64-2.2/Samples/Bin/OpenNI2/Drivers' as driver path
126042 VERBOSE Looking for drivers in drivers repository '/Users/George/Downloads/Grouped/Projects/code+libs/NiTE-MacOSX-x64-2.2/Samples/Bin/OpenNI2/Drivers'
161329 INFO New log started on 2016-08-30 20:32:19
161447 INFO --- Filter Info --- Minimum Severity: VERBOSE
161457 VERBOSE Initializing USB...
166761 INFO USB is initialized.
286714 INFO New log started on 2016-08-30 20:32:19
286762 INFO --- Filter Info --- Minimum Severity: VERBOSE
286781 VERBOSE Initializing USB...
286804 INFO USB is initialized.
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 7 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @20:16 with serial 500722542042
[Info] [Freenect2Impl] found 1 devices
5380695 INFO Found device freenect2://0
5380723 INFO Driver: register new uri: freenect2://0
5381065 INFO Device connected: Microsoft Kinect (freenect2://0)
5381101 INFO Device state changed: Microsoft Kinect (freenect2://0) to 0
5381115 INFO Driver: register new uri: freenect2://0?depth-size=640x480
5381123 INFO Device connected: Microsoft Kinect (freenect2://0?depth-size=640x480)
5381132 INFO Device state changed: Microsoft Kinect (freenect2://0?depth-size=640x480) to 0
5381139 INFO Driver: register new uri: freenect2://0?depth-size=512x424
5381149 INFO Device connected: Microsoft Kinect (freenect2://0?depth-size=512x424)
5381157 INFO Device state changed: Microsoft Kinect (freenect2://0?depth-size=512x424) to 0
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 7 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @20:16 with serial 500722542042
[Info] [Freenect2Impl] found 1 devices
10381916 VERBOSE Trying to open device by URI '(NULL)'
10381940 INFO deiveOpen: freenect2://0
10381948 INFO Opening device freenect2://0
[Info] [Freenect2DeviceImpl] opening...
[Info] [Freenect2DeviceImpl] transfer pool sizes rgb: 20*16384 ir: 4*128*33792
[Info] [Freenect2DeviceImpl] opened
12312037 VERBOSE Initialize: Already initialized
12314810 INFO Device: createStream(depth)
12314892 INFO Freenect2Driver::Device: start()
[Info] [Freenect2DeviceImpl] starting...
[Info] [Freenect2DeviceImpl] submitting rgb transfers...
[Info] [Freenect2DeviceImpl] submitting depth transfers...
[Info] [Freenect2DeviceImpl] started
2016-08-30 20:32:31.847 UserViewer[7575:4995528] GLUT Warning: glutInit being called a second time.
[Info] [VTRgbPacketProcessor] avg. time: 19.633ms -> ~50.9346Hz
[Info] [VTRgbPacketProcessor] avg. time: 19.6306ms -> ~50.9408Hz
[Info] [VTRgbPacketProcessor] avg. time: 19.0744ms -> ~52.4262Hz
[Info] [DepthPacketStreamParser] 417 packets were lost
Segmentation fault: 11
我怎样才能解决这个问题?
以上注释作为参考,供参考。 这就是我用 libfreenect2 和它的 OpenNI2 驱动程序获得 OpenNI2/NITE2.2 骨架跟踪的方法。我有:
- 通过自制软件编译安装的 OpenNI2,并根据 github repo's readme instructions 编译带有 OpenNI2 支持的 libfreenect2
- 下载NITE2.2(替换我之前用错的Nite1.5)
- 将 libfreenect2 OpenNI2 驱动程序 (ibfreenect2/build/lib/libfreenect2-openni2.0.dylib) 复制到我需要 运行 NITE2 的
Drivers
文件夹(例如NiTE-MacOSX-x64-2.2/Samples/Bin/OpenNI2/Drivers
)。
我通过在 OpenNI.ini 中将日志级别设置为详细来找出路径错误:
[Log]
; 0 - Verbose; 1 - Info; 2 - Warning; 3 - Error. Default - None
Verbosity=0
LogToConsole=1
LogToFile=1
[Device]
;Override=""
[Drivers]
; Location of the drivers specified by a relative path based on OpenNI's shared library or an absolute path.
; Path separator "/" can be used to be portable for any platforms.
; Default - OpenNI2/Drivers
Repository=OpenNI2/Drivers
Symon Kaliski 跟着笔记写了一篇精彩的Kinect 2 on OSX with skeleton tracking post using OpenFrameworks,一定要看看!
此外,一旦 libfreenect2 编译后支持 openni2,它甚至可以在处理中使用,只需将 libfreenect2-openni2.0.dylib 放入 /Documents/Processing3/libraries/SimpleOpenNI/library/osx/OpenNI2
(在 OSX 上):