Package boofcv.factory.filter.kernel
Class FactoryKernelGaussian
java.lang.Object
boofcv.factory.filter.kernel.FactoryKernelGaussian
Factory for creating Gaussian kernels for convolution.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Kernel1D>
Tderivative
(int order, boolean isFloat, double sigma, int radius) Creates a 1D Gaussian kernel with the specified properties.protected static Kernel1D_F32
derivative1D_F32
(int order, double sigma, int radius, boolean normalize) Computes the derivative of a Gaussian kernel.derivativeI
(Class<T> imageType, int order, double sigma, int radius) static <T extends Kernel1D>
TderivativeK
(Class<T> kernelType, int order, double sigma, int radius) static <T extends KernelBase>
Tgaussian
(int DOF, boolean isFloat, int numBits, double sigma, int radius) Creates a Gaussian kernel with the specified properties.static <T extends KernelBase>
TCreates a Gaussian kernel of the specified type.gaussian1D
(Class<T> imageType, double sigma, int radius) Creates a 1D Gaussian kernel of the specified type.protected static Kernel1D_F32
gaussian1D_F32
(double sigma, int radius, boolean odd, boolean normalize) Creates a floating point Gaussian kernel with the sigma and radius.protected static Kernel1D_F64
gaussian1D_F64
(double sigma, int radius, boolean odd, boolean normalize) gaussian2D
(ImageDataType imageType, double sigma, int radius) gaussian2D
(Class<T> imageType, double sigma, int radius) Creates a 2D Gaussian kernel of the specified type.static Kernel2D_F32
gaussian2D_F32
(double sigma, int radius, boolean odd, boolean normalize) Creates a kernel for a 2D convolution.static Kernel2D_F32
gaussian2D_F32
(double sigmaX, int radiusX, boolean oddX, double sigmaY, int radiusY, boolean oddY, boolean normalize) static Kernel2D_F64
gaussian2D_F64
(double sigma, int radius, boolean odd, boolean normalize) static Kernel2D_F64
gaussian2D_F64
(double sigmaX, int radiusX, boolean oddX, double sigmaY, int radiusY, boolean oddY, boolean normalize) static Kernel2D_F64
gaussianWidth
(double sigma, int width) Create a gaussian kernel based on its width.static int
radiusForSigma
(double sigma, int order) Given the the sigma of a Gaussian distribution and the order of its derivative, choose an appropriate radius.static double
sigmaForRadius
(double radius, int order) Given the the radius of a Gaussian distribution and the order of its derivative, choose an appropriate sigma.
-
Field Details
-
MIN_FRAC
public static float MIN_FRAC -
MIN_FRACD
public static double MIN_FRACD
-
-
Constructor Details
-
FactoryKernelGaussian
public FactoryKernelGaussian()
-
-
Method Details
-
gaussian
Creates a Gaussian kernel of the specified type.- Parameters:
kernelType
- The type of kernel which is to be created.sigma
- The distributions stdev. If ≤ 0 then the sigma will be computed from the radius.radius
- Number of pixels in the kernel's radius. If ≤ 0 then the sigma will be computed from the sigma.- Returns:
- The computed Gaussian kernel.
-
gaussian1D
public static <T extends ImageGray<T>,K extends Kernel1D> K gaussian1D(Class<T> imageType, double sigma, int radius) Creates a 1D Gaussian kernel of the specified type.- Parameters:
imageType
- The type of image which is to be convolved by this kernel.sigma
- The distributions stdev. If ≤ 0 then the sigma will be computed from the radius.radius
- Number of pixels in the kernel's radius. If ≤ 0 then the sigma will be computed from the sigma.- Returns:
- The computed Gaussian kernel.
-
gaussian2D
public static <T extends ImageGray<T>,K extends Kernel2D> K gaussian2D(Class<T> imageType, double sigma, int radius) Creates a 2D Gaussian kernel of the specified type.- Parameters:
imageType
- The type of image which is to be convolved by this kernel.sigma
- The distributions stdev. If ≤ 0 then the sigma will be computed from the radius.radius
- Number of pixels in the kernel's radius. If ≤ 0 then the sigma will be computed from the sigma.- Returns:
- The computed Gaussian kernel.
-
gaussian2D
public static <T extends ImageGray<T>,K extends Kernel2D> K gaussian2D(ImageDataType imageType, double sigma, int radius) -
gaussian
public static <T extends KernelBase> T gaussian(int DOF, boolean isFloat, int numBits, double sigma, int radius) Creates a Gaussian kernel with the specified properties.- Parameters:
DOF
- 1 for 1D kernel and 2 for 2D kernel.isFloat
- True for F32 kernel and false for I32.numBits
- Number of bits in each data element. 32 or 64sigma
- The distributions stdev. If ≤ 0 then the sigma will be computed from the radius.radius
- Number of pixels in the kernel's radius. If ≤ 0 then the sigma will be computed from the sigma. @return The computed Gaussian kernel.
-
derivativeI
-
derivativeK
-
derivative
public static <T extends Kernel1D> T derivative(int order, boolean isFloat, double sigma, int radius) Creates a 1D Gaussian kernel with the specified properties.- Parameters:
order
- The order of the gaussian derivative.isFloat
- True for F32 kernel and false for I32.sigma
- The distributions stdev. If ≤ 0 then the sigma will be computed from the radius.radius
- Number of pixels in the kernel's radius. If ≤ 0 then the sigma will be computed from the sigma.- Returns:
- The computed Gaussian kernel.
-
gaussian1D_F32
protected static Kernel1D_F32 gaussian1D_F32(double sigma, int radius, boolean odd, boolean normalize) Creates a floating point Gaussian kernel with the sigma and radius. If normalized is set to true then the elements in the kernel will sum up to one.
- Parameters:
sigma
- Distributions standard deviation.radius
- Kernel's radius.odd
- Does the kernel have an even or add widthnormalize
- If the kernel should be normalized to one or not.
-
gaussian1D_F64
protected static Kernel1D_F64 gaussian1D_F64(double sigma, int radius, boolean odd, boolean normalize) -
gaussian2D_F32
Creates a kernel for a 2D convolution. This should only be used for validation purposes.- Parameters:
sigma
- Distributions standard deviation.radius
- Kernel's radius.odd
- Does the kernel have an even or add widthnormalize
- If the kernel should be normalized to one or not.
-
gaussian2D_F32
public static Kernel2D_F32 gaussian2D_F32(double sigmaX, int radiusX, boolean oddX, double sigmaY, int radiusY, boolean oddY, boolean normalize) -
gaussian2D_F64
-
gaussian2D_F64
public static Kernel2D_F64 gaussian2D_F64(double sigmaX, int radiusX, boolean oddX, double sigmaY, int radiusY, boolean oddY, boolean normalize) -
derivative1D_F32
protected static Kernel1D_F32 derivative1D_F32(int order, double sigma, int radius, boolean normalize) Computes the derivative of a Gaussian kernel.- Parameters:
sigma
- Distributions standard deviation.radius
- Kernel's radius.- Returns:
- The derivative of the gaussian
-
sigmaForRadius
public static double sigmaForRadius(double radius, int order) Given the the radius of a Gaussian distribution and the order of its derivative, choose an appropriate sigma.
- Parameters:
radius
- Kernel's radiusorder
- Order of the derivative. 0 original distribution- Returns:
- Default sigma
-
radiusForSigma
public static int radiusForSigma(double sigma, int order) Given the the sigma of a Gaussian distribution and the order of its derivative, choose an appropriate radius.
- Parameters:
sigma
- Distribution's sigmaorder
- Order of the derivative. 0 original distribution- Returns:
- Default sigma
-
gaussianWidth
Create a gaussian kernel based on its width. Supports kernels of even or odd widths .- Parameters:
sigma
- Sigma of the Gaussian distribution. If ≤ 0 then the width will be used.width
- How wide the kernel is. Can be even or odd.- Returns:
- Gaussian convolution kernel.
-