## Roberts Operator

Compared with the Sobel Operator which use 8 points, the Roberts Operator use only 4 points to compute the gradient magnitude.  The first order derivative represents the directional derivative:

$G_x = \begin{bmatrix} -1 & 0\\ 0 & 1 \end{bmatrix} * A ~~~~~~~~~~~~ G_y = \begin{bmatrix} 0 & -1\\ 1 & 0 \end{bmatrix} * A$

We can compute the gradient magnitude 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 \end{bmatrix}$

For $$P_1$$, the gradient vector components are computed using:

$G_x = P_4 – P_1 \\ G_y = P_3 – P_2$