Image Processing Reference
InDepth Information
Fig. 5.14
In a 3D representation of an image, a tangent plane is present for each point. Such a
plane is defined by two gradient vectors in x and ydirection, respectively. Here the tangent plane
is shown for one pixel
Besides a direction the gradient also has a
magnitude
. The magnitude expresses
how steep the landscape is in the direction of the gradient, or how fast the water will
run away (if you go skiing you will know that the magnitude of the gradient usually
defines the difficulty of the piste). The magnitude is the length of the gradient vector
and calculated as
g
x
+
g
y
Magnitude
=
(5.8)
Approximated magnitude
=
g
x
+
g
y

(5.9)
where the approximation is introduced to achieve a faster implementation.
Image Edges
For the curves shown above, the gradients are found as the first order derivatives
denoted
f
(x)
. This can only be calculated for continuous curves and since an im
age has a discrete representation (we only have pixel values at discrete positions:
0
,
1
,
2
,
3
,
4 etc.) we need an approximation. Recalling that the gradient is the slope
at a point we can define the gradient as the difference between the previous and next
value. Concretely we have the following image gradient approximations:
g
x
(x, y)
≈
f(x
+
1
,y)
−
f(x
−
1
,y)
(5.10)
≈
+
−
−
g
y
(x, y)
f(x,y
1
)
f(x,y
1
)
(5.11)
We have included
(x, y)
in the definition of the gradients to indicate that the
gradient values depend on their spatial position. This approximation will produce
positive gradient values when the pixels change from dark to bright and negative
values when a reversed edge is present. This will of course be opposite if the signs