Trouble with image_saver

asked 2020-05-26 09:47:01 -0500

gerhmi gravatar image

updated 2020-05-27 12:22:08 -0500

Hi! I'm trying to use the ROS service for the image_saver tool from image_view essentially using this roslaunch file:

<?xml version="1.0"?>

<launch>

  <!-- This is a sensor_msgs/Image (proof in attached image) -->
  <arg name="image_topic" default="/camera/rgb/image_raw" />

  <node pkg="image_view" type="image_saver" name="image_saver" >
    <remap from="image" to="$(arg image_topic)"/>
    <param name="save_all_image" value="false"/>
    <param name="filename_format" value="%04i.%s"/>
  </node>

</launch>

Then, according to this answer, to call the service, you run

rosservice call /image_saver/save

However, when I run the launch file above and call the service command, nothing is saved. Any suggestions are appreciated!

/camera/rgb/image_raw topic

edit retag flag offensive close merge delete

Comments

From where are you running the launch file? The folder that you are in when you make the roslaunch call is the folder to which the files should be saved. Have you checked there? Also, adding "--screen" to your roslaunch command will give you more information.

Josh Whitley gravatar image Josh Whitley  ( 2020-05-27 21:02:12 -0500 )edit

Thanks for your response. I've been running the roslaunch command from the project directory. That is, from Documents/husky as shown in the picture. After adding --screen, the program reports "Saved image 0000.jpg" but I can't find it anywhere on the computer (including searching all the computer's files). Seems like a strange bug because it works perfectly when I just rosrun the node like:

rosrun image_view image_saver image:=camera/rgb/image_raw _save_all_image:=false _filename_format:=%04i.%s __name:=image_saver
gerhmi gravatar image gerhmi  ( 2020-05-28 09:57:29 -0500 )edit

Have a look in the ~/.ros folder (it's a hidden folder). To specify where to store the images you can use the following format:

  <arg name="image_topic" default="/camera_rgb/color/image_raw" />
  <arg name="storage_folder" default="$(find your_package_name)/pictures" />

  <node
    name="camera_controller"
    pkg="image_view"
    type="image_saver"
    output="screen">
      <remap from="image" to="$(arg image_topic)"/>
      <param name="save_all_image" value="false" />
      <param name="filename_format" value="$(arg storage_folder)/image_%04d.png" />
  </node>

If the folder you specify doesn't exist, the image_saver will create it. But beware: If the folder doesn't exist yet, storing the first image will fail. So to prevent missing images, create the folder first, then start the node.

fb21 gravatar image fb21  ( 2021-01-25 11:05:27 -0500 )edit