且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在MATLAB中查找2个图像集之间的最接近值

更新时间:2021-10-21 22:59:40

解决此问题的一种方法是从两个时间序列的时间范围(A和B)开始.接下来,找到最接近B中所选帧的A元素(带有minabs).从A中的元素搜索B时也采用相同的推理.

One way to tackle this problem is to start with two time series of timeframes (A and B). Next, find the A-element that is the closest to your chosen frame in B (with min and abs). The same reasoning applies for searching B from an element in A.

rate1 = 15 %images per second
rate2 = 6  %images per second

%create timestamps for the two series
A = cumsum(ones(1,100) * (1/rate1));
B = cumsum(ones(1,100) * (1/rate2));

%find which of the given element in B is the closest in A 
indB = 24   % an arbitrary element of B
[M,I] = min(abs(A - B(indB)));  % I is the index of the closest A element