Isotropic Sobel Operator

This is an improved Sobel operator mainly used in edge detection. It uses 3×3 convolution matrix to compute the gradient in the x-direction ($$G_x$$) and y-direction ($$G_y$$):
$G_x = \begin{bmatrix} -1 & 0 & 1\\ -\sqrt 2 & 0 & \sqrt 2 \\ -1 & 0 & 1 \end{bmatrix} * A ~~~~~~~~~~~~ G_y = \begin{bmatrix} -1 & -\sqrt 2 & -1\\ 0 & 0 & 0 \\ 1 & \sqrt 2 & 1 \end{bmatrix} * A$

As with the gradient vector $$(G_x, G_y)$$, we can compute the absolute magnitude of the gradient using:

$G = \sqrt{G_x^2 + G_y^2}$

For example,  if A is the input image

$A = \begin{bmatrix} P_1 & P_2 & P_3\\ P_4 & P_5 & P_6 \\ P_7 & P_8 & P_9 \end{bmatrix}$

We can calculate the gradient vector components:

$G_x = P_3 – P_1 + \sqrt{2}(P_6 – P_4) + P_9 – P_7 \\ G_y = P_7 – P_1 + \sqrt{2}(P_8 – P_2) + P_9 – P_3$