Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Anyone know a little more about smooth3?

Subject: Anyone know a little more about smooth3?

From: Thomas Clark

Date: 27 Nov, 2009 22:23:01

Message: 1 of 1

I'm smoothing a volume, using smooth3().

However, the circumstance is a little unusual - I take a 3D FFT of two volumes (typically 64^3) then multiply the first with the complex conjugate of the second. I then use ifftn to convert back to the real domain.

Essentially, this is correlation in 3D.

Having noisy input data, I've found that I have much better results if I smooth the volume in the spectral domain BEFORE using ifftn to convert back to real space.

But, I'm getting pathologically slow behaviour. As far as I'm aware, smooth3 should involve (essentially) a convolution with some gaussian filter. I was under the impression that this should be a similar order of computational load as doing an FFT. However, it's ~1000x slower than the FFTs that I'm doing on a volume of the same size.

So, I'd like to know more about smooth3, as it seems like its speed is a function of the actual data beeing smoothed. For example, the code below gives the result:
>>Elapsed time without smoothing is 4.085669 seconds.
>>Elapsed time without smoothing is 16.391923 seconds.

... which is exactly what I'd expect (factor of 4 is acceptable) - but my application is being slowed down not by a factor of 4 but close to a factor of 1000.

I can post data if that's a help, but has anyone got any initial clues?


Tom Clark


% Create the volumes
vol1 = rand([64 64 64]);
vol2 = rand([64 64 64]);
% Tictoc the process without smooth3
for i = 1:1:20
    w1 = fftn(vol1);
    w2 = fftn(vol2);
    corr = w1 .* conj(w2);
    out = ifftn(corr);
% And again with smooth3
for i = 1:1:20
    w1 = fftn(vol1);
    w2 = fftn(vol2);
    corr = smooth3(w1 .* conj(w2));
    out = ifftn(corr);

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us