Issues with making timestamped-videos with multiple camera
5 views (last 30 days)
Show older comments
Shivashankar Peruvazhuthi
on 1 Sep 2023
Commented: Shivashankar Peruvazhuthi
on 12 Sep 2023
Hi,
I am acquiring videos of my experimental setup with three cameras. In sequence, I take a snapshot through each camera and also record its timestamp through the snapshot command. Before and after the for loop, I take the clock time (so that I know what time the video began and ended). I have attached the code. The issue however is that, the timestamps from the snapshots reveal a duration more than the duration of the for loop (duration found from the clock times before the start of the for loop and after the end of the loop).
How can this be?
Also, it is weird that cam3 first goes off before cam1, eventhough the first line in the for loop is for cam1.
I have attached:
1) the matlab code
2) the timestamps from the experiment (snapshot times) in a text file called Video_timestamps_test2.txt
3) clock times before and after the for loop (Videotimes_test2.txt)
Thanks for your time.
2 Comments
Accepted Answer
VINAYAK LUHA
on 12 Sep 2023
Hi Shivshankar,
It is my understanding that the mismatch in duration calculated from snapshot timestamps and the duration of the loop also the out of order image capturing from multiple cameras can be explained as below.
The snapshot command returns the most recent frame in the camera buffer and its absolute time of capture. However, the exact time at which each of the cameras will receive the capture signal and start capturing is limited by propagation delay imposed by data-transfer hardware, delays at the camera end due to processing or buffering and I/O scheduling by OS. Hence without any explicit synchronisation mechanism in place, cam3 always captures the image first followed by cam2 and cam1 and the duration mismatch is also likely to happen.
Follow the pointers given below to resolve the issue -
- Leverage mechanisms provided in Image Acquisition Toolbox for synchronised acquisition of images from multiple cameras inputs. More on this in the following link https://in.mathworks.com/matlabcentral/answers/94954-does-the-image-acquisition-toolbox-1-0-r13-0-1-support-simultaneous-image-capture-from-multiple-c.
- Use GigE Vision or other industry standard complaint hardware triggering supported cameras. For a list of supported hardware standards refer to the following documentation https://in.mathworks.com/hardware-support/image-acquisition-hardware.html.
- Consider using a USB card instead of USB hub for connecting cameras, the later splits the available bandwidth between cameras, which may add to delays while the former ensures lesser propagation time and high data transfer bandwidth by adding more USB controllers to the system.
Regards,
Vinayak Luha
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!