Go to the documentation of this file.
15 #include <dynamic_reconfigure/Config.h>
17 #include <sensor_msgs/Image.h>
18 #include <topic_tools/shape_shifter.h>
92 typedef cras::expected<cras::ShapeShifter, std::string>
EncodeResult;
95 typedef cras::expected<sensor_msgs::Image, std::string>
DecodeResult;
121 virtual EncodeResult encode(
const sensor_msgs::Image& raw,
const dynamic_reconfigure::Config& config)
const = 0;
130 const dynamic_reconfigure::Config& config)
const = 0;
203 const std::string& param)
const;
213 template<
typename Config>
216 dynamic_reconfigure::Config configMsg;
217 config.__toMessage__(configMsg);
218 return this->
encode(raw, configMsg);
229 template<
typename Config>
232 dynamic_reconfigure::Config configMsg;
233 config.__toMessage__(configMsg);
234 return this->
decode(compressed, configMsg);
virtual DecodeResult decode(const topic_tools::ShapeShifter &compressed, const dynamic_reconfigure::Config &config) const =0
Decode the given compressed image into a raw image.
cras::expected< sensor_msgs::Image, std::string > DecodeResult
Result of image decoding. Either a sensor_msgs::Image holding the raw message, or error message.
The part of a compressed message that represents the actual image data (i.e. data that can be passed ...
boost::shared_ptr< ImageTransportCodec > Ptr
Shared pointer to ImageTransportCodec.
cras::expected< cras::optional< CompressedImageContent >, std::string > GetCompressedContentResult
Result of getting the actual compressed image data.
Base for all image transport codecs. All codecs have to extend class ImageTransportCodec and implemen...
ImageTransportCodec(const cras::LogHelperPtr &logHelper)
Create an instance of the codec.
boost::shared_ptr< const ImageTransportCodec > ConstPtr
Shared pointer to const ImageTransportCodec.
EncodeResult encode(const sensor_msgs::Image &raw, const Config &config) const
Encode the given raw image into the given shapeshifter object.
DecodeResult decode(const topic_tools::ShapeShifter &compressed, const Config &config) const
Decode the given compressed image into a raw image.
std::string format
Format of the image. This should be a string recognized by OpenCV, ffmpeg or similar tools.
virtual EncodeResult encode(const sensor_msgs::Image &raw, const dynamic_reconfigure::Config &config) const =0
Encode the given raw image into the given shapeshifter object.
::cras::LogHelper::Ptr LogHelperPtr
virtual ~ImageTransportCodec()
std::vector< uint8_t > data
The image content.
virtual std::string getTransportName() const =0
Get the name of the codec/transport (used e.g. as topic suffix).
cras::expected< cras::ShapeShifter, std::string > EncodeResult
Result of image encoding. Either a shapeshifter holding the compressed message, or error message.
virtual GetCompressedContentResult getCompressedImageContent(const topic_tools::ShapeShifter &compressed, const std::string &matchFormat) const =0
Return the part of the encoded message that represents the actual image data (i.e....