I’m writing a program that allows to preform the SuperResolution algorithm. In the book, on the way of restoration, they uses the discrete Laplacian operator. I must somehow multiply the matrix (my image) by this Laplacian operator. So, i have to represent this operator as a matrix, but i cant imagine HOW?
The text from the book:
The Laplacian is a second-derivative term, but for discrete data, it
can be approximated by a single convolution with a mask of form:

The operator preforms this convolution as matrix multiplication. It has the form like below (blank represents zeroes).

P.S. sorry for my English! 🙂
You just need to apply the 3×3 convolution kernel to your image, e.g. in pseudo-code:
where
imgis the input image,Mis the number of rows,Nis the number of cols,img_outis the convolved output image.Note that the border pixels in
img_outare undefined.