xcorr2_fft(a,b)

Two-dimensional cross-correlation evaluated with FFT algorithm
ダウンロード: 1.2K
更新 2015/10/19

ライセンスの表示

xcorr2_fft(A,B) computes the cross-correlation of matrices A and B using the FFT algorithm.
When matrices A and B are real, xcorr2_fft is numerically equivalent to xcorr2, but much faster.
For big matrices, the speed improvement can be up to 100 times!
The correlation is simply evaluated padding matrices a and b with zeros according to the size of the correlation map. In this way, the periodicity of the circular cross-correlation evaluated with the FFT becomes equivalent to the linear cross-correlation evaluated with conv2.
% Example:
a = rand(122); b=rand(332);
a = a-mean(a(:));
b = b-mean(b(:));

tic,cl = xcorr2(a,b);toc
Elapsed time is 0.223502 seconds.
tic,cf = xcorr2_fft(a,b);toc
Elapsed time is 0.030935 seconds.

max(abs(cf(:)-cl(:)))
ans = 4.1922e-13

引用

Alessandro Masullo (2024). xcorr2_fft(a,b) (https://www.mathworks.com/matlabcentral/fileexchange/53570-xcorr2_fft-a-b), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2012b
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersSpectral Measurements についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
1.2.0.0

Updated description

1.1.0.0

Improved speed with a smarter zero-padding

1.0.0.0