LoginSignup
1
3

More than 3 years have passed since last update.

ROS 点群をHSIカラーフィルターにかける

Last updated at Posted at 2021-03-30

はじめに

今回はjsk_pcl_rosにあるhsi_color_filterを使用し、入力点群から特定の色の点群を抽出します。

試す

以下パッケージにサンプルを作成したのでこれを使用します。

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 hsi_color_filter.launch

もとの点群は以下です。
Screenshot from 2021-03-30 22-29-20.png

以下のように緑色の部分の点群を抽出できました。
Screenshot from 2021-03-30 22-29-29.png

サンプル解説

サンプルは以下のようになっており、jsk_pcl_rosのhsi_color_filter.launchの入力トピックを適切に設定すると使用できます。今回はネームスペースを"hsi_color_filter"トピック名を"points"としています。
Screenshot from 2021-03-30 21-28-30.png

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

    <arg name="file_name" value="$(find jsk_pcl_ros_samples)/pcd/region_growing_rgb_tutorial.pcd"/>

    <arg name="rate" value="0.1"/>
    <node pkg="pcl_ros" type="pcd_to_pointcloud" name="pcd_to_pointcloud" args="$(arg file_name) $(arg rate)" output="screen">
        <remap from="cloud_pcd" to="hsi_color_filter/points"/>
        <param name="frame_id" value="base_link" />
    </node>

  <include file="$(find jsk_pcl_ros)/launch/hsi_color_filter.launch">
    <arg name="DEFAULT_NAMESPACE" value="hsi_color_filter"/>
    <arg name="INPUT" value="points"/>
    <arg name="h_max" default="43" />
    <arg name="h_min" default="127" />
    <arg name="s_max" default="194" />
    <arg name="s_min" default="12" />
    <arg name="i_max" default="200" />
    <arg name="i_min" default="80" />

  </include>

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

参考

1
3
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
1
3