Hi!
What's te best way to solely stream an image from disk? How do I convert from cv::Mat to proper ROS image message?
The relevant snippet would be:
cv_bridge::CvImagePtr cv_ptr;
cv_ptr->image = cv::imread(this->filename_);
image_pub_.publish(cv_ptr->toImageMsg());
How can the cv_bridge::CvImagePtr be initialized? The command above aborts at runtime as one would expect if the constructor requires something else. The error:
iri_simple_perception: /usr/include/boost/smart_ptr/shared_ptr.hpp:418: T* boost::shared_ptr< <template-parameter-1-1> >::operator->() const [with T = cv_bridge::CvImage]: Assertion `px != 0' failed.
Having a look at toCvCopyImpl seems a bit of an overkill ( http://www.ros.org/doc/api/cv_bridge/html/c++/cv__bridge_8cpp_source.html#l00200 ). So, any suggestions?
Originally posted by quimnuss on ROS Answers with karma: 169 on 2011-10-14
Post score: 5