ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Save many ROIs with same time stamp inside a bag file

asked 2011-10-05 06:12:15 -0600

DaHoC gravatar image

updated 2014-01-28 17:10:30 -0600

ngrennan gravatar image

Hi, I would like to save ROIs (cv::Rect) and masks (cv::Mat) inside a bag file along with images (cv::Mat). I put the 4 rect values (x,y,width,height) inside a cv::Mat and store them and the masks and the images each with a separate topic and the same corresponding time stamp as the image inside the bag file.

Now it may occur that I have multiple ROIs and masks for one image, in which case I need to save several cv::Mat with the same time stamp into the bag file and I don't think that even works. What would be an elegant approach to cleanly resolve this? I currently add one nsec for each additional mask and ROI to the timestamp of the image, but that clearly is a bad solution.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-10-05 15:59:11 -0600

Tim Field gravatar image

How about creating a new message type to hold the ROIs and masks, e.g.

sensor_msgs/RegionOfInterest[] rois
sensor_msgs/Image[]            masks

stored at the same timestamp of the image?

edit flag offensive delete link more


Hi, that was easier than I thought because RegionOfInterest is missing a header so I could use one header to store the timestamp and added RegionOfInterest[] regionsArray to my new message definition. I used - Thanks!
DaHoC gravatar image DaHoC  ( 2011-10-10 02:28:37 -0600 )edit

Question Tools


Asked: 2011-10-05 06:12:15 -0600

Seen: 410 times

Last updated: Oct 05 '11