<launch>
  <arg name="gui" default="true" />
  <arg name="use_opencv3" default="false" />
  <arg name="use_opencv3_1" default="false" />
  <arg name="use_opencv3_2" default="false" />
  <node name="play_face_bag" pkg="rosbag" type="play" args="-l $(find opencv_apps)/test/face_detector_withface_test_diamondback.bag" />

  <group ns="wide_stereo/left" >
    <node name="image_proc" pkg="image_proc" type="image_proc" />
    <node name="image_view" pkg="image_view" type="image_view" args="image:=image_rect_color" if="$(arg gui)" />

    <!-- face_detection.cpp -->
    <include file="$(find opencv_apps)/launch/face_detection.launch" >
      <arg name="debug_view" value="$(arg gui)" />
      <arg name="image" value="image_rect" />
      <arg name="use_opencv3" value="$(arg use_opencv3)" />
      <arg name="use_opencv3_1" value="$(arg use_opencv3_1)" />
      <arg name="use_opencv3_2" value="$(arg use_opencv3_2)" />
    </include>

    <node name="face_image_viewer" pkg="image_view" type="image_view">
      <remap from="image" to="face_detection/face_image" />
    </node>
    <!-- Test Codes -->
    <node name="face_detection_saver" pkg="image_view" type="image_saver">
      <remap from="image" to="face_detection/image" />
      <param name="filename_format" value="$(find opencv_apps)/test/face_detection.png"/>
    </node>
    <node name="face_image_saver" pkg="image_view" type="image_saver">
      <remap from="image" to="face_detection/face_image" />
      <param name="filename_format" value="$(find opencv_apps)/test/face.png" />
    </node>
    <param name="face_detection_test/topic" value="face_detection/faces" />    <!-- opencv_apps/FaceArrayStamped -->
    <test test-name="face_detection_test" pkg="rostest" type="hztest" name="face_detection_test" >
      <param name="hz" value="15" />
      <param name="hzerror" value="14" />
      <param name="test_duration" value="5.0" /> 
    </test>
    <param name="face_detection_image_test/topic" value="face_detection/face_image" />
    <test test-name="face_detection_image_test" pkg="rostest" type="hztest" name="face_detection_image_test" >
      <param name="hz" value="15" />
      <param name="hzerror" value="14" />
      <param name="test_duration" value="5.0" />
    </test>
  </group>
</launch>
