[ros-users] cvbridge conversion failure
jfaust at willowgarage.com
Thu May 20 16:52:06 UTC 2010
> IplImage* dispImg =
> bridge.imgMsgToCv(&(disparity_msg->image), "passthrough");
> and let boost::shared_ptr do its magic.
> Or, is there something more subtle I just missed?
shared_ptr will not (and cannot) autoconvert from a pointer. Explicitly
creating a shared_ptr naively from image in this case will cause shared_ptr
to try and delete that pointer, which will crash since that pointer is not
valid for deletion.
I believe you can do something like the following (untested):
sensor_msgs::ImageConstPtr image_ptr(disparity_msg, &disparity_msgs->image);
This will share the reference count with disparity_msg, but act like a
pointer to an Image.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the ros-users