我有权按照正确的顺序将多个随机放置的视频帧重新排序。我已经设法做到这一点,每次使用一帧作为参考一次,并找到两个最接近的帧的结构方面的参考框架..可能是这两个最接近的帧将是后面和后面的那帧视频。在找到每个视频帧的两个最接近的帧之后,我会计算一条可能的路径。
然而,我的问题在于表现,特别是在得分时。不幸的是,效率非常低,72帧(320x240)的运行时间仅为得分80秒左右。我对Matlab(或者其他类似的语言)不太熟悉,但是这就是我现在为得分所做的:
for i =1: n_images,
current_image = Images{1,i};
%obtain score pairs image similarity
for j = 1:n_images,
if i ~= j,
scores(1,j) = ssim(Images{1,j}, current_image);
end
end
[svalues, index] = sort(scores,'descend');
Closest(1,i) = index(1,1);
Closest(2,i) = index(1,2);
%Closest consists of a 2 x n_images matrix, where for each frame index, there are two
%column values, which are the indexes of the closest frames.
end任何人都可以给我一些优化指针,或者提供更好的评分方法吗?
编辑:图像被标准化并转换为灰度
编辑#2:我已经尝试使用线程在评分循环中添加parfor,将性能提高了50%左右,但问题是我需要创建一个可执行文件,并且我不确定我是否可以达到相同效果性能..