I need to calculate 3D cross-correlation in MATLAB. Anyone know which function I should use? For 2–D cross-correlation it has xcorr2
, but I don't know about is 3D.
Asked
Active
Viewed 1.1k times
3

Brock Adams
- 90,639
- 22
- 233
- 295

Nicole
- 477
- 3
- 9
- 19
-
@chaohuang: I have no idea about it, can you please help me? I thought that I may use convn! – Nicole Sep 07 '12 at 00:36
-
@chaohuang: MATLAB has convn, but I am not sure that it do the same work as 3D cross-correlation or not! Do you know any example code for this aim? – Nicole Sep 07 '12 at 02:17
1 Answers
11
Correlation is similar to convolution except that one does not need to flip an input about the origin (but correlation needs taking the complex conjugate of one of the operands), so for 3D real matrices, you can use convn(x3d,y3d(end:-1:1,end:-1:1,end:-1:1))
to compute 3D cross correlation.

chaohuang
- 3,965
- 4
- 27
- 35
-
if the question was helpful you should mark it as best answer :) – George Aprilis Apr 03 '13 at 08:52