18 #include <opencv/highgui.h>
21 #include <sensor_msgs/Image.h>
24 #include <mrpt/version.h>
25 #if MRPT_VERSION >= 0x199
26 using namespace mrpt::img;
40 bool ros2mrpt(
const sensor_msgs::Image& msg, CObservationImage& obj)
44 if (!frame1)
return false;
45 IplImage ipl = frame1->
image;
46 obj.image.loadFromIplImage(&ipl);
56 sensor_msgs::Image& msg)
58 CImage temp_img = obj.image;
59 #if MRPT_VERSION>=0x199
60 Mat cvImg = temp_img.asCvMatRef();
62 Mat cvImg = cv::cvarrToMat(temp_img.getAs<IplImage>());
70 msg.encoding =
"bgr8";
71 msg.header = msg_header;
72 msg.height = (int)obj.image.getHeight();
73 msg.width = (int)obj.image.getWidth();