Image transport codec corresponding to compressed_image_transport. More...
#include <compressed_codec.h>
Public Types | |
typedef cras::expected< sensor_msgs::CompressedImage, std::string > | EncodeResult |
Result of image encoding. Either a sensor_msgs::CompressedImage message, or error message. More... | |
Public Types inherited from image_transport_codecs::ImageTransportCodec | |
typedef boost::shared_ptr< const ImageTransportCodec > | ConstPtr |
Shared pointer to const ImageTransportCodec . More... | |
typedef cras::expected< sensor_msgs::Image, std::string > | DecodeResult |
Result of image decoding. Either a sensor_msgs::Image holding the raw message, or error message. More... | |
typedef cras::expected< cras::ShapeShifter, std::string > | EncodeResult |
Result of image encoding. Either a shapeshifter holding the compressed message, or error message. More... | |
typedef cras::expected< cras::optional< CompressedImageContent >, std::string > | GetCompressedContentResult |
Result of getting the actual compressed image data. More... | |
typedef boost::shared_ptr< ImageTransportCodec > | Ptr |
Shared pointer to ImageTransportCodec . More... | |
Public Member Functions | |
CompressedCodec (const cras::LogHelperPtr &logHelper=std::make_shared< cras::NodeLogHelper >()) | |
Create an instance of the codec. More... | |
ImageTransportCodec::DecodeResult | decode (const sensor_msgs::CompressedImage &compressed, const compressed_image_transport::CompressedSubscriberConfig &config) const |
Decode the given compressed image using the given subscriber config. More... | |
ImageTransportCodec::DecodeResult | decode (const sensor_msgs::CompressedImage &compressed) const |
Decode the given compressed image using the default subscriber config. More... | |
ImageTransportCodec::DecodeResult | decode (const topic_tools::ShapeShifter &compressed, const dynamic_reconfigure::Config &config) const override |
Decode the given compressed image into a raw image. More... | |
ImageTransportCodec::DecodeResult | decompressJPEG (const std::vector< uint8_t > &data, const std::string &source_encoding, const std_msgs::Header &header) const |
Fast method to decompress a JPEG image. It does not support PNG images (use decode() if you are not sure). More... | |
EncodeResult | encode (const sensor_msgs::Image &raw, const compressed_image_transport::CompressedPublisherConfig &config) const |
Encode the given raw image using the given publisher config. More... | |
ImageTransportCodec::EncodeResult | encode (const sensor_msgs::Image &raw, const dynamic_reconfigure::Config &config) const override |
Encode the given raw image into the given shapeshifter object. More... | |
ImageTransportCodec::GetCompressedContentResult | getCompressedImageContent (const topic_tools::ShapeShifter &compressed, const std::string &matchFormat) const override |
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 sensor_msgs::CompressedImage &compressed, const std::string &matchFormat) const |
This function returns the bytes of the actual PNG/RVL image (skipping the codec-specific header). More... | |
std::string | getTransportName () const override |
Get the name of the codec/transport (used e.g. as topic suffix). More... | |
~CompressedCodec () override | |
Public Member Functions inherited from image_transport_codecs::ImageTransportCodec | |
DecodeResult | decode (const topic_tools::ShapeShifter &compressed) const |
Decode the given compressed image into a raw image using the default decompression parameters. More... | |
DecodeResult | decode (const topic_tools::ShapeShifter &compressed, const XmlRpc::XmlRpcValue &config) const |
Decode the given compressed image into a raw image. More... | |
DecodeResult | decode (const topic_tools::ShapeShifter &compressed, const ros::NodeHandle &nh, const std::string ¶m) const |
Decode the given compressed image into a raw image. More... | |
template<typename Config > | |
DecodeResult | decode (const topic_tools::ShapeShifter &compressed, const Config &config) const |
Decode the given compressed image into a raw image. More... | |
EncodeResult | encode (const sensor_msgs::Image &raw) const |
Encode the given raw image into the given shapeshifter object using the default compression parameters. More... | |
EncodeResult | encode (const sensor_msgs::Image &raw, const XmlRpc::XmlRpcValue &config) const |
Encode the given raw image into the given shapeshifter object. More... | |
EncodeResult | encode (const sensor_msgs::Image &raw, const ros::NodeHandle &nh, const std::string ¶m) const |
Encode the given raw image into the given shapeshifter object. More... | |
template<typename Config > | |
EncodeResult | encode (const sensor_msgs::Image &raw, const Config &config) const |
Encode the given raw image into the given shapeshifter object. More... | |
GetCompressedContentResult | getCompressedImageContent (const topic_tools::ShapeShifter &compressed) 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 (const cras::LogHelperPtr &logHelper) | |
Create an instance of the codec. More... | |
virtual | ~ImageTransportCodec () |
Public Member Functions inherited from cras::HasLogger | |
::cras::LogHelperConstPtr | getCrasLogger () const |
HasLogger (const ::cras::LogHelperPtr &log) | |
void | setCrasLogger (const ::cras::LogHelperPtr &log) |
Private Attributes | |
std::unique_ptr< CompressedCodecPrivate > | data |
Private implementation data. More... | |
Additional Inherited Members | |
Protected Attributes inherited from cras::HasLogger | |
::cras::LogHelperPtr | log |
Image transport codec corresponding to compressed_image_transport.
This codec exposes the functionality of compressed_image_transport
so that it can be used directly without the need to go through running a node and publishing on a topic. E.g.
Definition at line 53 of file compressed_codec.h.
typedef cras::expected<sensor_msgs::CompressedImage, std::string> image_transport_codecs::CompressedCodec::EncodeResult |
Result of image encoding. Either a sensor_msgs::CompressedImage
message, or error message.
Definition at line 57 of file compressed_codec.h.
|
explicit |
Create an instance of the codec.
[in] | logHelper | The logger to use for error messages not directly related to the currently processed image. |
|
override |
ImageTransportCodec::DecodeResult image_transport_codecs::CompressedCodec::decode | ( | const sensor_msgs::CompressedImage & | compressed, |
const compressed_image_transport::CompressedSubscriberConfig & | config | ||
) | const |
Decode the given compressed image using the given subscriber config.
[in] | compressed | The image to decode. |
[in] | config | Configuration of the decoder (corresponds to the dynamic_reconfigure parameters of subscriber). |
compressedCodecDecode()
. ImageTransportCodec::DecodeResult image_transport_codecs::CompressedCodec::decode | ( | const sensor_msgs::CompressedImage & | compressed | ) | const |
Decode the given compressed image using the default subscriber config.
[in] | compressed | The image to decode. |
compressedCodecDecode()
.
|
overridevirtual |
Decode the given compressed image into a raw image.
[in] | compressed | The shapeshifter of the compressed image to be decoded. |
[in] | config | Config of the decompression (if it has any parameters). |
Implements image_transport_codecs::ImageTransportCodec.
ImageTransportCodec::DecodeResult image_transport_codecs::CompressedCodec::decompressJPEG | ( | const std::vector< uint8_t > & | data, |
const std::string & | source_encoding, | ||
const std_msgs::Header & | header | ||
) | const |
EncodeResult image_transport_codecs::CompressedCodec::encode | ( | const sensor_msgs::Image & | raw, |
const compressed_image_transport::CompressedPublisherConfig & | config | ||
) | const |
Encode the given raw image using the given publisher config.
[in] | raw | The raw image to encode. |
[in] | config | Configuration of the encoder (corresponds to the dynamic_reconfigure parameters of publisher). |
compressedCodecEncode()
.
|
overridevirtual |
Encode the given raw image into the given shapeshifter object.
[in] | raw | The input raw image. |
[in] | config | Config of the compression (if it has any parameters). |
Implements image_transport_codecs::ImageTransportCodec.
|
overridevirtual |
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] | matchFormat | If nonempty, the image data is only returned if their format field would match the given one. The matching should be case-insensitive. |
Implements image_transport_codecs::ImageTransportCodec.
ImageTransportCodec::GetCompressedContentResult image_transport_codecs::CompressedCodec::getCompressedImageContent | ( | const sensor_msgs::CompressedImage & | compressed, |
const std::string & | matchFormat | ||
) | const |
This function returns the bytes of the actual PNG/RVL image (skipping the codec-specific header).
[in] | compressed | The compressed image. |
[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. |
|
overridevirtual |
Get the name of the codec/transport (used e.g. as topic suffix).
Implements image_transport_codecs::ImageTransportCodec.
|
private |
Private implementation data.
Definition at line 127 of file compressed_codec.h.