目前在研究视觉跟踪人的事情,找到的比较好的参考项目就是OpenPTrack
了,截至目前(2017.8.14
)OpenPTrack
的V2
版本还没有释放出代码,因此我们只能依旧在V1
版本上进行测试,这个版本目前只能在Ubuntu 14.04.5
系统上运行,其他系统上(比如Ubuntu 16.04
)问题比较多,还是建议在Ubuntu 14.04.5
系统上进行安装。
1.从GitHub上获取项目代码
1 2 3 |
$ sudo apt-get install git -y $ cd ~ $ git clone https://github.com/OpenPTrack/open_ptrack.git |
2.安装ROS
1 2 3 4 5 6 |
$ cd open_ptrack/scripts $ chmod +x *.sh $ ./ros_install.sh $ source /opt/ros/indigo/setup.bash $ ./ros_configure.sh |
3.安装OpenPTrack
1 |
$ ./openptrack_install.sh |
4.链接OpenPTrack
目录
1 |
$ ln -s ~/workspace/ros/catkin/src/open_ptrack ~/open_ptrack |
5.Kinect V2
驱动程序安装
1 2 3 4 5 6 7 8 |
$ sudo apt-get install nvidia-375-dev $ sudo apt-get install ocl-icd-opencl-dev $ cd ~/workspace/ros/catkin/src $ source ~/.profile $ roscd open_ptrack/../scripts $ chmod +x kinect2_install.sh $ ./kinect2_install.sh |
重启系统,然后执行如下命令:
1 2 |
$ cd ~/workspace/ros/catkin/devel/lib/kinect2_bridge $ sudo ./kinect2_bridge |
6.完整的自动化安装脚本
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
import subprocess def execBashShellCommand(cmd): print cmd p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,executable="/bin/bash") while True: buff = p.stdout.readline() if buff == '' and p.poll() != None: break print buff p.wait() def main(): execBashShellCommand("rm -rf ~/workspace") execBashShellCommand("rm -rf ~/.ros") execBashShellCommand("rm -rf ~/.rviz") execBashShellCommand("rm -rf ~/open_ptrack") execBashShellCommand("sudo apt-get install git -y") execBashShellCommand("cd ~ && git clone https://github.com/OpenPTrack/open_ptrack.git") execBashShellCommand("sed -i '/source ~\/workspace\/ros\/rosbuild\/setup.bash/d' ~/.bashrc") execBashShellCommand("sed -i '/export KINECT_DRIVER=openni/d' ~/.bashrc") execBashShellCommand("sed -i '/export LC_ALL=C/d' ~/.bashrc") execBashShellCommand("cd ~/open_ptrack/scripts && chmod +x *.sh && ./ros_install.sh") execBashShellCommand("cd ~/open_ptrack/scripts && source /opt/ros/indigo/setup.bash ; ./ros_configure.sh") execBashShellCommand("cd ~/open_ptrack/scripts && ./openptrack_install.sh") execBashShellCommand("ln -s ~/workspace/ros/catkin/src/open_ptrack ~/open_ptrack") execBashShellCommand("source ~/workspace/ros/rosbuild/setup.bash ; source ~/.profile ; export KINECT_DRIVER=openni && export LC_ALL=C && cd ~/workspace/ros/catkin && catkin_make --pkg calibration_msgs && catkin_make --pkg opt_msgs && catkin_make --force-cmake") execBashShellCommand("sudo apt-get -y install nvidia-375-dev") execBashShellCommand("sudo apt-get -y install ocl-icd-opencl-dev") execBashShellCommand("source ~/workspace/ros/rosbuild/setup.bash ; source ~/.profile ; export KINECT_DRIVER=openni && export LC_ALL=C && cd ~/workspace/ros/catkin/src && roscd open_ptrack/../scripts && chmod +x kinect2_install.sh && ./kinect2_install.sh") execBashShellCommand("cd ~/workspace/ros/catkin/devel/lib/kinect2_bridge && sudo ./kinect2_bridge") if __name__ == "__main__": main() |
7.测试系统
可能需要重新插拔一下Kinect
的USB
数据线,然后执行如下命令
1 |
$ roslaunch kinect2_bridge kinect2_bridge.launch |
执行之后,等待十几秒,然后Ctrl+C
中断执行。
执行完成后,执行
1 |
$ roslaunch tracking detection_and_tracking_kinect2.launch |
之后,会弹出三个界面出来。