How to construct a 2D Convolution matrix

261 Views Asked by At

I have a problem in understanding this explanation stated in an article, which is as below:

$error = a-Bf$

where, vector $error$ is in lexicographic ordering, vector $a$ is a lexicographic ordering of a 2D dataset with dimension MxN, $f$ is a 2D filter with dimension KxL, and $B$ is the convolution matrix of a 2D dataset $b$. The dimension of $B$ is MNxKL.

Ok, I know that convolution can be rewritten as a Matrix-vector multiplication using the convolution matrix, here, matrix $B$. And, the dimension of $b$ is also MxN. In the above equation $f$ should also be as a vector (probably also in lexicographic ordering).

What I do not understand is how this convolution matrix $B$ is constructed with this dimension? In 1D convolution we use Toeplitz to build the convolution matrix.

How does lexicographic ordering works in this problem?

Could you please give a small numeric example?