utest.cpp
Go to the documentation of this file.
00001 #include "cv_bridge/cv_bridge.h"
00002 #include <sensor_msgs/image_encodings.h>
00003 #include <gtest/gtest.h>
00004 
00005 // Tests conversion of non-continuous cv::Mat. #5206
00006 TEST(CvBridgeTest, NonContinuous)
00007 {
00008   cv::Mat full = cv::Mat::eye(8, 8, CV_16U);
00009   cv::Mat partial = full.colRange(2, 5);
00010   
00011   cv_bridge::CvImage cvi;
00012   cvi.encoding = sensor_msgs::image_encodings::MONO16;
00013   cvi.image = partial;
00014 
00015   sensor_msgs::ImagePtr msg = cvi.toImageMsg();
00016   EXPECT_EQ(msg->height, 8);
00017   EXPECT_EQ(msg->width, 3);
00018   EXPECT_EQ(msg->encoding, cvi.encoding);
00019   EXPECT_EQ(msg->step, 6);
00020 }
00021 
00022 int main(int argc, char** argv)
00023 {
00024   testing::InitGoogleTest(&argc, argv);
00025   return RUN_ALL_TESTS();
00026 }


cv_bridge
Author(s): Patrick Mihelich, James Bowman
autogenerated on Sat Dec 28 2013 17:53:16