Ubuntu16.04+Kinect2摄像头进行物体识别

ork功能包

首先安装依赖库:

sudo apt-get install meshlab

sudo apt-get install libosmesa6-dev

sudo apt-get install python-pyside.qtcore

sudo apt-get install python-pyside.qtgui

下载源码编译:
mkdir ork_ws
cd ork_ws
wstool init src https://raw.github.com/wg-perception/object_recognition_core/master/doc/source/ork.rosinstall.kinetic.plus


cd src
wstool update -j8
cd ..
rosdep install --from-paths src -i -y

catkin_make

echo "source ~/ork_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

ORK 是一套以 template matching 方法為主的辨识工具,也就是說,他会把感測器看到的物体跟资料库中的物体比對,夠相似的就算是辨识成功,所以我們接著要來处理资料库。首先要安裝 CouchDB 這個工具
sudo apt-get install couchdb
接下來檢查一下是否有安裝成功
用 curl -X GET http://localhost:5984


rosrun object_recognition_core object_add.py -n "coke " -d "A universal can of coke" --commit
執行上面這個指令之後,你可以去 http://localhost:5984/_utils/database.html?object_recognition/_design/objects/_view/by_object_name 看看自己的資料庫裡是否已經新增了這個物體:


git clone https://github.com/wg-perception/ork_tutorials
cd .. && catkin_make


rosrun object_recognition_core mesh_add.py --commit

[    9085f3469dffde7c1ae78413d900079d
rosrun object_recognition_core mesh_add.py 9085f3469dffde7c1ae78413d900079d /home/zx/ork_ws/src/ork_tutorials/data/coke.stl --commit
]


查看模型:
sudo pip install git+https://github.com/couchapp/couchapp.git
rosrun object_recognition_core push.sh

{安装pip:  sudo apt install python-pip}

 

训练模型:
rosrun object_recognition_core training -c `rospack find object_recognition_linemod`/conf/training.ork


识别:
cd kinect_ws
source devel/setup.bash
roslaunch kinect2_bridge kinect2_bridge.launch publish_tf:=true
 
rviz
 
cd ork_ws
source devel/setup.bash
rosrun topic_tools relay /kinect2/qhd/image_depth_rect /camera/depth_registered/image_raw
 
rosrun topic_tools relay /kinect2/qhd/image_color_rect /camera/rgb/image_rect_color
 
rosrun topic_tools relay /kinect2/qhd/camera_info /camera/rgb/camera_info
 
rosrun topic_tools relay /kinect2/qhd/camera_info /camera/depth_registered/camera_info
 
rosrun topic_tools relay /kinect2/qhd/points /camera/depth_registered/points
 
rosrun tf static_transform_publisher 0 0 0 0 0 0 kinect2_ir_opticalrame camera_depth_optical_frame 40
 
rosrun object_recognition_core detection -c  `rospack find object_recognition_linemod`/conf/detection.ros.ork

 

你可能感兴趣的:(Ubuntu16.04+Kinect2摄像头进行物体识别)