stereolabs / zed-sdk

⚡️The spatial perception framework for rapidly building smart robots and spaces
https://stereolabs.com
MIT License
763 stars 452 forks source link

SVO to MP4 (+ downsizing procedure question) #547

Open AlexanderKhazatsky opened 1 year ago

AlexanderKhazatsky commented 1 year ago

Preliminary Checks

Proposal

I would like to convert SVO files to MP4 files, and at a later time down size them in such a way that is identical to passing in the resolution parameter. What is the exact approach used for downsizing images so that I can replicate it without any distribution shift to my model?

Furthermore, it would be awesome if there was a built in way to convert SVO files to MP4 files without having to compress (live to svo), decompress, and then recompress into a new MP4 file.

Use-Case

Converting from SVO files to a more easily readable and supported format.

Anything else?

No response

AlexanderKhazatsky commented 1 year ago

Bump

obraun-sl commented 1 year ago

Hi,

You can use the sample for svo export here : https://github.com/stereolabs/zed-sdk/tree/master/recording/export/svo

You just need to create a single mode left only. You can resize the image using cv::resize() and adjust the resolution when creating the opencv videowriter Here : https://github.com/stereolabs/zed-sdk/blob/master/recording/export/svo/cpp/src/main.cpp#L136

Furthermore, it would be awesome if there was a built in way to convert SVO files to MP4 files without having to compress (live to svo), decompress, and then recompress into a new MP4 file.

That is not possible. SVO file contains RAW YUYV side by side image and the MP4 file will contain RGB Left image. So it cannot be the same encoding. it will always require re-encoding.

AlexanderKhazatsky commented 1 year ago

Hi! The cv2.resize function aside, I wanted to know what resizing scheme was used when we pass in the Zed resolution to the reader functions. Basically, I want to know what resizing parameters to use with cv2.resize so that the resulting images are the same.

AlexanderKhazatsky commented 1 year ago

For example, bilinear, lanzos, etc. What does the Zed SDK use?