Submitted Successfully!
To reward your contribution, here is a gift for you: A free trial for our video production service.
Thank you for your contribution! You can also upload a video entry or images related to this topic.
Version Summary Created by Modification Content Size Created at Operation
1 handwiki -- 1303 2022-10-28 01:35:56

Video Upload Options

We provide professional Video Production Services to translate complex research into visually appealing presentations. Would you like to try it?

Confirm

Are you sure to Delete?
Cite
If you have any further questions, please contact Encyclopedia Editorial Office.
HandWiki. Image Derivatives. Encyclopedia. Available online: https://encyclopedia.pub/entry/31744 (accessed on 15 November 2024).
HandWiki. Image Derivatives. Encyclopedia. Available at: https://encyclopedia.pub/entry/31744. Accessed November 15, 2024.
HandWiki. "Image Derivatives" Encyclopedia, https://encyclopedia.pub/entry/31744 (accessed November 15, 2024).
HandWiki. (2022, October 28). Image Derivatives. In Encyclopedia. https://encyclopedia.pub/entry/31744
HandWiki. "Image Derivatives." Encyclopedia. Web. 28 October, 2022.
Image Derivatives
Edit

Image derivatives can be computed by using small convolution filters of size 2 x 2 or 3 x 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 where [math]\displaystyle{ \mathbf{d} }[/math] is the derivative kernel and [math]\displaystyle{ G }[/math] is the pixel values in a region of the image and [math]\displaystyle{ \ast }[/math] is the operator that performs the convolution.

small convolution laplacian convolution

1. Sobel Derivatives

The derivative kernels, known as the Sobel operator are defined as follows, for the [math]\displaystyle{ u }[/math] and [math]\displaystyle{ v }[/math] directions respectively:

[math]\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} }[/math]

where [math]\displaystyle{ * }[/math] 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, [math]\displaystyle{ p'_v }[/math], for an example can be written as

[math]\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} }[/math]

2. Farid and Simoncelli Derivatives

Farid and Simoncelli[1][2] 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

k = [0.030320 0.249724 0.439911 0.249724 0.030320]; d = [0.104550 0.292315 0.000000 -0.292315 -0.104550]; d2 = [0.232905 0.002668 -0.471147 0.002668 0.232905];

And the 7-tap filter is

k = [ 0.004711 0.069321 0.245410 0.361117 0.245410 0.069321 0.004711]; d = [ 0.018708 0.125376 0.193091 0.000000 -0.193091 -0.125376 -0.018708]; d2 = [ 0.055336 0.137778 -0.056554 -0.273118 -0.056554 0.137778 0.055336];

As an example the first order derivatives can be computed in the following using Matlab in order to perform the convolution

Iu = conv2(d, k, im, 'same');  % derivative vertically (wrt Y) Iv = conv2(k, d, im, 'same');  % derivative horizontally (wrt X)

It is noted that Farid and Simoncelli have derived first derivative coefficients which are more accurate compared to the ones provided above. However, the latter are consistent with the second derivative interpolator and, therefore, are better to use if both the first and second derivatives are sought. In the opposite case, when only the first derivative is desired, the optimal first derivative coefficients should be employed; more details can be found in their paper.

3. Hast Derivatives

Derivative filters based on arbitrary cubic splines was presented by Hast.[3] He showed how both first and second order derivatives can be computed more correctly using cubic or trigonometric splines. Efficient derivative filters need to be of odd length so that the derivative is computed for the central pixel. However, any cubic filter is fitted over 4 sample points, giving a centre that falls between pixels. This is solved by a double filtering approach giving filters of size 7 x 7. The idea is to first filter by interpolation so that the interpolated value between pixels are obtained, whereafter the procedure is repeated using a derivative filters, where the centre value now falls on pixel centres. This can easily be proved by the associative law for convolution

[math]\displaystyle{ p'_u=\mathbf{d} \ast (\mathbf{k} \ast G) = (\mathbf{d} \ast \mathbf{k}) \ast G }[/math]

Therefore the convolution kernel for computing the derivative [math]\displaystyle{ \mathbf{k_d} }[/math] using an interpolating kernel [math]\displaystyle{ \mathbf{k} }[/math] and a derivative kernel [math]\displaystyle{ \mathbf{d} }[/math] becomes

[math]\displaystyle{ \mathbf{k_d}=\mathbf{d} \ast \mathbf{k} }[/math]

Also keep in mind that convolution is commutative, so that the order of the two kernels does not matter and it is also possible to insert a second order derivative as well as a first order derivative kernel. These kernels are derived from the fact that any spline surface can be fitted over a square pixel region, compare to Bezier surfaces. Hast proves that such a surface can be performed as a separable convolution

[math]\displaystyle{ p(u,v)=\mathbf{u}^T MGM^T \mathbf{v} = M^T \mathbf{u} \otimes \mathbf{v}^T M \ast G }[/math]

where [math]\displaystyle{ M }[/math] is the spline basis matrix, [math]\displaystyle{ \mathbf{u} }[/math] and [math]\displaystyle{ \mathbf{v} }[/math] are vectors containing the variables [math]\displaystyle{ u }[/math] and [math]\displaystyle{ v }[/math], such as

[math]\displaystyle{ \mathbf{u}=[u^3, u^2, u,1]^T }[/math]
[math]\displaystyle{ \mathbf{v}=[v^3, v^2, v,1]^T }[/math]

The convolution kernels can now be set to

[math]\displaystyle{ \mathbf{k}=\mathbf{u}^T M = (M^T \mathbf{v})^T }[/math]
[math]\displaystyle{ \mathbf{d}=\frac{\partial \mathbf{u}^T}{\partial u} M = \left(M^T \frac{\partial \mathbf{v}}{\partial v} \right)^T }[/math]
[math]\displaystyle{ \mathbf{d^2}=\frac{\partial^2 \mathbf{u}^T}{\partial u^2}M = \left(M^T \frac{\partial^2 \mathbf{v}}{\partial v^2} \right)^T }[/math]

The first order derivatives at the central pixel are hence computed as

[math]\displaystyle{ D_u=\frac{\partial \mathbf{u}^T}{\partial u}M \ast \mathbf{u}^T M G M^T \mathbf{v}\ast M^T \mathbf{v}= \mathbf{d} \ast \mathbf{k} \otimes (\mathbf{k} \ast \mathbf{k})^T \ast G }[/math]

and

[math]\displaystyle{ D_v=\mathbf{u}^T M \ast \mathbf{u}^T M G M^T \mathbf{v}\ast M^T \frac{\partial \mathbf{v}}{\partial v}= \mathbf{k} \ast\mathbf{k} \otimes (\mathbf{d} \ast \mathbf{k})^T \ast G }[/math]

Likewise, with the second order derivative kernels are

[math]\displaystyle{ D^2_u=\frac{\partial^2 \mathbf{u}^T}{\partial u^2}M \ast \mathbf{u}^T M G M^T \mathbf{v}\ast M^T \mathbf{v}= \mathbf{d^2} \ast \mathbf{k} \otimes (\mathbf{k} \ast \mathbf{k})^T \ast G }[/math]

and

[math]\displaystyle{ D^2_v=\mathbf{u}^T M \ast \mathbf{u}^T M G M^T \mathbf{v}\ast M^T \frac{\partial^2 \mathbf{v}}{\partial v^2} =\mathbf{k} \ast \mathbf{k} \otimes (\mathbf{d^2} \ast \mathbf{k})^T \ast G }[/math]

The cubic spline filter is evaluated in its centre [math]\displaystyle{ u=v=0.5 }[/math] and therefore

[math]\displaystyle{ \mathbf{u}=\mathbf{v}=[(0.5)^3, (0.5)^2, 0.5, 1]^T=[0.125, 0.25, 0.5,1]^T }[/math]

Likewise the first order derivatives becomes

[math]\displaystyle{ \frac{\partial \mathbf{u}(0.5)}{\partial u}=\frac{\partial \mathbf{v}(0.5)}{\partial v}=[3 \cdot (0.5)^2, 2 \cdot (0.5), 1, 0]^T = [0.75, 1,1,0] ^T }[/math]

And in a similar manner the second order derivatives are

[math]\displaystyle{ \frac{d^2 \mathbf{u}(0.5)}{ u^2}=\frac{d^2 \mathbf{v}(0.5)}{d v^2}=[6 \cdot (0.5), 2, 0, 0]^T=[3,2,0,0]^T }[/math]

Any cubic filter can be applied and used for computing the image derivates using the above equations, such as Bézier, Hermite or B-splines.

The example in below in Matlab use the Catmull-Rom spline to compute the derivatives

M = [1,-3,3,-1; -1,4,-5,2; 0,1,0,-1; 0,0,2,0] * 0.5; u = [0.125;0.25;0.5;1]; up = [0.75;1;1;0]; d = up'*M; k = u'*M; Iu = conv2(conv(d,k), conv(k,k), im,'same');  % vertical derivative (wrt Y) Iv = conv2(conv(k,k), conv(d,k), im,'same');  % horizontal derivative (wrt X)

4. Other Approaches

Steerable filters can be used for computing derivatives[4] Moreover, Savitzky and Golay[5] propose a least-squares polynomial smoothing approach, which could be used for computing derivatives and Luo et al[6] discuss this approach in further detail. Scharr[7][8][9] shows how to create derivative filters by minimizing the error in the Fourier domain and Jähne et al[10] discuss in more detail the principles of filter design, including derivative filters.

References

  1. H. Farid and E. P. Simoncelli, Differentiation of discrete multi-dimensional signals, IEEE Trans Image Processing, vol.13(4), pp. 496--508, Apr 2004. http://www.cns.nyu.edu/pub/lcv/farid03-reprint.pdf
  2. H. Farid and E. P. Simoncelli, Optimally Rotation-Equivariant Directional Derivative Kernels, Int'l Conf Computer Analysis of Images and Patterns, pp. 207--214, Sep 1997. http://www.cs.dartmouth.edu/~farid/downloads/publications/caip97.pdf
  3. A. Hast., "Simple filter design for first and second order derivatives by a double filtering approach", Pattern Recognition Letters, Vol. 42, no.1 June, pp. 65--71. 2014. http://www.sciencedirect.com/science/article/pii/S0167865514000282
  4. W.T. Freeman, E.H. Adelson, The design and use of steerable filters, IEEE Trans. Pattern Anal. Mach. Intell. 13 (1991) 891–906. http://people.csail.mit.edu/billf/www/papers/steerpaper91FreemanAdelson.pdf
  5. A. Savitzky, M.J.E. Golay, Smoothing and differentiation of data by simplified least squares procedures, Anal. Chem. 36 (1964) 1627–1639. https://pubs.acs.org/doi/full/10.1021/ac60214a047
  6. J. Luo, K. Ying, P. He, J. Bai, Properties of savitzky–golay digital differentiators, Digit. Signal Process. 15 (2005) 122–136.
  7. H. Scharr, Optimal second order derivative filter families for transparent motion estimation, in: M. Domanski, R. Stasinski, M. Bartkowiak (Eds.), EUSIPCO 2007. https://www.researchgate.net/profile/Hanno_Scharr/publication/228927501_Optimal_second_order_derivative_filter_families_for_transparent_motion_estimation/links/004635151972e4d50b000000.pdf
  8. Scharr, Hanno, 2000, Dissertation (in German), Optimal Operators in Digital Image Processing . http://nbn-resolving.de/urn/resolver.pl?urn=urn:nbn:de:bsz:16-opus-9622
  9. B. Jähne, H. Scharr, and S. Körkel. Principles of filter design. In Handbook of Computer Vision and Applications. Academic Press, 1999.
  10. B. Jähne, P. Geissler, H. Haussecker (Eds.), Handbook of Computer Vision and Applications with Cdrom, 1st ed., Morgan Kaufmann Publishers Inc., San Francisco, CA, USA, 1999, pp. 125–151 (Chapter 6).
More
Information
Contributor MDPI registered users' name will be linked to their SciProfiles pages. To register with us, please refer to https://encyclopedia.pub/register :
View Times: 881
Entry Collection: HandWiki
Revision: 1 time (View History)
Update Date: 28 Oct 2022
1000/1000
ScholarVision Creations