The convolution process works by multiplying every single pixel on the image with the matrix/kernel. And for the outer pixel in top, bottom, right and left there are several ways to do it:
- You can ignore it, so you can start from the second line if the kernel is 3x3.
- You can put a 0 value as the outer border.
- You can copy the closest neighbor pixel value in as the outer border.
- You can pretend the image is circular by using the opposite pixel. Top with bottom and left with right border.
As far as I know the matrix goes from left to right direction. And for that matrix (the edge enhancement), it gets pixel that have huge difference with the left neighbor. The pixel is multiplied with 1 and the left neighbor is multiplied with -1. If the two pixels have huge difference, the result will be near to white (1 or 255) but if the two pixels have small difference, the result will be near black (0).
I hope this answers your questions.