Custom image message type
I'm writing to enquire about possibility of ROS supporting or creating a custom sensor message type for video stream (images).
Our product, based on the FPGA, generates the rosbag file and logs one video stream in one file. It uses the VideoLink protocol, which is packet based, so all events on the parallel interface need to be packetized. The ROS message data here holds a data block.
The internal structure of a data block consists of a series of data packets each reflecting one line of the video data, or other data arriving via video link. Short data packets (without actual image) are here to store specific events that are natural to the video link and need to be stored in order to allow all features to be present during playback in a later moment. Long data packets contain one line of a video frame, but may also contain a metadata info block coming over the video link, as sent from camera.
Our goal is to be able to access the video (or images) from the recorded bag files using CvBridge or similar library which supports OpenCV image file format. In a current configuration, ROS environment doesn't recognize this type of message. Is there a posibility to include some plug-in conversion function or a different ROS library which will convert our format to some useable ROS message type. Thank you for your consideration!
Edit: These sensors are commonly used in automotive, and they're able to send multiple expositions. We would like to propose to the comminity to create a format for these messages so they can be widely used. Here's a short presentation:
https://drive.google.com/file/d/1mNuHuRVKaPqupArNdmGqnGkZh5PasaxQ/view?usp=sharing
Asked by latida on 2018-09-12 02:21:20 UTC
Comments
Related / history: #q302472.
Asked by gvdhoorn on 2018-09-12 02:24:38 UTC
If the goal is to be able to pass this video to all types of ROS consumers then converting your datastream into
sensor_msgs/Image
would be the way to go. The "specific events" would probably need custom messages.Conversion to
sensor_msgs/Image
would be up to you I believe, I don't know ..Asked by gvdhoorn on 2018-09-12 02:26:18 UTC
.. of a library available that takes in videolink packets and converts it to camera frames. The msg structures for the events can be created using standard functionality.
As soon as you're using standard infrastructure,
rosbag
and other ROS nodes should be able to work with your data.If your ..
Asked by gvdhoorn on 2018-09-12 02:27:39 UTC
.. goal is to use rosbags (ie:
.bag
files) to store your original data stream (so packet-per-packet) then please clarify. It could still be done (ie: create a custom msg for a videolink packet and store those), but there would be no compatibility withcv_bridge
in that case.Asked by gvdhoorn on 2018-09-12 02:29:00 UTC
Hi, thank you for your answer.To clarify, we're using Omnivision OV2775 and Sony IMX290 image sensors and images (video) is taken in HDR.Those sensors are commonly used in automotive. So, what we want is to store our original data in .bag and than be able to convert them into OpenCV compatible type
Asked by latida on 2018-09-12 05:04:34 UTC
If you want to store data in its original format, then you'll have to create custom msgs that can encode that format.
Conversion to a ROS
cv_bridge
compatible format (I assume that is what you meant) would have to be done afterwards, by a tool you write yourself. Input would be ..Asked by gvdhoorn on 2018-09-12 07:39:16 UTC
.. the
.bag
with the custom msgs, and output could/would be a.bag
withsensor_msgs/Image
(in any of the encodings supported).Conversion could of course also happen live, and then a single back could contain both the original data as well as the converted data.
Asked by gvdhoorn on 2018-09-12 07:40:58 UTC
The problem is that we don't record our data using ROS, just store our data in .bag files using rosbag file format respectively. So, creating custom messages and converting them by writing our own tool would be inconvenient.
Asked by latida on 2018-09-13 03:27:57 UTC
The
bag
format is message based (well, the typical interfaces to it anyway). I'm a little confused as to how you would store data in a bag without using messages.Can you show an example how you write data to the bag right now without using custom messages?
Asked by gvdhoorn on 2018-09-13 03:29:52 UTC
https://drive.google.com/file/d/11ux3tsYEO9D-rCq2KwILWC3GvW8eFdcI/view?usp=sharing (made this for better visualization) These sensors are commonly used in automotive, so this image type is not strictly ours. We would like to propose to the comminity to create a format for these messages so they can
Asked by latida on 2018-09-13 03:42:50 UTC
be widely used.
Asked by latida on 2018-09-13 03:43:16 UTC
I cannot access your google drive without logging in.
I'm getting the impression you have two goals:
.bag
format to store your data in (for your product)Is that correct?
Asked by gvdhoorn on 2018-09-13 03:45:56 UTC
re: your last edit: working with ROS typically means working with msgs. These can be standard msgs (like from
sensor_msgs
) or custom messages.Working with image data in ROS typically means converting whatever device-specific format you have into one of the encodings that
sensor_msgs/Image
..Asked by gvdhoorn on 2018-09-13 03:52:39 UTC
.. supports.
All frame-based cameras in the end capture frames. So that should be convertible to a
sensor_msgs/Image
.If you don't want to do that, you can introduce a custom message that better captures the characteristics of your sensor data.
Asked by gvdhoorn on 2018-09-13 03:54:13 UTC
Perhaps you can clarify this:
why do you record your data in
.bag
format?Asked by gvdhoorn on 2018-09-13 03:55:25 UTC
Refering to your previous comment,that's correct: we want to use .bag format and in order to do that I started this discussion about adding new standard msg type to ROS. We use bags because of: timestamps for every video frame, possible to add information between frames and expand them at some point
Asked by latida on 2018-09-13 05:46:24 UTC
Ok, clear.
Which messages are you using now to store data in the bag file?
Asked by gvdhoorn on 2018-09-13 05:48:19 UTC
That's the main problem here, we've saved our data as the
CameraInfo
messages (which I'm aware isn't correct), but when playing the .bag, there's a warning:Asked by latida on 2018-09-13 06:16:41 UTC
Ah, ok. Now things are starting to become clearer.
re:
CameraInfo
and md5sum invalid: yes, if you did not use the actual msg, then that would fail and lead to these kind of errors.Asked by gvdhoorn on 2018-09-13 06:24:40 UTC
To properly store data in a
.bag
, you'll need to use a ROS message.This can be a custom one that you define or a standard one.
Is your intent to share your
.bag
s with other ROS users or would you want to use those bags with standard ROS tools?Asked by gvdhoorn on 2018-09-13 06:26:21 UTC
I'm just trying to understand your challenge. When it comes to the information you're trying to store, would it be possible to use a standard sensor_msgs/Image along with a synchronised stamped custom message containing the relevant meta data?
Asked by PeteBlackerThe3rd on 2018-09-13 08:21:10 UTC
Or are there more complex cases that could not be cleared represented using a pair of these message types?
Asked by PeteBlackerThe3rd on 2018-09-13 08:22:46 UTC
I've suggested this earlier, but it may have been lost in the long string of comments.
I would say this is going to be the approach to use.
Asked by gvdhoorn on 2018-09-13 13:32:54 UTC
Sorry for misleading, I've made a small presentation abot the problem: https://drive.google.com/file/d/1BMG5UdLPoEzSPQMGagaQ-7007fTNxyCV/view?usp=sharing So, in our current state we're not able to use standard Img msg because of new sensor technology which takes frames in multiple expositions (HDR)
Asked by latida on 2018-09-14 06:15:58 UTC
@latida: no need to apologise. We were just making sure we understood you correctly.
The slides helped.
I think I would again suggest to post to ROS Discourse, as I believe this is more a question of "how should support for multi-exposure images be added to ROS?".
Asked by gvdhoorn on 2018-09-14 07:21:25 UTC
It might be that other community members see a way to do that (in a single message) with the current set of messages, but at least we could have a discussion about that.
If you do post to ROS Discourse, please include:
...
Asked by gvdhoorn on 2018-09-14 07:22:28 UTC
... - a description of your problem (ie: we want to store and process multi-exposure images with ROS messages, how should we do that?"
I will make sure to provide some additional context if you do post (to prevent ppl there saying: "please post on ROS Answers".
Asked by gvdhoorn on 2018-09-14 07:24:32 UTC
Thank you for your patience and your help, I've posted this as a new topic on ROS Discourse and now waiting for the moderator to approve.
Asked by latida on 2018-09-14 09:07:17 UTC
No problem.
Some expectation management: don't be discouraged if it takes some time for people to respond to your post.
Everyone is busy, and it may take a few days.
Asked by gvdhoorn on 2018-09-14 13:21:08 UTC