Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

2D circular convolution matrix

525 views
Skip to first unread message

Miguel-?ngel

unread,
Oct 26, 2008, 9:07:01 AM10/26/08
to
Dear all,

I'm trying to figure out the convolution matrix of a 2D-mask in MATLAB, for boht linear and circular convolution.

So far, I've got the command: convmtx2 which successful works when applying the operation: g = H?f if compared to imfilter(f,h,'full').

However, I've not found anything for the circular matrix. I've tried to generate my own matrix according to Gonzalez&Woods (block circulant matrix), but the results are not the same as imfilter(f,h,'circular'). The borders are different in appearance.

On the other hand, I've tried to do it just padding the mask with ceros (padarray(...,'post')) and performing the circular equivalent matrix (gallery('circul',hpadded(:)). The results are the same as with the aforementioned block circulant matrix.

I would be very grateful if you could give any idea about what happen, even if you have any source code. I've not seen anything on the Net about circular convolution matrix for 2D-mask (just only for 1D).

Thank you very much in advance,

MaS

Bruno Luong

unread,
Oct 26, 2008, 5:06:02 PM10/26/08
to
"Miguel-?ngel " <mas...@terra.es> wrote in message <ge1q1l$avl$1...@fred.mathworks.com>...

I have no clear idea what you want to compute.

If you want to compute a convolution on a (Z/nZ) x (Z/mZ) (a torus like), then: simply use conv2, then operate the following on the output: cut the tail and add to the head. The butcher size is the size of the kernel minus one (-1).

Bruno

M.A. Santiago

unread,
Oct 26, 2008, 6:30:05 PM10/26/08
to
Thank you very much for your reply.

Sorry for not being so clear in my last post. My aim is to obtain the convolution matrix in both linear and circular convolution models, that is to say, H_matrix:

g(x,y) = h(x,y) ** f(x,y) <->
g_lexicographic = H_matrix . f_lexicographic

where H_matrix is the convolution matrix and f and g are 2D images.

Depending on the model, you have a diferent structure for the convolution matrix. Regarding lineal convolution, MATLAB offers the "convmtx2" to obtain the convolution matrix, but I have not found anything to get the analagous matrix in circular convolution model 2D.

I'm really interested in the H_matrix and not actually the convolution result, as I expect to perform some operations on that matrix.

I really appreciate your comments.

Best regards,

MaS

Bruno Luong

unread,
Oct 27, 2008, 9:16:01 AM10/27/08
to
"M.A. Santiago" <mas...@terra.es> wrote in message <ge2r1d$fd3$1...@fred.mathworks.com>...

>
> I'm really interested in the H_matrix and not actually the convolution result, as I expect to perform some operations on that matrix.

The same remark applies on the convolution results and matrix.

Result: To convert linear to circular, do the tail cutting and add this tail to the head of the result.

For the matrix, just do the same on its rows.

Bruno

Gal Hubara

unread,
Jan 31, 2015, 12:52:15 PM1/31/15
to
I found this thread while trying to solve the same problem. Did you find a solution eventually?
0 new messages