将Rosbag中compressed图像转换成raw类型

通过ubuntu摄像头录制rosbag步骤:
终端一
roscore
终端二  启动节点
rosrun uvc_camera uvc_camera_node

终端三  查看图像
rosrun image_view image_view image:=/image_raw
或者通过rviz查看,命令行运行rviz即可。
左侧add-》image》选择好topic(topic选择/image_raw  transport hint选择theora或者raw或者compressed根据具体情况选择 )
即可显示图像。
这个是可以查看压缩和未压缩的。

录像
rosbag record -o camera /image_raw
录制60秒
rosbag record -o camera_theora /image_raw/theora --duration=60

/image_raw 录制60秒的视频的rosbag大小是1.6G。
/image_raw/compressed 通道录制的rosbag大小是46M。
/image_raw/theora 录制的rosbag大小是975K


播放录像
rosbag play camera_2021-06-11-10-59-06.bag

如果提示 -》》》  Permission denied: '/dev/ttyUSB0'
运行  sudo chmod -R 777 /dev/ttyUSB0

将通道的压缩视频转为raw的方法。
rosrun image_transport republish compressed in:=/image_raw raw out:=/image_raw
然后,播放,往上面的通道中放入数据。
rosbag play camera_compress_2021-06-15-10-32-37.bag


ROS工作空间设置
 2222  mkdir ~/catkin_ws/src -p
 2223  cd catkin_ws/
 2224  cd src/
 2225  catkin_init_workspace 
 2226  ls
 2227  cd ..
 2228  catkin_make
 2234  sudo apt install libmuparser-dev
 2235  catkin_make

 2007  echo $ROS_PACKAGE_PATH
 2008  source devel/setup.bash

-------------------------------------------------------------------
查看内置摄像头分辨率:
cpoc@tted1200092:~$ v4l2-ctl -d  /dev/video0 --all
Driver Info (not using libv4l2):
    Driver name   : uvcvideo
    Card type     : Integrated_Webcam_HD: Integrate
    Bus info      : usb-0000:00:14.0-5
    Driver version: 5.4.114
    Capabilities  : 0x84A00001
        Video Capture
        Metadata Capture
        Streaming
        Extended Pix Format
        Device Capabilities
    Device Caps   : 0x04200001
        Video Capture
        Streaming
        Extended Pix Format
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
    Width/Height      : 640/480
    Pixel Format      : 'YUYV'
    Field             : None
    Bytes per Line    : 1280
    Size Image        : 614400
    Colorspace        : sRGB
    Transfer Function : Default (maps to sRGB)
    YCbCr/HSV Encoding: Default (maps to ITU-R 601)
    Quantization      : Default (maps to Limited Range)
    Flags             : 
Crop Capability Video Capture:
    Bounds      : Left 0, Top 0, Width 640, Height 480
    Default     : Left 0, Top 0, Width 640, Height 480

参考:

https://blog.csdn.net/qq_25458977/article/details/109358577

https://blog.csdn.net/pyt1234567890/article/details/109558644

https://blog.csdn.net/qq_43433255/article/details/89332667

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值