| gauss | images.imfilter | gauss |
gauss -- convolve a list of images with an elliptical Gaussian function
gauss input output sigma
GAUSS convolves the list of images in input with the Gaussian kernel specified by sigma , ratio , theta and nsigma and places the convolved images in output . If the image names in input equal the image names in output the convolution is performed in place and the original images are overwritten. Out of bounds pixels are computed using the algorithm specified by boundary .
If bilinear is "yes" and the major axis of the Gaussian kernel is aligned along either the x or y axis, GAUSS uses the fact that the Gaussian function is mathematically separable (bilinear) in x and y to speed up the convolution process. A bilinear 2D convolution kernel in x and y is one which can be separated into two equivalent 1D convolution kernels in x and y respectively.
Although the bilinear approximation and the full 2D convolution are mathematically equivalent, the user will actually see SMALL differences between an image convolved with the full 2D kernel and the same image convolved with the equivalent bilinear kernel. These differences are the result of the finite size of the convolution kernel (the integration does not extend to infinity in either direction), and the fact that off-axis kernel elements outside the nsigma limit cannot be set to 0 in the bilinear case as they are in the full 2D case. Therefore the bilinear kernel is less radially symmetric than the full 2D kernel. In most cases the differences are small and more than made up for by the greatly decreased execution time.
The Gaussian kernel has an elliptical cross-section and Gaussian profile and is defined mathematically as follows.
1. Circularly Symmetric Gaussian Function
ratio = 1 theta = 0.0 N = normalization factor
G = N * exp (-0.5 * (r / sigma) ** 2)
2. Elliptical Gaussian Function (Theta = 0, 90 or 180)
sigmax = sigma sigmay = ratio * sigmax N = normalization factor
A = cos (theta) ** 2 / sigmax ** 2 + sin (theta) ** 2 / sigmay ** 2
B = 0.0
C = sin (theta) ** 2 / sigmax ** 2 + cos (theta) ** 2 / sigmay ** 2
z = A * x ** 2 + B * x * y + C * y ** 2
G = N * exp (-0.5 * z)
3. Elliptical Gaussian Function (Arbitrary Theta)
sigmax = sigma sigmay = ratio * sigmax N=normalization factor
A = cos (theta) ** 2 / sigmax ** 2 + sin (theta) ** 2 / sigmay ** 2
B = 2 * (1 / sigmax ** 2 - 1 / sigmay ** 2) * sin (theta) * cos (theta)
C = sin (theta) ** 2 / sigmax ** 2 + cos (theta) ** 2 / sigmay ** 2
z = A * x ** 2 + B * x * y + C * y ** 2
G = N * exp (-0.5 * z)
1. Convolve an image with a circular Gaussian function of sigma 2.0, and size 4.0 sigma using nearest neighbour boundary extension and the bilinear kernel.
cl> gauss m83 m83.gau 2.0
2. Do the same convolution using the full 2D kernel.
cl> gauss m83 m83.gau.2D 2.0 bilinear-
3. Convolve an image with an elliptical Gaussian function whose sigma in the major and minor axis direction is 2.0 and 1.5 respectively, and whose position angle is 45 degrees, using wrap around boundary extension. In this case the full 2D kernel is used by default.
cl> gauss m84 m84.gau 2.0 ratio=.75 theta=45. bound=wrap
GAUSS requires approximately 30 and 8 cpu seconds to convolve a 512 square real image with circularly symmetric Gaussian function of sigma 2 pixels, using the full 2D kernel and the bilinear kernel respectively, on a Sparc Station 1.
convolve, gradient, laplace, boxcar