Sobel Operator
Sobel Edge Detection is one of the most widely used algorithms for edge detection. The Sobel Operator detects edges marked by sudden changes in pixel intensity, as shown in the figure below.
These are the kernels used for Sobel Edge Detection:
X-Direction Kernel: D_x = \frac{1}{8}\begin{equation*} \begin{bmatrix} -1 & 0 & 1 \\ -2 & 0 & 2 \\ -1 & 0 & 1 \end{bmatrix} \end{equation*}
Y-Direction Kernel:
D_y = \frac{1}{8} \begin{equation*} \begin{bmatrix} 1 & 2 & 1 \\ 0 & 0 & 0 \\ -1 & -2 & -1 \end{bmatrix} \end{equation*}
The 1/8 is for normalization. See Scharr Operator for similar idea.