MexicanHatWavelet<T>

Models & Types · AiDotNet.WaveletFunctions

Represents a Mexican Hat wavelet function implementation for signal processing and analysis.

Inheritance: WaveletFunctionBase<T> → MexicanHatWavelet<T>

For Beginners

The Mexican Hat wavelet looks like a sombrero or a bell curve with a dip in the middle.

Think of the Mexican Hat wavelet like a special pattern-matching tool that:

  • Has a distinctive shape with a central peak surrounded by two valleys, then tapering to zero
  • Is excellent at detecting edges, boundaries, and “blob-like” features in your data
  • Gets its name because its shape resembles a Mexican sombrero hat viewed from above

This wavelet is particularly useful for finding places where your data changes its direction twice in a row (like going up, then down, then up again). This makes it ideal for detecting objects in images, finding peaks in signals, or identifying boundaries between different regions.

How It Works

The Mexican Hat wavelet, also known as the Ricker wavelet or the second derivative of the Gaussian function, is a wavelet consisting of a negative normalized second derivative of a Gaussian function. It is commonly used in image processing, computer vision, and various signal analysis applications due to its ability to detect transitions and edges at multiple scales.

Example

using AiDotNet.WaveletFunctions;

var wavelet = new MexicanHatWavelet<double>();
double value = wavelet.Calculate(0.5);
Console.WriteLine($"MexicanHatWavelet: psi(0.5) = {value:F4}");

Constructors

Constructor Summary
MexicanHatWavelet(double sigma) Initializes a new instance of the MexicanHatWavelet class with the specified sigma.

Methods

Method Summary
T Calculate(T x) Evaluates Calculate at every entry of x.
Tensor<T> Calculate(Tensor<T> x) Evaluates Calculate at every entry of x.
ValueTuple<Vector<T>, Vector<T>> Decompose(Vector<T> input) Decomposes an input signal using the Mexican Hat wavelet and its derivative.
Vector<T> GetScalingCoefficients() Gets the scaling coefficients (Mexican Hat function) used in the wavelet transform.
Vector<T> GetWaveletCoefficients() Gets the wavelet coefficients (derivative of Mexican Hat function) used in the wavelet transform.
Vector<T> Reconstruct(Vector<T> approximation, Vector<T> detail) Reconstructs the original signal from approximation and detail coefficients.