Digital Gradient

next up previous 
Next: Compass Gradient Operations Up: gradient Previous: The Gradient Operator 

Digital Gradient

For discrete digital images, the derivative in gradient operation 

\begin{displaymath}D_x[f(x)]=\frac{d}{dx}f(x)=\lim_{\Delta x \rightarrow 0}\frac{f(x+\Delta x)-f(x)}{\Delta x} \end{displaymath}

becomes the difference 

\begin{displaymath}D_n[f[n]]=f[n+1]-f[n],\;\;\;\;\mbox{or}\;\;\;\;\frac{f[n+1]-f[n-1]}{2} \end{displaymath}

Two steps for finding discrete gradient of a digital image:

  • Find the difference: in the two directions: 

    \begin{displaymath}g_m[m,n]=D_m[f[m,n]]=f[m+1,n]-f[m,n] \end{displaymath}


    \begin{displaymath}g_n[m,n]=D_n[f[m,n]]=f[m,n+1]-f[m,n] \end{displaymath}

  • Find the magnitude and direction of the gradient vector: 

    \begin{displaymath}\vert\vert g[m,n]\vert\vert=\sqrt{g^2_m[m,n]+g^2_n[m,n]},\;\;......n]\vert\vert=\vert\vert g_m\vert\vert+\vert\vert g_n\vert\vert \end{displaymath}


    \begin{displaymath}\angle g[m,n]=\tan^{-1} \left(\frac{g_n[m,n]}{g_m[m,n]}\right) \end{displaymath}

The differences in two directions $g_m$ and $g_n$ can be obtained by convolution with the following kernels:

  • Roberts 

    \begin{displaymath}\left[ \begin{array}{rr} -1 & 1  0 & 0 \end{array} \right],......\left[ \begin{array}{rr} -1 & 0  1 & 0 \end{array} \right]\end{displaymath}

    or 

    \begin{displaymath}\left[ \begin{array}{rr} 0 & 1  -1 & 0 \end{array} \right],......\left[ \begin{array}{rr} 1 & 0  0 & -1 \end{array} \right]\end{displaymath}

  • Sobel (3x3) 

    \begin{displaymath}\left[ \begin{array}{rrr} -1 & 0 & 1  -2 & 0 & 2  -1 & 0 ......} -1 & -2 & -1  0 & 0 & 0  1 & 2 & 1\end{array} \right]\end{displaymath}

  • Prewitt (3x3) 

    \begin{displaymath}\left[ \begin{array}{rrr} -1 & 0 & 1  -1 & 0 & 1  -1 & 0 ......} -1 & -1 & -1  0 & 0 & 0  1 & 1 & 1\end{array} \right]\end{displaymath}

  • Prewitt (4x4) 

    \begin{displaymath}\left[ \begin{array}{rrrr} -3 & -1 & 1 & 3  -3 & -1 & 1 & 3......1 & -1 \\1 & 1 & 1 & 1  3 & 3 & 3 & 3 \end{array} \right]\end{displaymath}

Note Sobel and Prewitt operators first find the averages of one direction and then find the difference of these averages in the another direction.


next up previous 
Next: Compass Gradient Operations Up: gradient Previous: The Gradient Operator
Ruye Wang 2013-11-08

 



posted @ 2014-04-29 14:14  fireae  阅读(206)  评论(0编辑  收藏  举报