problem with cv_bridge
I'm having trouble with using imgMsgToCv() function. I'm using it in a subscriber node to convert images acquired from a camera to opencv IplImage:
void imageCallback(const sensor_msgs::ImageConstPtr& msg)
{
sensor_msgs::CvBridge bridge;
IplImage* imgB = bridge.imgMsgToCv( msg, "mono8");
.
.
in this way things work but I need imgB to be a global variable and when I try to write things like this:
IplImage* imgB;
void imageCallback(const sensor_msgs::ImageConstPtr& msg)
{
sensor_msgs::CvBridge bridge;
imgB = bridge.imgMsgToCv( msg, "mono8");
.
I get this error:
.
/home/dede/electricworkspace/sandbox/labrobrosquadrotor/labrobproject/src/viewer.cpp:20:49: error: no match for ‘operator=’ in ‘imgB = bridge.sensormsgs::CvBridge::imgMsgToCv(boost::sharedptr
> >((* & msg)), std::basic_string (((const char)"mono8"), ((const std::allocator *)(& std::allocator ()))))’ /home/dede/electricworkspace/sandbox/labrobrosquadrotor/labrobproject/src/viewer.cpp:20:49: note: candidate is: /usr/include/opencv-2.3.1/opencv2/core/typesc.h:447:16: note: _IplImage& _IplImage::operator=(const _IplImage&) /usr/include/opencv-2.3.1/opencv2/core/typesc.h:447:16: note: no known conversion for argument 1 from ‘IplImage* {aka _IplImage*}’ to ‘const _IplImage&’
/home/dede/electricworkspace/sandbox/labrobrosquadrotor/labrobproject/src/viewer.cpp:25:25: error: ‘sensormsgs::CvBridge::cvbridge’ has not been declared
but I can't understand where is the problem, any hints on it?
Asked by schizzz8 on 2012-11-08 23:24:41 UTC
Comments
I even cannot find the definition of the method
imgMsgToCv
that you are trying to use. Which ROS distro are you using? Make sure you have read http://ros.org/wiki/Support and check out http://www.ros.org/wiki/cv_bridge/Tutorials/UsingCvBridgeToConvertBetweenROSImagesAndOpenCVImagesAsked by Lorenz on 2012-11-09 03:48:06 UTC