简体   繁体   English

2019年Kinect-Python-OpenCV的状态

[英]State of Kinect-Python-OpenCV in 2019

This question might be slightly off-topic here as it could be interpreted as "looking for software resources" albeit I would like it to be understood as "request for best practice" and couldn't find any other Stack-Exchange Site where this would be more appropriate so: 这个问题在这里可能有点偏离主题,因为它可能被解释为“寻找软件资源”,尽管我希望将其理解为“对最佳实践的要求”,并且找不到其他可以在其中找到它的Stack-Exchange网站这样更合适:

I happened to get my hands on a MS Kinect depth camera this week. 本周,我碰巧接触了一台MS Kinect深度相机。 All tutorials and resources I find are either massively outdated (MS) or overly complicated. 我发现的所有教程和资源都已经过时(MS)或过于复杂。 My question is: 我的问题是:

What is the easiest way to get a depth image out of a Kinect and ready to be processed in 2019 - Ideally using OpenCV with Python? 从Kinect中获取深度图像并准备在2019年进行处理的最简单方法是什么?理想情况下,将OpenCV与Python配合使用?

I tried: 我试过了:

Windows 10 + libusbK + freenect + anaconda + openCV Windows 10 + libusbK + freenect + anaconda + openCV

There's a lot of manual compilation involved, manually changing lines of codes in several files etc. 涉及很多手动编译,在多个文件中手动更改代码行等。

Ubuntu 12.4.(sic!) + kernel drivers + openNI + anaconda + openCV Ubuntu 12.4(原文如此)+内核驱动程序+ openNI + anaconda + openCV

A little better, but still feels hacky with manually pulling in patches and hotfixes for kernel-driver disable, cross-compilation with cmake/cython etc. (not working reliably with venvs...) 稍微好一点,但是通过手动拉入补丁和修补程序来禁用内核驱动程序,使用cmake / cython进行交叉编译等仍然感觉很棘手(不适用于venvs ...)

I finally found a way after quite some time of testing, using a Raspberry Pi 3 and the latest Raspbian Buster image. 经过一段时间的测试,我终于找到了一种方法,使用了Raspberry Pi 3和最新的Raspbian Buster映像。 Be sure, that a running python version is on your system. 确保系统上正在运行python版本。 I tried everything here using python 2.7. 我在这里使用python 2.7进行了所有尝试。

Install dependencies: 安装依赖项:

sudo apt-get install git-core cmake freeglut3-dev pkg-config build-essential libxmu-dev libxi-dev libusb-1.0-0-dev

Install OpenCV: 安装OpenCV:

Building manually is super-slow. 手动构建非常慢。 I found this to be working actually quite well: 我发现这实际上工作得很好:

sudo apt-get install opencv-python

Manually build libfreenect: 手动构建libfreenect:

This is needed, as the package version has problems on Pi 3. 这是必需的,因为软件包版本在Pi 3上有问题。

git clone git://github.com/OpenKinect/libfreenect.git
cd libfreenect
mkdir build
cd build

Use any means to configure the build to build Python extensions. 使用任何方法来配置构建以构建Python扩展。

cmake ..
make
make install

Refresh ldconfig cache: 刷新ldconfig缓存:

sudo ldconfig /usr/local/lib64
sudo ldconfig /usr/local/lib

Install numpy with eg pip: 用例如pip安装numpy:

pip install numpy

Build the python extensions from libfreenect: 从libfreenect构建python扩展:

cd libfreenect/wrappers/python
python setup.py install

Now, you should be able to run the examples in libfreenect\\wrappers\\python 现在,您应该能够在libfreenect\\wrappers\\python运行示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM