If k provided, then each element of the new matrix is computed by multiplying k by a submatrix of x the same size as k.
The image filter slides over the matrix.
If k omitted, it's possible to use an arbitrary function.
This will also slide over the matrix, calling the function with submatrices.