ROS通过小觅相机录制包,并且提取图片

使用小觅相机录制图片

  • 1. 录制包
    • 1.1 发布话题
    • 1.2 使用rosbag记录.bag文件(录制数据子集)
  • 2. 提取包中图片

1. 录制包

1.1 发布话题

roscore

mynt相机发布topic

cd <sdk> //MYNT-EYE-S-SDK
make ros

#Run

source wrappers/ros/devel/setup.bash
roslaunch mynt_eye_ros_wrapper mynteye.launch

With RViz to preview

source wrappers/ros/devel/setup.bash
roslaunch mynt_eye_ros_wrapper display.launch

#以上命令链接
https://blog.csdn.net/ZHAGNQ/article/details/84036776
https://github.com/slightech/MYNT-EYE-S-SDK/tree/master/wrappers/ros

1.2 使用rosbag记录.bag文件(录制数据子集)

ROS 提供了改变 topic 发布频率的节点throttle, (通常设备采集的频率为 20-60 hz, 这会使得标定的图像过多, 而导致计算量太大. 最好将ros topic的频率降低到4hz左右进行采集.)指令如下 :

rosrun topic_tools throttle messages /mynteye/left/image_raw 4.0 /left
     
rosrun topic_tools throttle messages /mynteye/right/image_raw 4.0 /right

对左右目的ros topic降低频率后就可以制作bag了

rosbag record -O stereo_calibra.bag /left /right
rosbag record -O newbag /mynteye/left/image_raw /mynteye/right/image_raw /mynteye/left_rect/image_rect /mynteye/right_rect/image_rect

2. 提取包中图片

1、通过cam/image_raw话题
创建launch文件,如下:
export.launch

 <launch>
 	<node pkg="rosbag" type="play" name="rosbag" required="true" args="-d 2 /home/jinln/jinln/DATASET/MYNT/stereo_calibra.bag"/>
	<node name="extract" pkg="image_view" type="extract_images" respawn="false" required="true" output="screen" cwd="ROS_HOME">
	// 
	<remap from="image" to="/right"/>
	 </node>
</launch>

2.然后,运行launch文件
开一个终端,运行

roscore
打开一个终端,cd到export.launch所在路径下,运行
roslaunch export.launch

3.所提取的图片在~/.ros路径下,将其移到你的目标文件中,如:


cd ~
mkdir Example
mv ~/.ros/*.jpg ~/Example

你可能感兴趣的:(ROS通过小觅相机录制包,并且提取图片)