-1

I am working on ROS groovy, and I want to write a Simple Image Publisher (C++) as described in http://wiki.ros.org/image_transport/Tutorials/PublishingImages. When I want to make the package, I face an error as follows. How can I fix the problem?

... [100%] Building CXX object CMakeFiles/my_publisher.dir/src/my_publisher.cpp.o /home/fatima/learning_image_transport/src/my_publisher.cpp: In function ‘int main(int, char**)’: /home/fatima/learning_image_transport/src/my_publisher.cpp:17:44: error: ‘sensor_msgs::CvBridge’ has not been declared make[3]: * [CMakeFiles/my_publisher.dir/src/my_publisher.cpp.o] Error 1 make[3]: Leaving directory /home/fatima/learning_image_transport/build' make[2]: *** [CMakeFiles/my_publisher.dir/all] Error 2 make[2]: Leaving directory/home/fatima/learning_image_transport/build' make[1]: * [all] Error 2 make[1]: Leaving directory `/home/fatima/learning_image_transport/build' make: * [all] Error 2

Thanks, Samira

tim_yates
  • 167,322
  • 27
  • 342
  • 338

1 Answers1

0

Did you add the following dependencies? sensor_msgs, cv_bridge, std_msgs, image_transport to your package?

I believe the example is out dated. I assume you included <cv_bridge/CvBridge.h> but the file in groovy should be found at <cv_bridge/cv_bridge.h>.

Apart from that, IplImage is part of an old version of OpenCV which was written in C. The newer versions support C++ where you can use cv::Mat as an image. cv::Mat is easier to handle.

Checkout this tutorial CvBridge using cv::Mat. It shows how to convert ros images to opencv images and vice versa. The cv::Mat is contained in the cv_bridge::CvImage wrapper class.

cassinaj
  • 1,043
  • 7
  • 13