cannot use cvimageptr -> expression
I am trying to write a converter from rgb to gray image
and here comes the code :
cv_bridge::CvImagePtr cv_ptr;
cv_ptr = cv_bridge::toCvCopy(img_ , enc::MONO8);
sensor_msgs::Image img2_ = cv_ptr->toImageMsg();
image_pub_.publish(img2_, *ci);
But the compiler says
/root/catkin_ws/src/usb_cam/nodes/usb_cam_node.cpp:178:51: error: conversion from ‘sensor_msgs::ImagePtr {aka boost::shared_ptr<sensor_msgs::image_<std::allocator<void> > >}’ to non-scalar type ‘sensor_msgs::Image’ requested
which maybe means it cannot access the function toImageMsg() from cv_ptr
Hope anyone could help me out of this !
hi administrator, I wonder if there's anything wrong with my question so it's has not been made public