Circular Cross Correlation 2D Using FFT

21 ビュー (過去 30 日間)
Ziv Blum
Ziv Blum 2022 年 4 月 18 日
回答済み: David Goodmanson 2022 年 4 月 18 日
Hello,
How to do Circular Cross Correlation In 2D Using fft ?
I checked this code for vectors and it seems that it works.
Z=ifft2(fft2(X1).*conj(fft2(X2)));
Is this code works also for matrix ?
Dims:
X1 : [m,n]
X2: [m,n]
Z: [m,n]
Thank You.

回答 (1 件)

David Goodmanson
David Goodmanson 2022 年 4 月 18 日
Hi Ziv,
yes, it works similarly.
m = 5;
n = 6;
q = 4;
A = randi(m,n,q);
B = randi(m,n,q);
C = zeros(size(A));
for j = 1:n
for k = 1:q
C(j,k) = sum(circshift(A,[1,1]).*circshift(B,[j,k]),'all'); % [1 1] adjusts the indexing
end
end
C
ifft2(fft2(A).*conj(fft2(B))) % agrees with C

カテゴリ

Help Center および File ExchangeDiscrete Fourier and Cosine Transforms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by