Matlab: Tempo-Alignment according to Timestamps

这一生的挚爱 提交于 2019-12-23 01:52:56

问题


May be it is so simple but I'm new to Matlab and not good in Timestamps issues in general. Sorry!

I have two different cameras each contains timestamps of frames. I read them to two arrays TimestampsCam1 and TimestampsCam2:

TimestampsCam1 contains 1500 records and the timestamps are in Microseconds as follows:

1 20931160389
2 20931180407
3 20931200603
4 20931220273
5 20931240360 ...

and TimestampsCam2 contains 1000 records and the timestamps are in Milliseconds as follows:

1 28275280  
2 28315443  
3 28355607  
4 28395771  
5 28435935 ...

The first camera starts capturing first and ends a bit later than the second camera. So what I need to do is to know exactly where a frame from first camera is captured at the same time (or nearly the same time) by the other camera. In other words, I want to align the two arrays(cameras) in time according to the timestamps. I want to get at the end two arrays of same size where each record is tempo-aligned to the corresponding record in the other array.

Many thanks to all!

Sam


回答1:


Make sure they are in the same unit of measurement, e.g. microseconds

Create an index which contains all values, except duplicates, suppose this one is 2400 records long

Create two NaN vectors of length 2400 by putting the value (for example the framenumber) at the place where the index matches the timestamp

Now you have two aligned vectors with NaNs to pad them where required.



来源:https://stackoverflow.com/questions/10107804/matlab-tempo-alignment-according-to-timestamps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!