next up previous
Next: Digital Gradient Up: gradient Previous: High-boost filtering

The Gradient Operator

The Gradient (also called the Hamilton operator) is a vector operator for any N-dimensional scalar function $f(x_1,\cdots, x_N)=f({\bf x})$, where ${\bf x}=[x_1,\cdots,x_N]^T$ is an N-D vector variable. For example, when $N=3$, $f({\bf x})$ may represent temperature, concentration, or pressure in the 3-D space. The gradient of this N-D function is a vector composed of $N$ components for the $N$ partial derivatives:

\begin{displaymath}
{\bf g}({\bf x})=\bigtriangledown f({\bf x})=\frac{d}{d{\bf ...
...x_1},\cdots,
\frac{\partial f({\bf x})}{\partial x_N}\right]^T
\end{displaymath}

In image processing we only consider 2-D field:

\begin{displaymath}
\bigtriangledown=\left[\begin{array}{c}
\frac{\partial}{\partial x}  \frac{\partial}{\partial y} \end{array}\right]
\end{displaymath}

When applied to a 2-D function $f(x,y)$, this operator produces a vector function:

\begin{displaymath}
{\bf g}=\bigtriangledown f(x,y)
=\left[ \begin{array}{c}\f...
...t]
=\left[ \begin{array}{c} f_x \\ \\ f_y \end{array} \right]
\end{displaymath}

where $f_x=\partial f/\partial x$ and $f_y=\partial f/\partial y$. The direction and magnitude of ${\bf g}$ are respectively

\begin{displaymath}
\angle {\bf g}=\tan^{-1} (f_y/f_x),\;\;\;\;\;\;\;\vert\vert{\bf g}\vert\vert=\sqrt{f_x^2+f_y^2}
\end{displaymath}

Now we show that $f(x,y)$ increases most rapidly along the direction of ${\bf g}=\vec{g}(x,y)$ and the rate of increment is equal to the magnitude of ${\bf g}=\vec{g}(x,y)$.

gradient_direction.gif

Consider the directional derivative of $f(x,y)$ along an arbitrary direction $r$:

\begin{displaymath}\frac{d}{dr}f(x,y)=
\frac{\partial f}{\partial x}\frac{dx}{d...
...l f}{\partial y}\frac{dy}{dr}
=f_x cos \theta+f_y\sin\theta
\end{displaymath}

This directional derivative is a function of $\theta$, defined as the angle between directions $r$ and the positive direction of $x$. To find the direction along which $df/dr$ is maximized, we let

\begin{displaymath}\frac{d}{d\theta} \frac{df(x,y)}{dr}=
\frac{d}{d\theta} (f_x cos \theta+f_y\sin\theta)=
-f_x sin\theta +f_y cos (\theta)=0 \end{displaymath}

Solving this for $\theta$, we get

\begin{displaymath}f_x sin\theta=f_y cos \theta \end{displaymath}

i.e.,

\begin{displaymath}\theta =\tan^{-1} \left(\frac{f_y}{f_x}\right) \end{displaymath}

which is indeed the direction $\angle {\bf g}$ of ${\bf g}=\vec{g}(x,y)$.

From $tan  \theta=f_y/f_x$, we can also get

\begin{displaymath}sin\theta=\frac{f_y}{\sqrt{f_x^2+f_y^2}},\;\;\;\;
cos \theta=\frac{f_x}{\sqrt{f_x^2+f_y^2}}
\end{displaymath}

Substituting these into the expression of $df/dr$, we obtain its maximum magnitude,

\begin{displaymath}\left. \frac{d}{dr}f(x,y) \right\vert _{max}
=\frac{f_x^2+f_y^2}{\sqrt{f_x^2+f_y^2}}=\sqrt{f_x^2+f_y^2} \end{displaymath}

which is the magnitude of $\vec{g}(x,y)$.


next up previous
Next: Digital Gradient Up: gradient Previous: High-boost filtering
Ruye Wang 2016-10-18