Items with no label
3335 Discussions

Saving data from multiple cameras in 1 file.bag using IntelRealsense Viewer

EZann1
Novice
1,754 Views

Hi all,

I am getting started with multiple camera acquisition. I followed the instructions of the white paper, with HW synchronization. I am using the IntelViewer to visualize the images and I would like to record the data for offline processing. Is it possible to save 1 file including both images synchronized or the do we have to save two separate files?

Thanks,

Ema

0 Kudos
1 Solution
MartyG
Honored Contributor III
1,255 Views

I ran some tests with two cameras (I only got a second camera last week, so this is the first time I have tried multi-cam recording). You are correct, the record button for each tries to save the bag files separately. I do apologize. It does seem as though the cameras can be synced but the streams from each are stored in separate bag files. I was not aware of this unfortunately, as today is the first time I have had experience with multi-cam recording.

View solution in original post

0 Kudos
5 Replies
MartyG
Honored Contributor III
1,255 Views

When using multiple data sources at the same time in the RealSense Viewer, everything should get recorded into a single file. In the Viewer's 2D mode, this will be a bag format file, also known as a rosbag. This is an offline recording of all the live data that was occurring during the recording.

 

You can set up sync between multiple cameras in the RealSense Viewer using a setting called Inter Cam Sync Mode, which can be found under the Controls section of the options side-panel.

 

Once you have added each of your cameras to the Viewer, you should set the value of Inter Cam Sync Mode for one of the cameras to a value of '1', indicating that this camera will be the "master" camera that all the other cameras will try to sync with.

 

Each of the remaining cameras should all have their individual Inter Cam Sync Mode set to '2' to indicate that they are "slave" cameras that follow the master.

 

The setup process is illustrated in an audioless YouTube video linked to below.

 

https://www.youtube.com/watch?v=DSm7NYG5bZE&

0 Kudos
EZann1
Novice
1,255 Views

Thank you MartyG,

I did all that you wrote. I have the feeling that I recorded data from just one camera in the bag file because when I try to read the file using matlab I can't access the two devices.

Specifically, my code is the following:

 

cfg = realsense.config();

cfg.enable_device_from_file('C:\Program Files (x86)\Intel RealSense SDK 2.0\matlab\20190429_171854_2cameras.bag');

pipe = realsense.pipeline(); 

profile = pipe.start(cfg);

dev = profile.get_device();

serial_number = dev.get_info(realsense.camera_info.serial_number);

 

And the serial number that I get is only one.

 

I saw the post about getting data from two cameras using matlab wrappers, but I can't use that code to read from recorded files.

I know the serial numbers of my devices, but I don't know how to use them to retrieve data from both devices. I suspect that only data from one camera have been saved, but maybe it's me that I cannot read them properly.

 

Thank you,

Emanuela

 

0 Kudos
MartyG
Honored Contributor III
1,255 Views

A bag file is a recording of data in an offline format. It should be able to be played without accessing the devices that were originally used to record it. For example, in the RealSense Viewer a bag file can be loaded in and played even if a RealSense camera is not attached to the computer.

 

Does the bag file replay correctly with both cameras present when loaded back into the RealSense Viewer, please? That would confirm that the file data contains both cameras, even if MATLAB is having trouble accessing it.

 

You can load a bag into the Viewer just by dragging-and-dropping the file from the folder where it is stored onto the main window of the Viewer.

0 Kudos
EZann1
Novice
1,255 Views

When I open the file with the Viewer I see only one image. During the acquisition I have one record button per camera. Depending on which one I press I save data from either one or the other camera. If I press both, then it saves two independent bag files. What do I do wrong?

Thank you for your patience.

Emanuela

0 Kudos
MartyG
Honored Contributor III
1,256 Views

I ran some tests with two cameras (I only got a second camera last week, so this is the first time I have tried multi-cam recording). You are correct, the record button for each tries to save the bag files separately. I do apologize. It does seem as though the cameras can be synced but the streams from each are stored in separate bag files. I was not aware of this unfortunately, as today is the first time I have had experience with multi-cam recording.

0 Kudos
Reply