robotology / robometry

Telemetry suite for logging data from your robot 🤖
https://robotology.github.io/robometry
Other
14 stars 9 forks source link

Investigate the possibility to store synchronized video streams #155

Open S-Dafarra opened 2 years ago

S-Dafarra commented 2 years ago

When logging data, it would be extremely useful to store also video streams. For example, we could log what the robot sees or, even better, external camera flows.

cc @Nicogene @AlexAntn @traversaro @GiulioRomualdi @pattacini @DanielePucci

S-Dafarra commented 2 years ago

For what concerns the saving instead, I think that storing also videos inside the .mat file is not ideal as the dimension of the file might grow too big. Also, it might come in handy to just look at the video first. On the other hand, it would be needed to have some sort of synchronization mechanism between the data and the video.

I tried to have a quick look at possible solutions in this direction. OpenCV might be a good and easy possibility to create the video (see https://www.opencv-srf.com/2018/01/save-images-and-videos-to-file.html). As for the synchronization, one possibility could be to simply store a vector indicating the timestamp of each frame. In this way, given the timestamp, it is enough to get the corresponding frame using something similar to https://stackoverflow.com/a/46101380. It is also possible to get the timestamp of a given frame with https://stackoverflow.com/a/47743467.

There is a caveat. OpenCV can same videos only at a constant framerate. Given that it would be up to the user to save each image, this cannot be enforced.