Code Monkey home page Code Monkey logo

point_cloud_process's Introduction

point_cloud_process

Point cloud pre-process for PointNetGPD & Kinect v2

基于ROS框架,主要是为了配套PointNetGPD使用的,不过也可以略加修改,变成通用的代码。


简介

  • 通过Kinect v2 读取桌面物体的场景点云,并进行系列预处理,保留感兴趣区域点云,支持:

    • 相机坐标系三轴方向直通滤波
    • 剔除支撑桌面
    • 剔除离群点
    • 点云降采样
    • 点云光滑处理
  • 通过ROS_tf读取某桌面标签二维码坐标系(目标标签名称为"ar_marker_6")与相机坐标系"kinect2_rgb_optical_frame"之间的坐标关系,从而将感兴趣区域点云转换到桌面标签坐标系中;

  • 将预处理后的点云(父坐标系为桌面标签“ar_marker_6”坐标系)以ROS话题形式发布出去,话题名称:

    /table_top_points       #仅滤波剔除桌面等预处理后的点云
    /table_top_points_subsampled      #预处理+降采样
    

依赖

  1. 已经提前安装了ROS并创建了工作空间;

  2. 确保已经安装了Kinect深度相机驱动(我们版本是Ubuntu18.04LTS,以及Kinect V2相机)以及相关ROS程序包,并进行了相机内参标定。

  3. 安装了ar_track_alvar程序包

    sudo apt-get install ros-<ros_distro>-ar-track-alvar
    
  4. 确保桌面贴有由ar_track_alvar生成的二维码标签并处于深度相机视野范围内,代码中使用的标签编号为6,尺寸10cm*10cm;或直接下载下图

    rosrun ar_track_alvar createMarker -f 6 -s 10.0

安装与使用

  1. 克隆到自己的ros工作空间中

    cd ~/catkin_ws/src
    git clone https://github.com/Hymwgk/point_cloud_process.git
    catkin build
  2. 运行本代码之前必须已经提前运行了Kinect v2相机 ,并发布了相应话题:

    roslaunch kinect2_bridge kinect2_bridge.launch publish_tf:=true
  3. 开始处理桌面点云:

    roslaunch point_cloud_process get_table_top_points.launch 
  4. 启动rviz 对点云进行观察

    rviz

    预处理后的点云

  5. 修改预处理参数配置文本 config/prepocess_prarm.txt

    该文件指定了与处理过程中的各项参数,程序将在处理每一帧点云之前先读取该文本参数,因此可以直接修改,实时观察预处理点云的变化。

    pass_through_x=1    设置是否允许相机坐标系x轴方向点云直通滤波
    pass_through_y=1    y轴直通滤波
    pass_through_z=1    z轴直通滤波
    table_remove=1         是否允许剔除支撑桌面
    outlier_remove=1      是否允许剔除离群点   
    surface_smooth=0      是否允许表面平滑
    subsample=0                是否允许降采样
    z_min= 0.3                     设置z轴方向直通滤波的远近距离
    z_max=0.9                      
    x_left= -0.4                    设置x轴方向直通滤波的左右距离
    x_right= 0.3                  
    y_up= -0.25                 设置y轴方向直通滤波的上下距离
    y_down= 0.2             
    remain_rate=0.4             桌面剔除率
    remain_points=500       桌面剩余最少点数
    k_points= 50                   用于剔除离群点
    thresh=0.9                        用于剔除离群点
    radius= 0.03                   用于剔除离群点
    subsampling_leaf_size=0.004              设置降采样voxel尺寸
    

point_cloud_process's People

Contributors

hymwgk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

point_cloud_process's Issues

ImportError: cannot import name 'BinaryImage' from 'perception'

(pointnetgpd) klxue@dell-XPS:~/code/PointNetGPD/apps$ python generate-dataset-canny.py
WARNING:root:autolab_core not installed as catkin package, RigidTransform ros methods will be unavailable
Traceback (most recent call last):
File "generate-dataset-canny.py", line 13, in
from dexnet.grasping.quality import PointGraspMetrics3D
File "/home/klxue/code/dex-net/src/dexnet/init.py", line 24, in
from dexnet.api import DexNet
File "/home/klxue/code/dex-net/src/dexnet/api.py", line 42, in
import dexnet.database.database as db
File "/home/klxue/code/dex-net/src/dexnet/database/init.py", line 22, in
from dexnet.database.hdf5_factory import Hdf5ObjectFactory
File "/home/klxue/code/dex-net/src/dexnet/database/hdf5_factory.py", line 32, in
import meshpy.mesh as mesh
File "/home/klxue/code/meshpy/meshpy/init.py", line 2, in
from meshpy.image_converter import ImageToMeshConverter
File "/home/klxue/code/meshpy/meshpy/image_converter.py", line 19, in
from perception import BinaryImage
ImportError: cannot import name 'BinaryImage' from 'perception' (/home/klxue/anaconda3/envs/pointnetgpd/lib/python3.7/site-packages/perception/init.py)

symbol lookup error

Hello, I follow the steps and after this command:
$ roslaunch point_cloud_process get_table_top_points.launch
I find the bug:

[ERROR] [1620963409.937609785]: "ar_marker_6" passed to lookupTransform argument target_frame does not exist. 
/opt/ros/melodic/lib/ar_track_alvar/individualMarkersNoKinect: symbol lookup error: /opt/ros/melodic/lib/ar_track_alvar/individualMarkersNoKinect: undefined symbol: _ZN9_IplImageC1ERKN2cv3MatE

I used c++filt _ZN9_IplImageC1ERKN2cv3MatE and output
"_IplImage::_IplImage(cv::Mat const&)"
So it seems like a OpenCV version problem maybe? But do you know how to fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.