ROS-从rosbag中提取图像(by launch文件)
2017-07-07 13:56
841 查看
从rosbag文件中,提取图像并保存。
新建export.launch :
注:
换 args=”-d 2 $(find image_view)/test.bag 为 输入其绝对路径 解决 find 不到的问题;
运行export.launch文件:
将生成的图像 移动到 test 文件夹下
这样在文件夹中便可看到提取的图像。
其中,测试中遇到的问题:
该launch 提取了149张图像,而rosbag info camera.bag 显示 [ 235/235chunks]
如图:
搜索原因在于提取的时间间隔,目前默认的是0.1,
You can try to change the “sec_per_frame” parameter of image_extract. It is set to 0.1 by default, and if you are capturing images with 30 fps, you would get 1/3 of the frames, which is close to what you are getting. Try setting it to 0.03.具体参考。
Example launch file:
主要是添加
重新运行,得到233张,接近bag文件的255.
如果想要改变图像名称,在launch添加下列语句即可。
参考:1.ros.wiki:http://wiki.ros.org/rosbag/Tutorials/Exporting%20image%20and%20video%20data
新建export.launch :
<launch> <node pkg="rosbag" type="play" name="rosbag" args="-d 2 /home/lcl/bagfiles/camera.bag"/> <node name="extract" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="ROS_HOME"> <remap from="image" to="camera/rgb/image_color"/> </node> </launch>
注:
换 args=”-d 2 $(find image_view)/test.bag 为 输入其绝对路径 解决 find 不到的问题;
运行export.launch文件:
roslaunch export.launch
将生成的图像 移动到 test 文件夹下
1 cd ~ 2 mkdir test 3 mv ~/.ros/frame*.jpg test/
这样在文件夹中便可看到提取的图像。
其中,测试中遇到的问题:
该launch 提取了149张图像,而rosbag info camera.bag 显示 [ 235/235chunks]
如图:
搜索原因在于提取的时间间隔,目前默认的是0.1,
You can try to change the “sec_per_frame” parameter of image_extract. It is set to 0.1 by default, and if you are capturing images with 30 fps, you would get 1/3 of the frames, which is close to what you are getting. Try setting it to 0.03.具体参考。
Example launch file:
<launch> <node pkg="rosbag" type="play" name="rosbag" args="-d 2 $(find image_export)/input/file.bag"/> <node name="extract" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="ROS_HOME"> <remap from="image" to="[YOUR_TOPIC_NAME]"/> <param name="sec_per_frame" value="0.03"/> </node></launch>
主要是添加
<param name="sec_per_frame" value="0.03"/>
重新运行,得到233张,接近bag文件的255.
如果想要改变图像名称,在launch添加下列语句即可。
<param name="file_format" value="frame%05d.jpg"/>
参考:1.ros.wiki:http://wiki.ros.org/rosbag/Tutorials/Exporting%20image%20and%20video%20data
相关文章推荐
- 利用ROS工具从bag文件中提取图片
- ROS-从rosbag中提取图像(带时间戳)
- PDF 文件中可识别图像的提取
- PHP实现提取一个图像文件并在浏览器上显示的代码
- 利用MATLAB对Rosbag中数据的进行提取(特别是当bag中存在图片信息的时候)
- 把DICOM文件中的图像部分提取到BMP文件的函数
- 在roslaunch中通过rosbag运行bag文件
- opencv 实现对摄像头输入图像中文件及证件等的实时跟踪,四边形检测及提取
- 图像特征提取方法:Bag-of-words
- OpenCV入门七:OpenCV打开视频文件,并对其中的每一帧图像进行Canny算子边缘化提取,并将结果保存为视频文件
- 从ROS bag文件中提取图像
- rosbag文件中提取图像--分别通过cam/image_raw和cam/image_raw/compressed方话题
- PHP实现提取一个图像文件并显示在浏览器上
- ROS 图像launch 映射 文件
- [SimplePlayer] 1. 从视频文件中提取图像
- PHP实现提取一个图像文件并在浏览器上显示的代码
- Google地图发布基于python的神经网络学习模型,自动高效高准确度的从带有地理定位信息的图像文件中提取信息
- 图像特征提取方法:Bag-of-words
- 这个文件实现彩色图像的边缘提取,原创
- ROS从bag文件中导出图片