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:
help me separate my 3D convolution

Subject: help me separate my 3D convolution

From: Gregthom

Date: 23 Jun, 2009 14:27:21

Message: 1 of 3

hello,

I've got a convolution excercise,

I have a volume , V, size(V) = (1000,1000,1000);
I have build a gaussian kernel G , size(G) = 100,100,100.

instead of using (slow) convn(V,G) I would like to perform 3 separate convolutions since the gaussian kernel is separable. How to achieve this ? in matlab or c++ ?

thank you

Subject: help me separate my 3D convolution

From: Matt

Date: 23 Jun, 2009 15:05:02

Message: 2 of 3

Gregthom <gregthom99@yahoo.com> wrote in message <19971486.17750.1245767271697.JavaMail.jakarta@nitrogen.mathforum.org>...
> hello,
>
> I've got a convolution excercise,
>
> I have a volume , V, size(V) = (1000,1000,1000);

Do you really have the RAM necesary to hold a 1000^3 volume?!? I need to update my hardware, I guess

> I have build a gaussian kernel G , size(G) = 100,100,100.
>
> instead of using (slow) convn(V,G) I would like to perform 3 separate convolutions since the gaussian kernel is separable. How to achieve this ? in matlab or c++ ?
------

Well, you can still achieve this using convn(). There's no reason you can't pass a 1-dimensional G, for example

tmp=convn(V,Gx); %convolution in x
tmp=convn(tmp,Gy); %convolution in y
tmp=convn(tmp,Gz); %convolution in z


To accelerate things it might be helpful to permute/reshape the data at certain stages
and use conv2(), e.g.

tmp=conv2(reshape(V,100,[]), Gx,'same'); %convolution in x
tmp=conv2(reshape(tmp.',1000,[]), Gy,'same'); %convolution in y
tmp=conv2(reshape(tmp.',1000,[]), Gz,'same'); %convolution in z


Finally, I would point out that the dimensions of G (100x100x100) are probably large enough to merit using fft-based convolution instead.

Subject: help me separate my 3D convolution

From: Bruno Luong

Date: 23 Jun, 2009 16:11:01

Message: 3 of 3

Gregthom <gregthom99@yahoo.com> wrote in message <19971486.17750.1245767271697.JavaMail.jakarta@nitrogen.mathforum.org>...
> hello,
>
> I've got a convolution excercise,
>
> I have a volume , V, size(V) = (1000,1000,1000);

8 Gbytes of data ?

+ 8 Gbytes to store the result.

How big is the RAM of your computer? And how fast is it?

Bruno

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