Ask Your Question

cvToImgMsg equivalent in Indigo?

asked 2014-10-08 13:51:51 -0500

K. Zeng gravatar image

I have ROS Indigo on Ubuntu Trusty, and I'm following along with this tutorial . However, if I go along with the code exactly, catkin_make tells me that cv_bridge/CvBridge.h doesn't exist. If I replace CvBridge with cv_bridge, it has no problem finding the header file, but I get a problem with the following line:

  sensor_msgs::ImagePtr msg = sensor_msgs::cv_bridge::cvToImgMsg(image.Ipl(), "bgr8");

The message I get is "error: ‘sensor_msgs::cv_bridge’ has not been declared". Is CvBridge.h deprecated as of Indigo? If so, how do I accomplish what cvToImgMsg is supposed to do?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2014-10-08 14:58:18 -0500

paulbovbel gravatar image

Looks like that tutorial is 4 years old, so sadly looks like the API has been broken since then.

If you take a look at the code api, you can see the correct method to call and the namespace as well. You should be able to call the .toImageMsg() method directly on the CvImage type.

edit flag offensive delete link more


This tutorial looks more up to date

paulbovbel gravatar image paulbovbel  ( 2014-10-08 14:59:58 -0500 )edit

CvBridge.h was deprecated in Fuerte or Groovy, and was removed in Hydro. The cv_bridge tutorials are up to date, but I guess this tutorial didn't get updated along with the others.

ahendrix gravatar image ahendrix  ( 2014-10-08 15:16:34 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-10-08 13:51:51 -0500

Seen: 134 times

Last updated: Oct 08 '14