diff --git a/image_view/doc/components.rst b/image_view/doc/components.rst index ef7f26e1e..abbdf4c6a 100644 --- a/image_view/doc/components.rst +++ b/image_view/doc/components.rst @@ -31,7 +31,7 @@ This tool allows you to save images as jpg/png file from streaming can run with: .. code-block:: bash - + ros2 run image_view image_saver --ros-args -r image:=[your topic] or see this answer to control the timing of capture. @@ -74,7 +74,7 @@ This tool allows you to save images as jpg/png file from streaming can run with: .. code-block:: bash - + ros2 run image_view image_saver --ros-args -r image:=[your topic] or see this answer to control the timing of capture. @@ -93,7 +93,7 @@ Services Parameters ---------- * **encoding** (string, default:"bgr8"): Encoding type of input image topic. - * **filename_format** (string, default: "left%04i.jpg"): File name for + * **filename_format** (string, default: "frame%04i.jpg"): File name for saved images, you can use '%04i' for sequence number, and '%s' for default file format, you can use 'jpg' ,'png', 'pgm' as filename suffixes. * **image_transport** (string, default: raw): Image transport to use. diff --git a/image_view/include/image_view/image_saver_node.hpp b/image_view/include/image_view/image_saver_node.hpp index 5d8c76b2b..3a4d56ec0 100644 --- a/image_view/include/image_view/image_saver_node.hpp +++ b/image_view/include/image_view/image_saver_node.hpp @@ -68,6 +68,7 @@ class ImageSaverNode private: std::string g_format; + double fps_; bool stamped_filename_; bool save_all_image_{false}; bool save_image_service_{false}; diff --git a/image_view/src/image_saver_node.cpp b/image_view/src/image_saver_node.cpp index 075d84853..563ff98df 100644 --- a/image_view/src/image_saver_node.cpp +++ b/image_view/src/image_saver_node.cpp @@ -93,7 +93,8 @@ ImageSaverNode::ImageSaverNode(const rclcpp::NodeOptions & options) &ImageSaverNode::callbackWithoutCameraInfo, this, std::placeholders::_1), hints.getTransport()); - g_format = this->declare_parameter("filename_format", std::string("left%04i.%s")); + g_format = this->declare_parameter("filename_format", std::string("frame%04i.%s")); + fps_ = this->declare_parameter("fps", 0.1); encoding_ = this->declare_parameter("encoding", std::string("bgr8")); save_all_image_ = this->declare_parameter("save_all_image", true); stamped_filename_ = this->declare_parameter("stamped_filename", false); @@ -125,6 +126,7 @@ bool ImageSaverNode::saveImage( { cv::Mat image; try { + encoding_ = image_msg->encoding; image = cv_bridge::toCvShare(image_msg, encoding_)->image; } catch (const cv_bridge::Exception &) { RCLCPP_ERROR(