Kernel Processor<T> Class
Abstract base class for computing convolution, correlation, and autocorrelation of signals.
Definition
Namespace: Numerics.NET.SignalProcessing
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.0.0
C#
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.0.0
public abstract class KernelProcessor<T>
- Inheritance
- Object → KernelProcessor<T>
- Derived
Type Parameters
- T
- The element type (T for real kernels, Complex<T> for complex kernels).
Remarks
This class provides high-performance 1D convolution and correlation operations with flexible boundary handling and output modes. It supports both real and complex-valued signals.
Convolution vs. Correlation:
- Convolution: y[n] = Σ_m x[n - (m - a)] · h[m], where a is the anchor index. This is the standard operation for filtering and feature detection.
- Correlation: y[n] = Σ_m x[n - (m - a)] · conj(h[m]). This is used for template matching and signal similarity measurement.
Comparison with other libraries:
- NumPy (np.convolve): Equivalent to using FullLength, SameAsSignal, or NoPadding with Default. Only supports Zero.
- SciPy (scipy.signal.convolve): Similar to NumPy but with additional boundary modes. The mode parameter maps to ConvolutionMode, and method maps to KernelProcessingMethod. Use Origin(Int32) for scipy-style origin specification.
- OpenCV (cv2.filter2D): Typically uses centered kernels with replicate padding. Equivalent to Centered with Replicate.
Constructors
| Kernel | Initializes a new instance of the KernelProcessor<T> class. |
Properties
| Anchor | Gets the kernel anchor configuration that determines the alignment between kernel and signal. |
| Kernel | Gets the length of the kernel. |
| Kernel | Gets a read-only span view of the kernel array for internal use by derived classes. |
| Mode | Gets the output mode that determines the size and alignment of the convolution/correlation result. |
| Padding | Gets the signal padding mode used for boundary extension. |
| Processing | Gets the processing method used for convolution/correlation computation. |
Methods
| Auto | Computes the autocorrelation of a vector (allocating). |
| Auto | Computes the autocorrelation of a signal. |
| Auto | Computes the autocorrelation of a vector (non-allocating). |
| Auto | Computes the autocorrelation of a signal. |
| Convolve( | Computes the convolution of a vector with the stored kernel (allocating). |
| Convolve( | Computes the convolution of a signal with the stored kernel. |
| Convolve( | Computes the convolution of a vector with the stored kernel (non-allocating). |
| Convolve( | Computes the convolution of a signal with the stored kernel. |
| Correlate( | Computes the cross-correlation of a vector with the stored kernel (allocating). |
| Correlate( | Computes the cross-correlation of a signal with the stored kernel. |
| Correlate( | Computes the cross-correlation of a vector with the stored kernel (non-allocating). |
| Correlate( | Computes the cross-correlation of a signal with the stored kernel. |
| Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
| Fill | Fills the head and tail halos of a work buffer based on the specified padding mode. |
| Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) |
| From | Creates a kernel processor for complex-valued kernels with default anchor and padding. |
| From | Creates a kernel processor for real-valued kernels with default anchor and padding. |
| From | Creates a kernel processor for complex-valued kernels. |
| From | Creates a kernel processor for real-valued kernels. |
| Get | Serves as the default hash function. (Inherited from Object) |
| Get | Calculates the expected output length for a given signal length based on the convolution mode. |
| Get | Gets the Type of the current instance. (Inherited from Object) |
| Memberwise | Creates a shallow copy of the current Object. (Inherited from Object) |
| Should | Determines whether to use FFT-based or direct implementation based on signal and kernel sizes. |
| ToString | Returns a string that represents the current object. (Inherited from Object) |