1 function J=ImageDerivatives2D(I,sigma,type)
\r
2 % Gaussian based image derivatives
\r
4 % J=ImageDerivatives2D(I,sigma,type)
\r
8 % sigma : Gaussian Sigma
\r
9 % type : 'x', 'y', 'xx', 'xy', 'yy'
\r
12 % J : The image derivative
\r
14 % Function is written by D.Kroon University of Twente (July 2010)
\r
16 % Make derivatives kernels
\r
17 [x,y]=ndgrid(floor(-3*sigma):ceil(3*sigma),floor(-3*sigma):ceil(3*sigma));
\r
21 DGauss=-(x./(2*pi*sigma^4)).*exp(-(x.^2+y.^2)/(2*sigma^2));
\r
23 DGauss=-(y./(2*pi*sigma^4)).*exp(-(x.^2+y.^2)/(2*sigma^2));
\r
25 DGauss = 1/(2*pi*sigma^4) * (x.^2/sigma^2 - 1) .* exp(-(x.^2 + y.^2)/(2*sigma^2));
\r
27 DGauss = 1/(2*pi*sigma^6) * (x .* y) .* exp(-(x.^2 + y.^2)/(2*sigma^2));
\r
29 DGauss = 1/(2*pi*sigma^4) * (y.^2/sigma^2 - 1) .* exp(-(x.^2 + y.^2)/(2*sigma^2));
\r
32 J = imfilter(I,DGauss,'conv','symmetric');
\r