3 #include <gtest/gtest.h> 5 TEST(CvBridgeTest, compression)
11 for (
int i = 0; i < 2; ++i)
13 const std::string format = (i == 0) ?
"bgr8" :
"rgb8";
14 cv::Mat_<cv::Vec3b> in(10, 10);
15 rng.fill(in, cv::RNG::UNIFORM, 0, 256);
20 EXPECT_EQ(out->image.channels(), 3);
21 EXPECT_EQ(cv::norm(out->image, in), 0);
25 for (
int i = 0; i < 2; ++i)
27 const std::string format = (i == 0) ?
"bgra8" :
"rgba8";
28 cv::Mat_<cv::Vec4b> in(10, 10);
29 rng.fill(in, cv::RNG::UNIFORM, 0, 256);
33 EXPECT_EQ(out->image.channels(), 4);
34 EXPECT_EQ(cv::norm(out->image, in), 0);
std_msgs::Header * header(M &m)
TEST(CvBridgeTest, compression)
Image message class that is interoperable with sensor_msgs/Image but uses a more convenient cv::Mat r...
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...
sensor_msgs::CompressedImagePtr toCompressedImageMsg(const Format dst_format=JPG) const