在MATLAB中查找2个图像集之间的最接近值 [英] Find closest values between 2 image sets in MATLAB
问题描述
我有2个图像集(每个图像集包含100张图像):
I have 2 image sets (each containing 100 images):
-> First set: a1, a2,..., a100 (15 images per second)
-> Second set: b1, b2,..., b100 (6 images per second)
因此,这两个图像集之间存在偏移.我试图通过在第二组(第一组)中生成重复项来匹配2组:
So, there is a shift between the 2 image sets. I tried to match the 2 sets by generating duplicates in the second set (for the first second):
-> a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15
-> b1, b1, b2, b2, b3, b3, b4, b4, b5, b5, b6, b6
但是随着图像数量的增加,两组之间的偏移会进一步增加. 有谁知道如何找到给定数量的图像的两个图像集之间最接近的值?谢谢你.
But as the number of images increases, the shift between the 2 sets increases further more. Does anyone know how can I find the closest values between the 2 image sets for any given number of images? Thank you.
推荐答案
解决此问题的一种方法是从两个时间序列的时间范围(A和B)开始.接下来,找到最接近B中所选帧的A元素(带有min
和abs
).从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
这篇关于在MATLAB中查找2个图像集之间的最接近值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!