ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org |
2015-09-04 14:18:09 -0500 | received badge | ● Notable Question (source) |
2015-09-04 14:18:09 -0500 | received badge | ● Famous Question (source) |
2015-06-26 15:34:59 -0500 | received badge | ● Popular Question (source) |
2015-06-03 11:10:07 -0500 | received badge | ● Scholar (source) |
2015-06-03 11:10:05 -0500 | commented answer | cv_bridge: sensor_msgs::Image to sensor_msgs::ImageConstPtr Thank you! That fixed the cv_bridge based errors, now I just need to figure out why I can't get imshow to show anything... Thanks again! |
2015-06-03 08:45:47 -0500 | asked a question | cv_bridge: sensor_msgs::Image to sensor_msgs::ImageConstPtr Hi there! I've been having some real trouble with cv_bridge (and, I guess c++ in general); I'm really stumped as to how to solve this issue but I suspect it's down to a fundamental misunderstanding of c++. I'm trying to write a very basic ros package which will capture a video from a webcam, publish it frame by frame to a topic, and then have a subscriber take the data and display the image. However, I am following an API which stresses that the message must be passed as a sensor_msgs/Image inside another message containing some other information. message definition: My publisher uses cv_bridge in the following manner: Now, my understanding of c++ and pointers is limited (I reference http://www.cplusplus.com/doc/tutorial... constantly...) but, my aim here was to capture a new frame from the webcam convert it using cv_bridge (which leaves me with a sensor_msgs::Image::Ptr) and then add this to my img_msg as a sensor_msgs::Image by using the deference operator (*). It seems to work, but if it's wrong, please say something! I then want my subscriber callback function to work along the lines of: The way I feel it should be done (after reading the documentation) is to convert from sensor_msgs::Image to cv_bridge::CvImage and then extract the CvImage.image, property which should be of type cv::Mat. However, all of the functions return a CvImagePtr for which I thought I could use the deference operator again to get the "data stored at...". Finally, all of the functions to convert from a sensor_msgs::Image to cv_bridge::CvImagePtr must take a const sensor_msgs::ImageConstPtr as an argument. So my question is, how do I get from my sensor_msgs::Image to a sesnor_msgs::ImageConstPtr? I tried: to no avail. |