3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

点群を法線方向でフィルターにかける

Last updated at Posted at 2021-05-09

はじめに

ある点群から特定の法線方向の点群のみ抽出したいと思い調べたところ、jsk_pcl_rosNormalDirectionFilterでそのような処理ができることがわかりました。

使ってみる

以下のパッケージで簡単にjsk_pcl_rosNormalDirectionFilterを試すことができます。

install
sudo apt-get install -y ros-melodic-jsk-pcl-ros
sudo apt-get install -y ros-melodic-jsk-visualization
git clone https://github.com/hoshianaaa/jsk_pcl_ros_samples.git
cd ~/catkin_ws

catkin build 
または
catkin make

source ~/catkin_ws/devel/setup.bash
実行
roslaunch jsk_pcl_ros_samples normal_direction_filter.launch

作成したlaunchは次のようになっていて赤枠部分のnodeletに法線点群を入力します。またパラメータとしてuse_imu=false,eps_angle,directionを指定します。

Screenshot from 2021-05-10 02-55-09.png

launch
<launch>
  <arg name="gui" default="true"/>

  <include file="$(find jsk_pcl_ros_samples)/launch/normal_estimation_omp.launch">
    <arg name="file_name" value="$(find jsk_pcl_ros_samples)/pcd/bunny.pcd"/>
    <arg name="gui" default="false"/>
  </include>

  <node name="normal_direction_filter"
        pkg="nodelet" type="nodelet"
        args="standalone jsk_pcl/NormalDirectionFilter">
    <remap from="~input" to="normal_estimation_omp/output"/>
    <rosparam>
      use_imu: false
      eps_angle: 0.2
      direction: [0, 0, 1]
    </rosparam>
  </node>

  <group if="$(arg gui)">
    <node name="extract_indices_normal_filtered"
          pkg="nodelet" type="nodelet"
          args="standalone jsk_pcl/ExtractIndices">
      <remap from="~input" to="normal_estimation_omp/output_with_xyz"/>
      <remap from="~indices" to="normal_direction_filter/output"/>
      <rosparam>
        keep_organized: true
      </rosparam>
    </node>

    <node name="rviz"
          pkg="rviz" type="rviz"
          args="-d $(find jsk_pcl_ros_samples)/rviz/normal_direction_filter.rviz"/>
  </group>
</launch>

結果

下の写真のように特定の方向の点群のみ抽出することができました。

Screenshot from 2021-05-10 02-53-34.png

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?