准备工作 更新和安装支持库
sudo apt-get update
sudo apt-get install git g++ python libusb-1.0-0-dev freeglut3-dev openjdk-6-jdk doxygen graphviz
下载稳定版本的OpenNI和
PrimeSense
git clone https://github.com/OpenNI/OpenNI.git
git clone git://github.com/avin2/SensorKinect.git (如果你的是kinect 下载此项)
git clone https://github.com/PrimeSense/Sensor.git (如果你的是xtion下载此项)
树莓派B+ 移植OpenNI 以及Xtion驱动
可以完全参考树莓派B+移植教程(成功)
http://mewgen.com/Ge107_files/20120921%20Setting%20up%20Rasberry%20pi%20for%20the%20Xtion%20and%20kinect.html
树莓派2 移植OpenNI 以及Xtion驱动
OpenNI SDK编译安装
最近刚买了树莓派2,想在上面移植OpenNI,首先一个直观的感受就是pi2在B+的基础上性能有了一个数量级的提升,同时打开各种软件,浏览器,终端基本不会有卡顿的情形。pi2采用的是CortexA7 4核处理器,900MHZ。移植步骤和B+差不多,修改的文件也一样,只是修改内容稍有不同。也不需要超频,仅仅需要修改的地方就是将softfp改成hard就行了,其他的不需要修改,cortex-a8也不用修改,如果改成cortex-a7反而要出错。
_ Must also change the Arm compiler settings for this distribution of the Pi
修改 ~/OpenNI/Platform/Linux/Build/Common/Platform.Arm
_from
CFLAGS += -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp #-mcpu=cortex-a8
_to
CFLAGS += -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard #-mcpu=cortex-a8
_Then run
cd ~/stable/OpenNI/Platform/Linux/CreateRedist/
./RedistMaker.Arm
cd ~/stable/OpenNI/Platform/Linux/Redist/OpenNI-Bin-Dev-Linux-Arm-v1.5.2.23
sudo ./install.sh
Xtion驱动安装
_ Also edit the Sensor and SensorKinect makefile CFLAGS parametersnano ~/Sensor/Platform/Linux/Build/Common/Platform.Arm
(xtion)nano ~/SensorKinect/Platform/Linux/Build/Common/Platform.Arm (kinect)
_from
CFLAGS += -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp #-mcpu=cortex-a8
_to
CFLAGS += -march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=hard #-mcpu=cortex-a8
_Then run
cd ~/stable/Sensor/Platform/Linux/CreateRedist/
./RedistMaker Arm
cd ~/stable/Sensor/Platform/Linux/Redist/Sensor-Bin-Linux-Arm-v5.1.0.41
sudo ./install.sh
如果是kinect的话也是一样的配置
最后进入./
OpenNI/Platform/Linux/Bin/Arm-Release目录运行例程
cd ~/stable/OpenNI/Platform/Linux/Bin/Arm-Release
sudo ./Sample-NiCRead
sudo ./Sample-NiBackRecorder time 1 depth vga
sudo ./Sample-NiSimpleRead
效果图

图中最左边的image显示的320x240的RGB图,深度图没有显示出来,仅仅打印了中心点的距离参数为7660mm
可能遇到的问题
1:一定要注意解压安装包时的权限问题,可能会在编译的时候发生错误,所以最好是拷贝和解压的时候在普通用户下,仅仅在安装库的时候才sudo这样可以为后面减少很多问题。
2:在使用libx264-dev的时候可能会出现报错,解决方法卸掉,指定编译库路径
可能用到的工具
查看CPU使用状况:http://blog.sina.com.cn/s/blog_602f87700100gn68.html
查看.so文件的内部函数 : nm -D filename
安装中文输入法:树莓派默认是采用英文字库的,而且系统里没有预装中文字库,所以即使你在locale中改成中文,也不会显示中文,只会显示一堆方块。因此需要我们手动来安装中文字体。好在有一个中文字体是免费开源使用的。ssh中输入以下命令
sudo apt-get install ttf-wqy-zenhei
安装过程中如果碰到(Y/n),都选择y
中文字库安装完成之后,还需要安装一个中文输入法。输入如下命令
sudo apt-get install scim-pinyin
一样的安装过程,安装完毕后输入
sudo raspi-config
然后选择change_locale,在Default locale for the system environment:中选择zh_CN.UTF-8,配置完成之后,输入命令
sudo reboot
重启完成好就可以在VNC连接上去后使用中文显
c示和中文输入法了,切换中文输入法一样也是ctrl+space
吐槽 CSDN的编辑器真他妈操蛋,太令人失望了,让人没有继续写下去的理由
如果有问题可以联系460557758@qq.com
参考
树莓派B+移植教程http://mewgen.com/Ge107_files/20120921%20Setting%20up%20Rasberry%20pi%20for%20the%20Xtion%20and%20kinect.html
http://blog.csdn.net/hcx25909/article/details/8552099