ROS中文笔记image_transport

ROS中文笔记image_transport

Overview

When working with images we often want specialized transport strategies, such as using image compression or streaming video codecs. image_transport provides classes and nodes for transporting images in arbitrary over-the-wire representations, while abstracting this complexity so that the developer only sees sensor_msgs/Image messages.

Specialized transports are provided by plugins. image_transport itself provides only “raw” transport so as not to impose unnecessary dependencies on client packages. Other transports will only be available if they are built on your system. On Ubuntu, the ros--base debians include the “compressed” and “theora” transports provided by the image_transport_plugins stack.

当我们需要特殊传输图像的时候,image_transport提供了类和节点为我们提供任意的over-the-wire representations传输图像。特殊的图像传输由插件提供,image_transport自己只提供原生的传输,所以对于客户端的包不需要特殊依赖。

Quickstart Guide

image_transport should always be used to publish and subscribe to images. At this basic level of usage, it is very similar to using ROS Publishers and Subscribers. Using image_transport instead of the ROS primitives, however, gives you great flexibility in how images are communicated between nodes.

For complete examples of publishing and subscribing to images using image_transport, see the Tutorials.
image_transport是用来发布和接收图像。最基本的使用层面上,这很接近于ROS的消息发布器和消息接收器,通过image_transport代替ROS基元,然而它可以给你节点间图像通讯很大的方便。

C++使用方法

错误的用法

// Do not communicate images this way!
#include 

void imageCallback(const sensor_msgs::ImageConstPtr& msg)
{
  // ...
}

ros::NodeHandle nh;
ros::Subscriber sub = nh.subscribe("in_image_topic", 1, imageCallback);
ros::Publisher pub = nh.advertise("out_image_topic", 1);

正确的用法

// Use the image_transport classes instead.
#include 
#include 

void imageCallback(const sensor_msgs::ImageConstPtr& msg)
{
  // ...
}

ros::NodeHandle nh;
image_transport::ImageTransport it(nh);
image_transport::Subscriber sub = it.subscribe("in_image_base_topic", 1, imageCallback);
image_transport::Publisher pub = it.advertise("out_image_base_topic", 1);

Known Transport Packages已知的包

image_transport 默认的传输,通过ROS传输sensor_msgs/Image
compressed_image_transport JPEG or PNG 压缩
theora_image_transport 视频流传输

关于节点

关于节点和其余的东西,碍于时间在这里没有具体了解,以后将会写
转载来源:
http://wiki.ros.org/image_transport

你可能感兴趣的:(ROS)