Basis filters and their duals for a local, weighted, linear expansion locally at each point in a 2D scalar field.
Basis filters and their duals for a local, weighted, quadratic expansion locally at each point in a 2D scalar field.
Basis filters and their duals for a local, weighted, quadratic expansion locally at each point in a 2D scalar field.
See "Spatial domain methods for orientation and velocity estimation" by Gunnar Farneback, chapter 3, for a detailed description.
Implements the spherical Poisson filter as described in "Optical Flow Estimation from Monogenic Phase" by M.
Implements the spherical Poisson filter as described in "Optical Flow Estimation from Monogenic Phase" by M. Felsberg, section 3.4. Although most naturally expressed using quaternions, we simply use scalars.
Implements a weighted, polynomial expansion locally at each point in a 2D scalar field.
Implements a weighted, polynomial expansion locally at each point in a 2D scalar field. The weighting, specified by the "applicability" matrix, would typically be Gaussian for many applications, but that is not required. The basis set consists of the matrices (1, x, y, x2, x * y, y2). To use, simply convolve each of the generated kernels over the field. Each convolution will produce the coefficent for the corresponding basis element.
The outputs are the six kernels: "dcKernel", "xKernel", "yKernel", "xxKernel", "xyKernel" and "yyKernel"
See "Spatial domain methods for orientation and velocity estimation" by Gunnar Farneback, chapter 3, for a detailed description.
Use QuadraticBasis instead
Implements the "applicability" filter as described in "Normalized and differential convolution: methods for interpolation and filtering of incomplete and uncertain data," Knutsson and Westin.
Bilinear filter.
Implements a Blackman window.
Implements a Blackman window.
See http://en.wikipedia.org/wiki/Window_function#Blackman_windows
Creates a mask for an image with 1's in the center of the "valid" region (for convolution or cross correlation) and 0's around the border.
Factory for creating 2D box filters.
An on-center, off-surround filter, implemented as a narrow center Gaussian minus a broad surround Gaussian.
An on-center, off-surround filter, implemented as a narrow center Gaussian minus a broad surround Gaussian. Each Gaussian is normalized to sum to 1.
Factory for creating complex filters (ComplexScalarFields) from a function that generates a complex number at a point given the polar coordinates of that point (r, theta).
Center surround filter implemented as a difference of Gaussians.
Center surround filter implemented as a difference of Gaussians. The total volume under the filter is normalized to zero.
A basis of 9 x 9 Gabor filters from the paper "The design and use of steerable filters," Freeman and Adelson, 1991.
A basis of 9 x 9 Gabor filters from the paper "The design and use of steerable filters," Freeman and Adelson, 1991.
These use the separable G2 and H2 filters, 7 different filters total.
Utilities for computing 1-D Gaussians.
Constructor for a simple symmetric Gaussian filter.
The LanczosFilter is used for resampling discrete images, especially upsampling, to interpolate missing values.
The LanczosFilter is used for resampling discrete images, especially upsampling, to interpolate missing values. This implementation is used mainly for 2X upsampling, meaning that an M x N image is interpolated to a 2M x 2N image. To use this kernel, convert the M x N image to 2M x 2N by inserting zeroes in the unsampled points, then convolving that with this kernel. Higher upsampling is also possible (below).
The filter has a parameter, a, which implicitly defines the size of the filter. In practice, only two values of a are used:
a kernel size ------------------ 2 7 x 7 3 11 x 11
The default value for a is 2 since it is the "best compromise in terms of reduction of aliasing, sharpness, and minimal ringing." See http://en.wikipedia.org/wiki/Lanczos_resampling for a discussion of this.
The second parameter, upsampleFactor, defines how much interpolation is to be done. The default value is 2. For a larger value, say K, convert the M x N image to a KM x KN image by inserting zeros and convolving with this kernel.
Does a local polynomial expansion of a 2D image assuming constant certainty and a Gaussian applicability.
Does a local polynomial expansion of a 2D image assuming constant certainty and a Gaussian applicability. See "Polynomial expansion for orientation and motion estimation," Farneback, section 4.8, equations 4.30
Laplacian of a Gaussian.
Laplacian of a Gaussian. See "Vision" by David Marr, section 2.2. Note that this kernel autosizes based on the value of sigma that is supplied (crudely done, but good enough).
Function which performs normalized averaging (often referred to as normalized convolution) of a field.
Function which performs normalized averaging (often referred to as normalized convolution) of a field.
The result is similar to linear diffusion with Dirichlet boundary constraints (where the boundary is formed by the "certain" pixels in the field) but is much faster. This may not be what you want since it produces very fuzzy filled-in regions for large blocks of uncertain values.
Typical usage:
val image: Field // image with missing pixels val applicability = ApplicabilityFilter(width = 33, alpha = 3, beta = 0) val certainty = ScalarField(...) // 1 => pixel certain, 0 => pixel unknown val filteredImage = NormalizedConvolution(image, applicability, certainty)
Does a local polynomial expansion of a 2D image assuming constant certainty and a Gaussian applicability.
Does a local polynomial expansion of a 2D image assuming constant certainty and a Gaussian applicability. See "Polynomial expansion for orientation and motion estimation," Farneback, section 4.8, equations 4.30
Factory for creating Scharr filters, useful for creating tiny gradient operators.
A simple cell filter, using a simple cell model frequently found in the works of Steve Grossberg.
A bank of simple cell filters with equal angular spread.
Steerable filters as described in the paper "The Design and Use of Steerable Filters," Freeman and Adelson, IEEE Trans.
Steerable filters as described in the paper "The Design and Use of Steerable Filters," Freeman and Adelson, IEEE Trans. Patt. Anal. and Machine Intell., vol 13, no. 9, pp 891-901, Sept. 1991.
The filters follow the naming convention of the paper to make it easy to cross reference the paper and implementation.
I have chosen the *SEPARABLE* kernels for the basis kernels, so these can all be implemented more efficiently than with the FFT.
A Stick filter is a 2-dimensional Gaussian with different sigmas for each dimension.
A Stick filter is a 2-dimensional Gaussian with different sigmas for each dimension. The constructor also allows the stick to be offset radially from the center, in the direction perpendicular to the "long" direction of the kernel, and to be rotated. The size of the kernel is computed automatically.
An example of Stick filters with equal angular spread.
Implements a Tukey window.
Implements a Tukey window.
See http://en.wikipedia.org/wiki/Window_function
Basis filters and their duals for a local, weighted, linear expansion locally at each point in a 2D scalar field.
See "Spatial domain methods for orientation and velocity estimation" by Gunnar Farneback, chapter 3, for a detailed description.