I have a Matrix, M, of dimensions width x height. The problem is to apply the [-1, 0, 1] filter along the x and y axis (i.e. convolve the image with [-1, 0, 1] kernel along horizontal and vertical axis) in order to compute derivates dx and dy of M along the x and y direction respectively.
I am somewhat familliar with convolution, however I have never heard the terminology "convolve with kernel". How is this different than convolving two functions?
The following algorithm represents my understanding of how the operation would occur. Is this correct, or is there an error in my understanding?
M <- generate matrix with dimensions width x height
dx <- zero matrix with dimensions width x height
dy <- zero matrix with dimensions width x height
for row from 0 to height:
for col from 0 to width:
dx[row][col] = M[row][col+1] - M[row][col-1]
dy[row][col] = M[row+1][col] - M[row-1][col]