<launch>

  <arg name="gui" default="true" />
  <arg name="gpu" default="0" />
  <arg name="use_mask" default="false" />

  <node name="image_publisher"
        pkg="jsk_perception" type="image_publisher.py"
        required="true">
    <rosparam subst_value="true">
      publish_info: false
      file_name: $(find jsk_perception)/sample/object_detection_example_1.jpg
    </rosparam>
  </node>
  <arg name="INPUT_IMAGE" default="image_publisher/output" />

  <group if="$(arg use_mask)">
    <node name="mask_image_generator"
          pkg="jsk_perception" type="mask_image_generator"
          required="true">
      <remap from="~input" to="$(arg INPUT_IMAGE)" />
      <rosparam>
        offset_x: 170
        offset_y: 170
        width: 250
        height: 250
      </rosparam>
    </node>
    <node name="apply_mask_image"
          pkg="jsk_perception" type="apply_mask_image"
          required="true">
      <remap from="~input" to="$(arg INPUT_IMAGE)" />
      <remap from="~input/mask" to="mask_image_generator/output" />
      <rosparam>
        clip: false
      </rosparam>
    </node>
  </group>

  <include file="$(find jsk_perception)/launch/fcn_object_segmentation.launch">
    <arg name="INPUT_IMAGE" default="$(arg INPUT_IMAGE)" />
    <arg name="INPUT_MASK" value="mask_image_generator/output" />
    <arg name="USE_MASK" value="$(arg use_mask)" />
    <arg name="GPU" value="$(arg gpu)" />
    <arg name="required" value="true" />
  </include>

  <group if="$(arg gui)">
    <node name="image_view"
          pkg="image_view" type="image_view">
      <remap from="image" to="label_image_decomposer/output/label_viz" />
    </node>
  </group>

</launch>
