Discussion:
convolution matrix
(too old to reply)
Ankit Goyal
2010-06-24 10:11:07 UTC
Permalink
hi Steve

convmtx2 takes a filter (in the form of a 2-D matrix) and returns to you
a convolution matrix. This matrix can be used in a matrix / vector
multiply to perform 2-D convolution.

I have image in stack form in 3D

I want a convmtx3 like function which will takes a filter (in form of a 3-D matrix) and returns us a convolution matrix which can be further used to perform 3D convolution.

I think make myself clear and what typr of function i am expecting.

Please help me Steve. I am looking forward for it.
Its very urgent.

Thanks in advance
Ri
2011-05-27 02:21:05 UTC
Permalink
Post by Ankit Goyal
hi Steve
convmtx2 takes a filter (in the form of a 2-D matrix) and returns to you
a convolution matrix. This matrix can be used in a matrix / vector
multiply to perform 2-D convolution.
I have image in stack form in 3D
I want a convmtx3 like function which will takes a filter (in form of a 3-D matrix) and returns us a convolution matrix which can be further used to perform 3D convolution.
I think make myself clear and what typr of function i am expecting.
Please help me Steve. I am looking forward for it.
Its very urgent.
Thanks in advance
I'm wondering the same thing (How to form a 3D convolution into a multiplication of a column-index ordered vector with a 'convmtx'-style matrix). Did you have any luck figuring this out? Thanks
Matt J
2011-05-27 02:51:04 UTC
Permalink
Post by Ri
I'm wondering the same thing (How to form a 3D convolution into a multiplication of a column-index ordered vector with a 'convmtx'-style matrix). Did you have any luck figuring this out? Thanks
=================

More information is needed in order to advise the best course of action. Is the convolution kernel separable? If so, the 3D convolution matrix is just the kronecker product of 1D convolution matrices. So you can build it using KRON, although a more efficient alternative to KRON is this tool

http://www.mathworks.com/matlabcentral/fileexchange/25969-efficient-object-oriented-kronecker-product-manipulation

Also, do you really need the convolution to be in matrix form, or are you simply looking to implement the convolution using matrix-vector multiplication syntax? If the latter, my MatrixObj tool is sufficient and will save you a lot of memory

http://www.mathworks.com/matlabcentral/fileexchange/26611-on-the-fly-definition-of-custom-matrix-objects

Example:

kernel=rand(3,3,3); % a 3D convolution kernel
x=rand(4,4,4); %A 3D image to be filtered

A=MatrixObj;
A.Ops.mtimes=@(P,Q) convn(kernel,Q); %create a convolution operator

x_filtered= A*x; %equivalent to convn(kernel,x)

Continue reading on narkive:
Loading...