3D Cross Correlation

조회 수: 89 (최근 30일)
Wayne
Wayne 2021년 2월 15일
편집: iman taghavi 2022년 7월 4일
Hi there,
I have two 3D datasets with the first two (X,Y) indexes representing spatial positions, and the last index (Z) representing time. Since the two datasets were collected separately and there could be some positional shifts/errors between the two measurements, I want cross-correlate the two matrices such that I can shift one of the dataset accordingly in all three indexes to match the other one.
I found this https://uk.mathworks.com/matlabcentral/fileexchange/61468-xcorr3 which does 3D xcorr, but it does the correlation between a 3D matrix and a 1D signal. In my case, I would like to cross-correlate between two 3D matrices.
Does anyone have any suggestions? Thank you.
  댓글 수: 1
Quentin Mesnildrey
Quentin Mesnildrey 2022년 1월 10일
편집: Quentin Mesnildrey 2022년 1월 10일
Dear Wayne,
I hope this message reaches you well. I am facing the same situation and would be very interested in getting your feedback.
My objective is to compare 2 trajectories (defined by 2D coordinates (x,y) over time), which seems pretty close to what you mentionned.
Best regards,
Quentin

댓글을 달려면 로그인하십시오.

채택된 답변

Pratyush Roy
Pratyush Roy 2021년 2월 19일
Hi Wayne,
Since cross-correlation between two arrays can be assumed to be convolution between the first array and the flipped version of the second array, we can perform N-dimensional convolution between the first array and the flipped second array as a workaround. The convn function might be used to obtain the 3-D convolution. The following code snippet demonstrates the use of convn :
Z = convn(X,Y(end:-1:1,end:-1:1,end:-1:1)) %Here the indices vary from end to 1 as a result of flipping
Hope this helps!
Regards,
Pratyush.
  댓글 수: 1
iman taghavi
iman taghavi 2022년 7월 4일
편집: iman taghavi 2022년 7월 4일
Just a minor comment! If the signals are complex then the cross correlation would be:
Z = convn(X,conj(Y(end:-1:1,end:-1:1,end:-1:1))); %Here the indices vary from end to 1 as a result of flipping

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by