Image derivatives can be computed by using small convolution filters of size 2 × 2 or 3 × 3, such as the Laplacian, Sobel, Roberts and Prewitt operators. However, a larger mask will generally give a better approximation of the derivative and examples of such filters are Gaussian derivatives and Gabor filters. Sometimes high frequency noise needs to be removed and this can be incorporated in the filter so that the Gaussian kernel will act as a band pass filter. The use of Gabor filters in image processing has been motivated by some of its similarities to the perception in the human visual system. The pixel value is computed as a convolution
p u ′ = d ∗ G {\displaystyle p'_{u}=\mathbf {d} \ast G}
where d {\displaystyle \mathbf {d} } is the derivative kernel and G {\displaystyle G} is the pixel values in a region of the image and ∗ {\displaystyle \ast } is the operator that performs the convolution.
Sobel derivatives The derivative kernels, known as the Sobel operator are defined as follows, for the u {\displaystyle u} and v {\displaystyle v} directions respectively:
p u ′ = [ + 1 + 2 + 1 0 0 0 − 1 − 2 − 1 ] ∗ G and p v ′ = [ + 1 0 − 1 + 2 0 − 2 + 1 0 − 1 ] ∗ G {\displaystyle p'_{u}={\begin{bmatrix}+1&+2&+1\\0&0&0\\-1&-2&-1\end{bmatrix}}*\mathbf {G} \quad {\mbox{and}}\quad p'_{v}={\begin{bmatrix}+1&0&-1\\+2&0&-2\\+1&0&-1\end{bmatrix}}*\mathbf {G} }
where ∗ {\displaystyle *} here denotes the 2-dimensional convolution operation. This operator is separable and can be decomposed as the products of an interpolation and a differentiation kernel, so that, p v ′ {\displaystyle p'_{v}} , for an example can be written as
[ + 1 0 − 1 + 2 0 − 2 + 1 0 − 1 ] = [ 1 2 1 ] [ + 1 0 − 1 ] {\displaystyle {\begin{bmatrix}+1&0&-1\\+2&0&-2\\+1&0&-1\end{bmatrix}}={\begin{bmatrix}1\\2\\1\end{bmatrix}}{\begin{bmatrix}+1&0&-1\end{bmatrix}}}
Farid and Simoncelli derivatives Farid and Simoncelli propose to use a pair of kernels, one for interpolation and another for differentiation (compare to Sobel above). These kernels, of fixed sizes 5 x 5 and 7 x 7, are optimized so that the Fourier transform approximates their correct derivative relationship. In Matlab code the so called 5-tap filter is
And the 7-tap filter is
As an example the first order derivatives can be computed in the following using Matlab in order to perform the convolution
… excerpt ends here. Continue reading the full article.
