Namespaces | |
rgb_colors | |
Classes | |
class | CvImage |
Image message class that is interoperable with sensor_msgs/Image but uses a more convenient cv::Mat representation for the image data. More... | |
struct | CvtColorForDisplayOptions |
class | Exception |
Typedefs | |
typedef boost::shared_ptr< CvImage const > | CvImageConstPtr |
typedef boost::shared_ptr< CvImage > | CvImagePtr |
Enumerations | |
enum | Format { BMP, DIB, JPG, JPEG, JPE, JP2, PNG, PBM, PGM, PPM, SR, RAS, TIFF, TIF } |
Functions | |
CvImagePtr | cvtColor (const CvImageConstPtr &source, const std::string &encoding) |
Convert a CvImage to another encoding using the same rules as toCvCopy. More... | |
CvImageConstPtr | cvtColorForDisplay (const CvImageConstPtr &source, const std::string &encoding=std::string(), const CvtColorForDisplayOptions options=CvtColorForDisplayOptions()) |
Converts an immutable sensor_msgs::Image message to another CvImage for display purposes, using practical conversion rules if needed. More... | |
static int | depthStrToInt (const std::string depth) |
int | getCvType (const std::string &encoding) |
Get the OpenCV type enum corresponding to the encoding. More... | |
std::string | getFormat (Format format) |
CvImagePtr | toCvCopy (const sensor_msgs::CompressedImage &source, const std::string &encoding=std::string()) |
CvImagePtr | toCvCopy (const sensor_msgs::CompressedImageConstPtr &source, const std::string &encoding=std::string()) |
CvImagePtr | toCvCopy (const sensor_msgs::Image &source, const std::string &encoding=std::string()) |
Convert a sensor_msgs::Image message to an OpenCV-compatible CvImage, copying the image data. More... | |
CvImagePtr | toCvCopy (const sensor_msgs::ImageConstPtr &source, const std::string &encoding=std::string()) |
Convert a sensor_msgs::Image message to an OpenCV-compatible CvImage, copying the image data. More... | |
CvImageConstPtr | toCvShare (const sensor_msgs::Image &source, const boost::shared_ptr< void const > &tracked_object, const std::string &encoding=std::string()) |
Convert an immutable sensor_msgs::Image message to an OpenCV-compatible CvImage, sharing the image data if possible. More... | |
CvImageConstPtr | toCvShare (const sensor_msgs::ImageConstPtr &source, const std::string &encoding=std::string()) |
Convert an immutable sensor_msgs::Image message to an OpenCV-compatible CvImage, sharing the image data if possible. More... | |
typedef boost::shared_ptr<CvImage const> cv_bridge::CvImageConstPtr |
Definition at line 92 of file cv_bridge.h.
Definition at line 89 of file cv_bridge.h.
enum cv_bridge::Format |
Enumerator | |
---|---|
BMP | |
DIB | |
JPG | |
JPEG | |
JPE | |
JP2 | |
PNG | |
PBM | |
PGM | |
PPM | |
SR | |
RAS | |
TIFF | |
TIF |
Definition at line 95 of file cv_bridge.h.
CvImagePtr cv_bridge::cvtColor | ( | const CvImageConstPtr & | source, |
const std::string & | encoding | ||
) |
Convert a CvImage to another encoding using the same rules as toCvCopy.
Definition at line 462 of file cv_bridge.cpp.
CvImageConstPtr cv_bridge::cvtColorForDisplay | ( | const CvImageConstPtr & | source, |
const std::string & | encoding = std::string() , |
||
const CvtColorForDisplayOptions | options = CvtColorForDisplayOptions() |
||
) |
Converts an immutable sensor_msgs::Image message to another CvImage for display purposes, using practical conversion rules if needed.
Data will be shared between input and output if possible.
Recall: sensor_msgs::image_encodings::isColor and isMono tell whether an image contains R,G,B,A, mono (or any combination/subset) with 8 or 16 bit depth.
The following rules apply:
source | A shared_ptr to a sensor_msgs::Image message |
encoding | Either an encoding string that returns true in sensor_msgs::image_encodings::isColor isMono or the empty string as explained above. |
options | (cv_bridge::CvtColorForDisplayOptions) Options to convert the source image with.
|
Definition at line 576 of file cv_bridge.cpp.
|
static |
Definition at line 88 of file cv_bridge.cpp.
int cv_bridge::getCvType | ( | const std::string & | encoding | ) |
Get the OpenCV type enum corresponding to the encoding.
For example, "bgr8" -> CV_8UC3, "32FC1" -> CV_32FC1, and "32FC10" -> CV_32FC10.
Definition at line 105 of file cv_bridge.cpp.
std::string cv_bridge::getFormat | ( | Format | format | ) |
Definition at line 477 of file cv_bridge.cpp.
CvImagePtr cv_bridge::toCvCopy | ( | const sensor_msgs::CompressedImage & | source, |
const std::string & | encoding = std::string() |
||
) |
Definition at line 548 of file cv_bridge.cpp.
CvImagePtr cv_bridge::toCvCopy | ( | const sensor_msgs::CompressedImageConstPtr & | source, |
const std::string & | encoding = std::string() |
||
) |
Definition at line 542 of file cv_bridge.cpp.
CvImagePtr cv_bridge::toCvCopy | ( | const sensor_msgs::Image & | source, |
const std::string & | encoding = std::string() |
||
) |
Convert a sensor_msgs::Image message to an OpenCV-compatible CvImage, copying the image data.
source | A sensor_msgs::Image message |
encoding | The desired encoding of the image data, one of the following strings:
|
If encoding is the empty string (the default), the returned CvImage has the same encoding as source. If the source is 8bit and the encoding 16 or vice-versa, a scaling is applied (65535/255 and 255/65535 respectively). Otherwise, no scaling is applied and the rules from the convertTo OpenCV function are applied (capping): http://docs.opencv.org/modules/core/doc/basic_structures.html#mat-convertto
Definition at line 431 of file cv_bridge.cpp.
CvImagePtr cv_bridge::toCvCopy | ( | const sensor_msgs::ImageConstPtr & | source, |
const std::string & | encoding = std::string() |
||
) |
Convert a sensor_msgs::Image message to an OpenCV-compatible CvImage, copying the image data.
source | A shared_ptr to a sensor_msgs::Image message |
encoding | The desired encoding of the image data, one of the following strings:
|
If encoding is the empty string (the default), the returned CvImage has the same encoding as source.
Definition at line 425 of file cv_bridge.cpp.
CvImageConstPtr cv_bridge::toCvShare | ( | const sensor_msgs::Image & | source, |
const boost::shared_ptr< void const > & | tracked_object, | ||
const std::string & | encoding = std::string() |
||
) |
Convert an immutable sensor_msgs::Image message to an OpenCV-compatible CvImage, sharing the image data if possible.
If the source encoding and desired encoding are the same, the returned CvImage will share the image data with source without copying it. The returned CvImage cannot be modified, as that could modify the source data.
This overload is useful when you have a shared_ptr to a message that contains a sensor_msgs::Image, and wish to share ownership with the containing message.
source | The sensor_msgs::Image message |
tracked_object | A shared_ptr to an object owning the sensor_msgs::Image |
encoding | The desired encoding of the image data, one of the following strings:
|
If encoding is the empty string (the default), the returned CvImage has the same encoding as source.
Definition at line 445 of file cv_bridge.cpp.
CvImageConstPtr cv_bridge::toCvShare | ( | const sensor_msgs::ImageConstPtr & | source, |
const std::string & | encoding = std::string() |
||
) |
Convert an immutable sensor_msgs::Image message to an OpenCV-compatible CvImage, sharing the image data if possible.
If the source encoding and desired encoding are the same, the returned CvImage will share the image data with source without copying it. The returned CvImage cannot be modified, as that could modify the source data.
source | A shared_ptr to a sensor_msgs::Image message |
encoding | The desired encoding of the image data, one of the following strings:
|
If encoding is the empty string (the default), the returned CvImage has the same encoding as source.
Definition at line 439 of file cv_bridge.cpp.