Class FactoryKernel


  • public class FactoryKernel
    extends java.lang.Object

    Factory used to create standard convolution kernels for floating point and integer images. The size of a kernel is specified by its radius. The number of elements in a kernel (or its width) is equal to 2*radius+1.

    Types of kernels include; Gaussian.

    • Constructor Summary

      Constructors 
      Constructor Description
      FactoryKernel()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends boofcv.struct.convolve.KernelBase>
      T
      createKernel​(int width, int offset, int DOF, boolean isFloat, int numBits)  
      static boofcv.struct.convolve.Kernel1D createKernel1D​(int offset, int[] data, java.lang.Class kernelType)  
      static <T extends boofcv.struct.convolve.KernelBase>
      T
      createKernelForImage​(int width, int offset, int DOF, boofcv.struct.image.ImageDataType type)  
      static <T extends boofcv.struct.convolve.KernelBase>
      T
      createKernelForImage​(int width, int offset, int DOF, java.lang.Class imageType)  
      static <K1 extends boofcv.struct.convolve.Kernel1D,​K2 extends boofcv.struct.convolve.Kernel2D>
      java.lang.Class<K1>
      get1DType​(java.lang.Class<K2> kernelType)  
      static <K extends boofcv.struct.convolve.KernelBase,​T extends boofcv.struct.image.ImageGray>
      java.lang.Class<K>
      getKernelType​(boofcv.struct.image.ImageDataType type, int DOF)  
      static <K extends boofcv.struct.convolve.KernelBase,​T extends boofcv.struct.image.ImageGray>
      java.lang.Class<K>
      getKernelType​(java.lang.Class<T> imageType, int DOF)  
      static <T extends boofcv.struct.convolve.KernelBase>
      T
      random​(java.lang.Class<?> type, int width, int offset, int min, int max, java.util.Random rand)  
      static <T extends boofcv.struct.convolve.KernelBase>
      T
      random​(java.lang.Class<?> type, int radius, int min, int max, java.util.Random rand)
      Creates a random kernel of the specified type where each element is drawn from an uniform distribution.
      static boofcv.struct.convolve.Kernel1D_F32 random1D_F32​(int width, int offset, float min, float max, java.util.Random rand)
      Creates a random 1D kernel drawn from a uniform distribution.
      static boofcv.struct.convolve.Kernel1D_F64 random1D_F64​(int width, int offset, double min, double max, java.util.Random rand)  
      static boofcv.struct.convolve.Kernel1D_S32 random1D_I32​(int width, int offset, int min, int max, java.util.Random rand)
      Creates a random 1D kernel drawn from a uniform distribution.
      static boofcv.struct.convolve.Kernel2D_F32 random2D_F32​(int width, int offset, float min, float max, java.util.Random rand)
      Creates a random 2D kernel drawn from a uniform distribution.
      static boofcv.struct.convolve.Kernel2D_F64 random2D_F64​(int width, int offset, double min, double max, java.util.Random rand)
      Creates a random 2D kernel drawn from a uniform distribution.
      static boofcv.struct.convolve.Kernel2D_S32 random2D_I32​(int width, int offset, int min, int max, java.util.Random rand)
      Creates a random 2D kernel drawn from a uniform distribution.
      static void setTable​(boofcv.struct.convolve.KernelBase kernel)  
      static boofcv.struct.convolve.Kernel1D_F32 table1D_F32​(int radius, boolean normalized)
      Create an floating point table convolution kernel.
      static boofcv.struct.convolve.Kernel1D_F32 table1D_F32​(int offset, int length, boolean normalized)  
      static boofcv.struct.convolve.Kernel1D_F64 table1D_F64​(int radius, boolean normalized)  
      static boofcv.struct.convolve.Kernel1D_F64 table1D_F64​(int offset, int length, boolean normalized)  
      static boofcv.struct.convolve.Kernel1D_S32 table1D_S32​(int radius)
      Create an integer table convolution kernel.
      static boofcv.struct.convolve.Kernel1D_S32 table1D_S32​(int offset, int length)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FactoryKernel

        public FactoryKernel()
    • Method Detail

      • createKernelForImage

        public static <T extends boofcv.struct.convolve.KernelBase> T createKernelForImage​(int width,
                                                                                           int offset,
                                                                                           int DOF,
                                                                                           boofcv.struct.image.ImageDataType type)
      • createKernelForImage

        public static <T extends boofcv.struct.convolve.KernelBase> T createKernelForImage​(int width,
                                                                                           int offset,
                                                                                           int DOF,
                                                                                           java.lang.Class imageType)
      • createKernel

        public static <T extends boofcv.struct.convolve.KernelBase> T createKernel​(int width,
                                                                                   int offset,
                                                                                   int DOF,
                                                                                   boolean isFloat,
                                                                                   int numBits)
      • createKernel1D

        public static boofcv.struct.convolve.Kernel1D createKernel1D​(int offset,
                                                                     int[] data,
                                                                     java.lang.Class kernelType)
      • setTable

        public static void setTable​(boofcv.struct.convolve.KernelBase kernel)
      • table1D_S32

        public static boofcv.struct.convolve.Kernel1D_S32 table1D_S32​(int radius)

        Create an integer table convolution kernel. All the elements are equal to one.

        See ConvolveImageBox for faster ways to convolve these kernels.

        Parameters:
        radius - kernel's radius.
        Returns:
        table kernel.
      • table1D_S32

        public static boofcv.struct.convolve.Kernel1D_S32 table1D_S32​(int offset,
                                                                      int length)
      • table1D_F32

        public static boofcv.struct.convolve.Kernel1D_F32 table1D_F32​(int radius,
                                                                      boolean normalized)

        Create an floating point table convolution kernel. If un-normalized then all the elements are equal to one, otherwise they are equal to one over the width.

        See ConvolveImageBox or ConvolveImageMean for faster ways to convolve these kernels.

        Parameters:
        radius - kernel's radius.
        Returns:
        table kernel.
      • table1D_F32

        public static boofcv.struct.convolve.Kernel1D_F32 table1D_F32​(int offset,
                                                                      int length,
                                                                      boolean normalized)
      • table1D_F64

        public static boofcv.struct.convolve.Kernel1D_F64 table1D_F64​(int radius,
                                                                      boolean normalized)
      • table1D_F64

        public static boofcv.struct.convolve.Kernel1D_F64 table1D_F64​(int offset,
                                                                      int length,
                                                                      boolean normalized)
      • random

        public static <T extends boofcv.struct.convolve.KernelBase> T random​(java.lang.Class<?> type,
                                                                             int radius,
                                                                             int min,
                                                                             int max,
                                                                             java.util.Random rand)
        Creates a random kernel of the specified type where each element is drawn from an uniform distribution.
        Parameters:
        type - Class of the kernel which is to be created.
        radius - The kernel's radius.
        min - Min value.
        max - Max value.
        rand - Random number generator.
        Returns:
        The generated kernel.
      • random

        public static <T extends boofcv.struct.convolve.KernelBase> T random​(java.lang.Class<?> type,
                                                                             int width,
                                                                             int offset,
                                                                             int min,
                                                                             int max,
                                                                             java.util.Random rand)
      • random1D_I32

        public static boofcv.struct.convolve.Kernel1D_S32 random1D_I32​(int width,
                                                                       int offset,
                                                                       int min,
                                                                       int max,
                                                                       java.util.Random rand)
        Creates a random 1D kernel drawn from a uniform distribution.
        Parameters:
        width - Kernel's width.
        offset - Offset for element zero in the kernel
        min - minimum value.
        max - maximum value.
        rand - Random number generator.
        Returns:
        Randomized kernel.
      • random1D_F32

        public static boofcv.struct.convolve.Kernel1D_F32 random1D_F32​(int width,
                                                                       int offset,
                                                                       float min,
                                                                       float max,
                                                                       java.util.Random rand)
        Creates a random 1D kernel drawn from a uniform distribution.
        Parameters:
        width - Kernel's width.
        offset - Offset for element zero in the kernel
        min - minimum value.
        max - maximum value.
        rand - Random number generator.
        Returns:
        Randomized kernel.
      • random1D_F64

        public static boofcv.struct.convolve.Kernel1D_F64 random1D_F64​(int width,
                                                                       int offset,
                                                                       double min,
                                                                       double max,
                                                                       java.util.Random rand)
      • random2D_I32

        public static boofcv.struct.convolve.Kernel2D_S32 random2D_I32​(int width,
                                                                       int offset,
                                                                       int min,
                                                                       int max,
                                                                       java.util.Random rand)
        Creates a random 2D kernel drawn from a uniform distribution.
        Parameters:
        width - Kernel's width.
        offset - Offset for element zero in the kernel
        min - minimum value.
        max - maximum value.
        rand - Random number generator.
        Returns:
        Randomized kernel.
      • random2D_F32

        public static boofcv.struct.convolve.Kernel2D_F32 random2D_F32​(int width,
                                                                       int offset,
                                                                       float min,
                                                                       float max,
                                                                       java.util.Random rand)
        Creates a random 2D kernel drawn from a uniform distribution.
        Parameters:
        width - Kernel's width.
        offset - Offset for element zero in the kernel
        min - minimum value.
        max - maximum value.
        rand - Random number generator.
        Returns:
        Randomized kernel.
      • random2D_F64

        public static boofcv.struct.convolve.Kernel2D_F64 random2D_F64​(int width,
                                                                       int offset,
                                                                       double min,
                                                                       double max,
                                                                       java.util.Random rand)
        Creates a random 2D kernel drawn from a uniform distribution.
        Parameters:
        width - Kernel's width.
        offset - Offset for element zero in the kernel
        min - minimum value.
        max - maximum value.
        rand - Random number generator.
        Returns:
        Randomized kernel.
      • get1DType

        public static <K1 extends boofcv.struct.convolve.Kernel1D,​K2 extends boofcv.struct.convolve.Kernel2D> java.lang.Class<K1> get1DType​(java.lang.Class<K2> kernelType)
      • getKernelType

        public static <K extends boofcv.struct.convolve.KernelBase,​T extends boofcv.struct.image.ImageGray> java.lang.Class<K> getKernelType​(boofcv.struct.image.ImageDataType type,
                                                                                                                                                   int DOF)
      • getKernelType

        public static <K extends boofcv.struct.convolve.KernelBase,​T extends boofcv.struct.image.ImageGray> java.lang.Class<K> getKernelType​(java.lang.Class<T> imageType,
                                                                                                                                                   int DOF)