No timestamp in Image header from CV_bridge
Hi I am using CV_bridge to read a video stream from a webcam and send it to another node via the Image message from common_messages-->senosr_messages. I need the timestamp that the image was taken in the subscriber node, but when I read the header of the Image message I just get 0. Not sure if I have done something wrong or if this is a common error. Ity would be great if anyone could help. OS: Ubuntu 20.04 , ROS: Noetic, Python3
Charlie
Afaik, it's the publishing side's responsibility to set the
header.stamp
field. The various methods inCvBridge
don't copy it.I'm not sure I understand you correctly, but if you mean you'd like to know when the message was received by the subscriber, then that information is not available by default.
There are a few Q&As about that topic specifically here on ROS Answers. I'd advise you to use Google to search. Make sure to append
site:answers.ros.org
to your query.Thanks for your help. Sorry, let me clarify it. I want to see at what time the image was captured by the camera, but would like to access it from the subscriber. Is it a common issue that Cv bridge does not do this?
If cv_bridge doesn't do it is there a way to write to the header whilst using cv_bridge? Charlie
that should then be set by the publisher (ie: the camera driver).
I don't believe it's a responsibility of
CvBridge
, but of the driver.After you've converted an incoming message, you'd still be able to access the
header.stamp
of the original message. If that doesn't contain a valid timestamp, then I would conclude the publishing side hasn't set it properly.this confuses me a little: in general the publishing side would be responsible for setting that field. On the receiving side, you'd convert the message to an image, and would then still be able to access the
header ...
(more)If this is so, what happens when
imgmsg_to_cv2
is used? Is the ROS Image header info lost in the conversion?