<launch>

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

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

  <node name="mask_image_generator"
        pkg="jsk_perception" type="mask_image_generator">
    <remap from="~input" to="$(arg INPUT_IMAGE)" />
    <rosparam>
      offset_x: 50
      offset_y: 50
      width: 128
      height: 128
    </rosparam>
  </node>

  <node name="mask_image_generator1"
        pkg="jsk_perception" type="mask_image_generator">
    <remap from="~input" to="$(arg INPUT_IMAGE)" />
    <rosparam>
      offset_x: 200
      offset_y: 200
      width: 100
      height: 100
    </rosparam>
  </node>

  <node name="add_mask_image"
        pkg="nodelet" type="nodelet"
        args="standalone jsk_perception/AddMaskImage"
        respawn="true" >
    <remap from="~input/src1" to="mask_image_generator/output" />
    <remap from="~input/src2" to="mask_image_generator1/output" />
  </node>

  <node name="mask_image_to_rect"
        pkg="jsk_perception" type="mask_image_to_rect"
        output="screen"
        clear_params="true" >
    <remap from="~input" to="add_mask_image/output" />
    <rosparam subst_value="true">
      rect_type: 1
    </rosparam>
  </node>

  <node name="draw_rects"
        pkg="jsk_perception" type="draw_rects">
    <remap from="~input" to="$(arg INPUT_IMAGE)" />
    <remap from="~input/rects" to="mask_image_to_rect/output" />
  </node>

  <group if="$(arg gui)">
    <node name="image_view0"
          pkg="image_view" type="image_view">
      <remap from="image" to="add_mask_image/output" />
    </node>
    <node name="image_view1"
          pkg="image_view" type="image_view">
      <remap from="image" to="draw_rects/output" />
    </node>
  </group>

</launch>
