image_transport

electric fuerte groovy  Documentation Status

image_common: camera_calibration_parsers | camera_info_manager | image_transport | polled_camera

Package Links

· Code API

· Tutorials

· Troubleshooting

· FAQ

· Change List

· Roadmap

· Releases

· Reviews

Dependencies (7)
Used by (57)

Package Summary

image_transport should always be used to subscribe to and publish images. It provides transparent support for transporting images in low-bandwidth compressed formats. Examples (provided by separate plugin packages) include JPEG/PNG compression and Theora streaming video. Image_transport 必须总是用在订阅和发布图像,它为图像在地带宽压缩格式提供了透明的支持。例如(提供单独的插件),包括JPEG/PNG压缩和录像。

  • Maintainer: Vincent Rabaud
  • Author: Patrick Mihelich
  • License: BSD
  • Bugtracker: https://github.com/ros-perception/image_common/issues
  • Source: git https://github.com/ros-perception/image_common.git

目录

1. Overview

2. Quickstart Guide

1. C++ Usage

2. Python Usage

3. Known Transport Packages

4. Library ROS API

1. image_transport Publishers

1. Published topics

2. Parameters

2. image_transport Subscribers

1. Subscribed topics

2. Parameters

5. Nodes

1. republish

1. Usage

2. Examples

3. Subscribed Topics

4. Published Topics

5. Parameters

6. Command-line tools

1. list_transports

1. Usage

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. 工作时我们往往需要专门的运输策略,如使用图像压缩视频流的编解码器的图像,image_transport提供的泪和节点传输图像的任意线的表示,抽象这个复杂的问题以至于开发者仅仅看到snesor_msgs/Image消息。

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 仅仅提供原始的传输,免得增加不必要的依赖于客户的包,其他传输将会被支持,如果它能在我们的系统上编译。

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原始的,这样在节点之间通信有足够的灵活性。

发布和订阅使用image_transport的完整的例子,请参阅教程。

C++ Usage

Instead of:

切换行号显示

1 // Do not communicate images this way!

2 #include

3

4 void imageCallback(const sensor_msgs::ImageConstPtr& msg)

5 {

6 // ...

7 }

8

9 ros::NodeHandle nh;

10 ros::Subscriber sub = nh.subscribe("in_image_topic", 1, imageCallback);

11 ros::Publisher pub = nh.advertise("out_image_topic", 1);

Do:

切换行号显示

1 // Use the image_transport classes instead.

2 #include

3 #include

4

5 void imageCallback(const sensor_msgs::ImageConstPtr& msg)

6 {

7 // ...

8 }

9

10 ros::NodeHandle nh;

11 image_transport::ImageTransport it(nh);

12 image_transport::Subscriber sub = it.subscribe("in_image_base_topic", 1, imageCallback);

13 image_transport::Publisher pub = it.advertise("out_image_base_topic", 1);

image_transport publishers advertise individual ROS Topics for each available transport - unlike ROS Publishers, which advertise a single topic. The topic names follow a standard naming convention, outlined below. Note, however, that all code interfaces take only a "base topic" name (to which the transport type is automatically appended); typically you should not directly reference the transport-specific topic used by a particular plugin.

Python Usage

image_transport does not yet support Python, though it is on the Roadmap. If you need to interface a Python node with some compressed image transport, try interposing a republish node.

Known Transport Packages

If you have implemented a new transport option in a public repository and would like to see it added to this list, please email our mailing list.

  • ros-pkg
    • image_transport ("raw") - The default transport, sending sensor_msgs/Image through ROS.
    • compressed_image_transport ("compressed") - JPEG or PNG image compression.
    • theora_image_transport ("theora") - Streaming video using the Theora codec.

Library ROS API

ROS Publishers and Subscribers are used to transport messages of any type. image_transport offers publishers and subscribers specialized for images. Because they encapsulate complicated communication behavior,image_transport publishers and subscribers have a public ROS API as well as a C++ code API. Please see the separate code API documentation for C++ usage. The ROS API is documented below.

image_transport Publishers

image_transport publishers are used much like ROS Publishers, but may offer a variety of specialized transport options (JPEG compression, streaming video, etc.). Different subscribers may request images from the same publisher using different transports.

C++: image_transport::Publisher (API), image_transport::CameraPublisher (API)

Published topics

image_transport publishers advertise individual ROS Topics for each available transport - unlike ROS Publishers, which advertise a single topic. The topic names follow a standard naming convention, outlined below. Note, however, that all code interfaces take only a "base topic" name; typically you should not directly reference the transport-specific topic used by a particular plugin.

The raw sensor_msgs/Image is published on the base topic, just as with using a normal roscpp ros::Publisher. If additional plugins are available, they advertise subtopics of the base topic, conventionally of the form/. For example, using plugins for "compressed" and "theora" transports, with a base topic of /stereo/left/image, the topics would be:

stereo/left/image (sensor_msgs/Image)

  • Base topic, used for "raw" transport. Advertised just as if we used ros::Publisher.

stereo/left/image/compressed ()

  • Topic for "compressed" transport.

stereo/left/image/theora ()

  • Topic for "theora" transport.

stereo/left/camera_info (sensor_msgs/CameraInfo)

  • (image_transport::CameraPublisher-only) Camera info topic.

Parameters

image_transport publishers have no independent parameters, but plugins are permitted to make use of the Parameter Server for configuration options, e.g. bit rate, compression level, etc. See the plugin package documentation.

Publisher plugin parameters give subscribers hooks to configure the publisher-side encoding to suit the needs on the client side. Lookup therefore occurs in the public namespace defined by , rather than the private namespace of the publishing node. Note that these parameters are a shared resource, controlling the behavior observed by all subscribers to the image topic.

image_transport Subscribers

image_transport subscribers are used much like roscpp's ros::Subscriber, but may use a specialized transport to receive images.

C++: image_transport::Subscriber (API), image_transport::CameraSubscriber (API)

Subscribed topics

A Subscriber instance is created with a "base topic" name and the name of the transport to use. It subscribes to the transport-specific ROS topic associated with the base topic. For example, if the base topic is /stereo/left/image, the subscribed topics for transports "raw" and "compressed" are respectively:

stereo/left/image (sensor_msgs/Image)

  • Base topic, used for the default "raw" transport. Subscribed just as if we used ros::Subscriber.

stereo/left/image/compressed ()

  • Topic for "compressed" transport.

stereo/left/camera_info (sensor_msgs/CameraInfo)

  • (image_transport::CameraSubscriber-only) Camera info topic.

Parameters

~image_transport (string, default: "raw")

  • Name of the transport to use.

If this parameter is not set, the transport from the image_transport::TransportHints argument ofimage_transport::ImageTransport::subscribe() is used.

image_transport::TransportHints may be used to specify a different namespace for parameter lookup. This is useful to remap ~image_transport into a separate namespace to allow different transports for different image subscriptions. The node writer may even specify a parameter name other than ~image_transport, although this is discouraged for the sake of consistency. Nodes that subscribe to image topics should document what parameter(s) control transport, especially if different from ~image_transport.

Subscriber plugins are permitted to make use of the Parameter Server for configuration options, e.g. video post-processing level. See the plugin package documentation.

Subscriber plugin parameters configure the behavior of one particular subscriber. They affect how the data received is interpreted (decoded). This differs from publisher plugin parameters, which are a shared resource affecting the data sent to all subscribers. The namespace used for parameter lookup is again specified throughimage_transport::TransportHints, defaulting to the private namespace of the subscribing node.

Nodes

republish

republish listens on one base image topic (using any transport type, "raw" by default) and republishes the images to another base topic. By default it uses all available publishing plugins; you may optionally specify a single out transport type. "raw" is the name of the default transport, publishing sensor_msgs/Image messages. What other transports are available depends on which plugins are built.

Usage

$ republish in_transport in:= [out_transport] out:=

Examples

  • Suppose we are publishing images from a robot using the streaming video transport "theora". On an offboard computer we have several nodes listening to the image topic. This setup wastes bandwidth and computation, as each node processes the compressed video into still images independently. Instead we can start a republish node on the offboard computer, streaming the video only to that node for processing into sensor_msgs/Imagemessages republished to the other nodes:

$ republish theora in:=camera/image raw out:=camera/image_decompressed

  • The above command is also useful simply to pipe a compressed image topic into a node that can only listen tosensor_msgs/Image (because it uses ros::Subscriber or is written in a language other than C++).
  • If a node publishes images only as sensor_msgs/Image, we can republish it using the full range of transports. Note however that the base topic must be different from the original topic, and this approach entails a slight overhead over using image_transport::Publisher in the original node.

$ republish raw in:=camera/image out:=camera/image_repub

Subscribed Topics

in ()

  • The image base topic to listen on (may actually subscribe to a subtopic).

Published Topics

out ()

  • The image base topic to publish to (may also publish subtopics).

Parameters

republish itself does not make use of the Parameter Server. Plugins may read or set plugin-specific parameters, however.

Command-line tools

list_transports

list_transports lists the declared image transport options across all ROS packages and attempts to determine whether they are currently available for use (packages built, plugins able to be loaded properly, etc.).

Usage

$ rosrun image_transport list_transports

image_transport Namespace Reference

Classes

class 

CameraPublisher

Manages advertisements for publishing camera images. More...管理发布的相机图像

class 

CameraSubscriber

Manages a subscription callback on synchronized Image and CameraInfo topics.More...管理在同步的图像和相机信息主题上的订阅回调函数

class 

Exception

A base class for all image_transport exceptions inheriting from std::runtime_error. More... 异常处理

class 

ImageTransport

Advertise and subscribe to image topics. More...发布和订阅图像主题

class 

Publisher

Manages advertisements of multiple transport options on an Image topic. More...管理多种传输选项的发布的主题

class 

PublisherPlugin

Base class for plugins to Publisher. More...发布插件

class 

RawPublisher

The default PublisherPlugin. More...默认的发布插件

class 

RawSubscriber

The default SubscriberPlugin. More...默认的订阅插件

class 

SimplePublisherPlugin

Base class to simplify implementing most plugins to Publisher. More...简化实现大多数用来发布的基本类

class 

SimpleSubscriberPlugin

Base class to simplify implementing most plugins to Subscriber. More...

class 

SingleSubscriberPublisher

Allows publication of an image to a single subscriber. Only available inside subscriber connection callbacks. More...允许发布一张图像到一个订阅者,仅仅允许里面的订阅连接会点哦函数

class 

Subscriber

Manages a subscription callback on a specific topic that can be interpreted as an Image topic. More...在特定的主题上管理订阅回调函数,它能被中断作为一个图像主题

class 

SubscriberFilter

Image subscription filter. More...订阅滤波器

class 

SubscriberPlugin

Base class for plugins to Subscriber. More...订阅插件

class 

TransportHints

Stores transport settings for an image topic subscription. More...为订阅图像主题存储传输设置

class 

TransportLoadException

An exception class thrown when image_transport is unable to load a requested transport. More...当下一个传输请求失败时将会抛出一个异常

转载于:https://my.oschina.net/xushizhe/blog/318949

你可能感兴趣的:(image_transport)