Plugin-based interface for compressing and decompressing images using codec plugins. More...
#include <image_transport_codecs.h>
Public Member Functions | |
void | addCodec (const ImageTransportCodecPlugin::ConstPtr &codec) |
Manually add a codec instance. This is usually not needed as the codecs are autodetected using pluginlib. More... | |
virtual ImageTransportCodec::DecodeResult | decode (const topic_tools::ShapeShifter &compressed, const std::string &topicOrCodec, const dynamic_reconfigure::Config &config) |
Decode the given compressed image shapeshifter into a raw image. More... | |
ImageTransportCodec::DecodeResult | decode (const topic_tools::ShapeShifter &compressed, const std::string &topicOrCodec) |
Decode the given compressed image shapeshifter into a raw image using the default decompression parameters. More... | |
ImageTransportCodec::DecodeResult | decode (const topic_tools::ShapeShifter &compressed, const std::string &topicOrCodec, const XmlRpc::XmlRpcValue &config) |
Decode the given compressed image shapeshifter into a raw image. More... | |
ImageTransportCodec::DecodeResult | decode (const topic_tools::ShapeShifter &compressed, const std::string &topicOrCodec, const ros::NodeHandle &nh, const std::string ¶m) |
Decode the given compressed image shapeshifter into a raw image. More... | |
template<typename Config > | |
ImageTransportCodec::DecodeResult | decode (const topic_tools::ShapeShifter &compressed, const std::string &topicOrCodec, const Config &config) |
Decode the given compressed image shapeshifter into a raw image. More... | |
template<typename M > | |
ImageTransportCodec::DecodeResult | decodeTyped (const M &compressed, const std::string &topicOrCodec, const dynamic_reconfigure::Config &config) |
Decode the given compressed image into a raw image. More... | |
template<typename M > | |
ImageTransportCodec::DecodeResult | decodeTyped (const M &compressed, const std::string &topicOrCodec) |
Decode the given compressed image into a raw image using the default decompression parameters. More... | |
template<typename M > | |
ImageTransportCodec::DecodeResult | decodeTyped (const M &compressed, const std::string &topicOrCodec, const XmlRpc::XmlRpcValue &config) |
Decode the given compressed image into a raw image. More... | |
template<typename M > | |
ImageTransportCodec::DecodeResult | decodeTyped (const M &compressed, const std::string &topicOrCodec, const ros::NodeHandle &nh, const std::string ¶m) |
Decode the given compressed image into a raw image. More... | |
template<typename M , typename Config > | |
ImageTransportCodec::DecodeResult | decodeTyped (const M &compressed, const std::string &topicOrCodec, const Config &config) |
Decode the given compressed image into a raw image. More... | |
virtual ImageTransportCodec::EncodeResult | encode (const sensor_msgs::Image &raw, const std::string &topicOrCodec, const dynamic_reconfigure::Config &config) |
Encode the given raw image into a compressed image shapeshifter. More... | |
ImageTransportCodec::EncodeResult | encode (const sensor_msgs::Image &raw, const std::string &topicOrCodec) |
Encode the given raw image into a compressed image shapeshifter using the default compression parameters. More... | |
ImageTransportCodec::EncodeResult | encode (const sensor_msgs::Image &raw, const std::string &topicOrCodec, const XmlRpc::XmlRpcValue &config) |
Encode the given raw image into a compressed image shapeshifter. More... | |
ImageTransportCodec::EncodeResult | encode (const sensor_msgs::Image &raw, const std::string &topicOrCodec, const ros::NodeHandle &nh, const std::string ¶m) |
Encode the given raw image into a compressed image shapeshifter. More... | |
template<typename Config > | |
ImageTransportCodec::EncodeResult | encode (const sensor_msgs::Image &raw, const std::string &topicOrCodec, const Config &config) |
Encode the given raw image into a compressed image shapeshifter. More... | |
template<typename M > | |
cras::expected< M, std::string > | encodeTyped (const sensor_msgs::Image &raw, const std::string &topicOrCodec, const dynamic_reconfigure::Config &config) |
Encode the given raw image into a compressed image. More... | |
template<typename M > | |
cras::expected< M, std::string > | encodeTyped (const sensor_msgs::Image &raw, const std::string &topicOrCodec) |
Encode the given raw image into a compressed image using the default compression parameters. More... | |
template<typename M > | |
cras::expected< M, std::string > | encodeTyped (const sensor_msgs::Image &raw, const std::string &topicOrCodec, const XmlRpc::XmlRpcValue &config) |
Encode the given raw image into a compressed image. More... | |
template<typename M > | |
cras::expected< M, std::string > | encodeTyped (const sensor_msgs::Image &raw, const std::string &topicOrCodec, const ros::NodeHandle &nh, const std::string ¶m) |
Encode the given raw image into a compressed image. More... | |
template<typename M , typename Config > | |
cras::expected< M, std::string > | encodeTyped (const sensor_msgs::Image &raw, const std::string &topicOrCodec, const Config &config) |
Encode the given raw image into a compressed image. More... | |
virtual ImageTransportCodec::GetCompressedContentResult | getCompressedImageContent (const topic_tools::ShapeShifter &compressed, const std::string &topicOrCodec, const std::string &matchFormat) const |
Return the part of the encoded message that represents the actual image data (i.e. the part that can be passed to external decoders or saved to a file). If the codec messages have no such meaning, empty result is returned. More... | |
ImageTransportCodec::GetCompressedContentResult | getCompressedImageContent (const topic_tools::ShapeShifter &compressed, const std::string &topicOrCodec) const |
Return the part of the encoded message that represents the actual image data (i.e. the part that can be passed to external decoders or saved to a file). If the codec messages have no such meaning, empty result is returned. More... | |
ImageTransportCodecs (const cras::LogHelperPtr &log=std::make_shared< cras::NodeLogHelper >()) | |
Create the codec interface and load all available codecs. More... | |
virtual | ~ImageTransportCodecs () |
Public Member Functions inherited from cras::HasLogger | |
::cras::LogHelperConstPtr | getCrasLogger () const |
HasLogger (const ::cras::LogHelperPtr &log) | |
void | setCrasLogger (const ::cras::LogHelperPtr &log) |
Protected Member Functions | |
void | loadCodecs () |
Load all codecs available via pluginlib. This function can be called multiple times without negative performance impact - the loading is only done for the first time. More... | |
std::string | parseTransport (const std::string &topicOrCodec) const |
Parse the name of the codec from a topic. More... | |
Protected Attributes | |
std::unordered_map< std::string, ImageTransportCodecPlugin::ConstPtr > | codecs |
Loaded codecs. More... | |
std::unique_ptr< pluginlib::ClassLoader< ImageTransportCodecPlugin > > | loader |
Pluginlib loader of codecs. More... | |
Protected Attributes inherited from cras::HasLogger | |
::cras::LogHelperPtr | log |
Plugin-based interface for compressing and decompressing images using codec plugins.
Example usage:
Definition at line 48 of file image_transport_codecs.h.
|
explicit |
Create the codec interface and load all available codecs.
[in] | log | Log helper. |
|
virtual |
void image_transport_codecs::ImageTransportCodecs::addCodec | ( | const ImageTransportCodecPlugin::ConstPtr & | codec | ) |
Manually add a codec instance. This is usually not needed as the codecs are autodetected using pluginlib.
[in] | codec | The codec to add. |
|
virtual |
Decode the given compressed image shapeshifter into a raw image.
[in] | compressed | The shapeshifter of the compressed image to be decoded. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic from which the compressed message was received (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | config | Config of the decompression (if it has any parameters). |
ImageTransportCodec::DecodeResult image_transport_codecs::ImageTransportCodecs::decode | ( | const topic_tools::ShapeShifter & | compressed, |
const std::string & | topicOrCodec | ||
) |
Decode the given compressed image shapeshifter into a raw image using the default decompression parameters.
[in] | compressed | The shapeshifter of the compressed image to be decoded. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic from which the compressed message was received (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
ImageTransportCodec::DecodeResult image_transport_codecs::ImageTransportCodecs::decode | ( | const topic_tools::ShapeShifter & | compressed, |
const std::string & | topicOrCodec, | ||
const XmlRpc::XmlRpcValue & | config | ||
) |
Decode the given compressed image shapeshifter into a raw image.
[in] | compressed | The shapeshifter of the compressed image to be decoded. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic from which the compressed message was received (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | config | Config of the decompression (if it has any parameters). Pass a XmlRpc dict. |
ImageTransportCodec::DecodeResult image_transport_codecs::ImageTransportCodecs::decode | ( | const topic_tools::ShapeShifter & | compressed, |
const std::string & | topicOrCodec, | ||
const ros::NodeHandle & | nh, | ||
const std::string & | param | ||
) |
Decode the given compressed image shapeshifter into a raw image.
[in] | compressed | The shapeshifter of the compressed image to be decoded. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic from which the compressed message was received (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | nh | Node handle to get parameters from. |
[in] | param | Name of the parameter from which config of the decompression can be read (if it has any parameters). |
|
inline |
Decode the given compressed image shapeshifter into a raw image.
Config | Type of the config object. This should be the generated dynamic_reconfigure interface of the corresponding image_transport subscriber. |
[in] | compressed | The shapeshifter of the compressed image to be decoded. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic from which the compressed message was received (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | config | Config of the decompression (if it has any parameters). |
Definition at line 235 of file image_transport_codecs.h.
|
inline |
Decode the given compressed image into a raw image.
M | Type of the compressed message. |
[in] | compressed | The compressed image to be decoded. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic from which the compressed message was received (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | config | Config of the decompression (if it has any parameters). |
Definition at line 284 of file image_transport_codecs.h.
|
inline |
Decode the given compressed image into a raw image using the default decompression parameters.
M | Type of the compressed message. |
[in] | compressed | The compressed image to be decoded. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic from which the compressed message was received (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
Definition at line 319 of file image_transport_codecs.h.
|
inline |
Decode the given compressed image into a raw image.
M | Type of the compressed message. |
[in] | compressed | The compressed image to be decoded. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic from which the compressed message was received (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | config | Config of the decompression (if it has any parameters). Pass a XmlRpc dict. |
Definition at line 359 of file image_transport_codecs.h.
|
inline |
Decode the given compressed image into a raw image.
M | Type of the compressed message. |
[in] | compressed | The compressed image to be decoded. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic from which the compressed message was received (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | nh | Node handle to get parameters from. |
[in] | param | Name of the parameter from which config of the decompression can be read (if it has any parameters). |
Definition at line 403 of file image_transport_codecs.h.
|
inline |
Decode the given compressed image into a raw image.
M | Type of the compressed message. |
Config | Type of the config object. This should be the generated dynamic_reconfigure interface of the corresponding image_transport publisher. |
[in] | compressed | The compressed image to be decoded. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic from which the compressed message was received (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | config | Config of the decompression (if it has any parameters). |
Definition at line 445 of file image_transport_codecs.h.
|
virtual |
Encode the given raw image into a compressed image shapeshifter.
[in] | raw | The input raw image. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic where the compressed message will be published (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | config | Config of the compression (if it has any parameters). |
ImageTransportCodec::EncodeResult image_transport_codecs::ImageTransportCodecs::encode | ( | const sensor_msgs::Image & | raw, |
const std::string & | topicOrCodec | ||
) |
Encode the given raw image into a compressed image shapeshifter using the default compression parameters.
[in] | raw | The input raw image. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic where the compressed message will be published (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
ImageTransportCodec::EncodeResult image_transport_codecs::ImageTransportCodecs::encode | ( | const sensor_msgs::Image & | raw, |
const std::string & | topicOrCodec, | ||
const XmlRpc::XmlRpcValue & | config | ||
) |
Encode the given raw image into a compressed image shapeshifter.
[in] | raw | The input raw image. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic where the compressed message will be published (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | config | Config of the compression (if it has any parameters). Pass a XmlRpc dict. |
ImageTransportCodec::EncodeResult image_transport_codecs::ImageTransportCodecs::encode | ( | const sensor_msgs::Image & | raw, |
const std::string & | topicOrCodec, | ||
const ros::NodeHandle & | nh, | ||
const std::string & | param | ||
) |
Encode the given raw image into a compressed image shapeshifter.
[in] | raw | The input raw image. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic where the compressed message will be published (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | nh | Node handle to get parameters from. |
[in] | param | Name of the parameter from which config of the compression can be read (if it has any parameters). |
|
inline |
Encode the given raw image into a compressed image shapeshifter.
Config | Type of the config object. This should be the generated dynamic_reconfigure interface of the corresponding image_transport publisher. |
[in] | raw | The input raw image. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic where the compressed message will be published (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | config | Config of the compression (if it has any parameters). |
Definition at line 214 of file image_transport_codecs.h.
|
inline |
Encode the given raw image into a compressed image.
M | Type of the compressed message. |
[in] | raw | The input raw image. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic where the compressed message will be published (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | config | Config of the compression (if it has any parameters). |
Definition at line 255 of file image_transport_codecs.h.
|
inline |
Encode the given raw image into a compressed image using the default compression parameters.
M | Type of the compressed message. |
[in] | raw | The input raw image. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic where the compressed message will be published (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
Definition at line 303 of file image_transport_codecs.h.
|
inline |
Encode the given raw image into a compressed image.
M | Type of the compressed message. |
[in] | raw | The input raw image. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic where the compressed message will be published (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | config | Config of the compression (if it has any parameters). Pass a XmlRpc dict. |
Definition at line 336 of file image_transport_codecs.h.
|
inline |
Encode the given raw image into a compressed image.
M | Type of the compressed message. |
[in] | raw | The input raw image. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic where the compressed message will be published (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | nh | Node handle to get parameters from. |
[in] | param | Name of the parameter from which config of the compression can be read (if it has any parameters). |
Definition at line 383 of file image_transport_codecs.h.
|
inline |
Encode the given raw image into a compressed image.
M | Type of the compressed message. |
Config | Type of the config object. This should be the generated dynamic_reconfigure interface of the corresponding image_transport publisher. |
[in] | raw | The input raw image. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic where the compressed message will be published (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | config | Config of the compression (if it has any parameters). |
Definition at line 423 of file image_transport_codecs.h.
|
virtual |
Return the part of the encoded message that represents the actual image data (i.e. the part that can be passed to external decoders or saved to a file). If the codec messages have no such meaning, empty result is returned.
[in] | compressed | The compressed image. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic from which the compressed message was received (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
[in] | matchFormat | If nonempty, the image data is only returned if their format field would match the given one. The matching should be case-insensitive. |
ImageTransportCodec::GetCompressedContentResult image_transport_codecs::ImageTransportCodecs::getCompressedImageContent | ( | const topic_tools::ShapeShifter & | compressed, |
const std::string & | topicOrCodec | ||
) | const |
Return the part of the encoded message that represents the actual image data (i.e. the part that can be passed to external decoders or saved to a file). If the codec messages have no such meaning, empty result is returned.
[in] | compressed | The compressed image. |
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of a topic from which the compressed message was received (so that it is possible to parse the codec from the topic). Do not pass the raw image topic - that would result in using RawCodecPlugin which you probably do not want. |
|
protected |
Load all codecs available via pluginlib. This function can be called multiple times without negative performance impact - the loading is only done for the first time.
|
protected |
Parse the name of the codec from a topic.
[in] | topicOrCodec | Either the output of a codec's getTransportName() , or name of an image topic. |
|
protected |
Loaded codecs.
Definition at line 468 of file image_transport_codecs.h.
|
protected |
Pluginlib loader of codecs.
Definition at line 467 of file image_transport_codecs.h.