Gaussian Scale Space
Compute the Gaussian scale space of a 1D signal by convolving it with Gaussian kernels at multiple scales.
Given a 1D signal and a list of sigma () values, compute the scale-space representation by convolving the signal with a 1D Gaussian kernel at each scale.
The 1D Gaussian kernel:
Algorithm for each sigma:
- Determine kernel radius: (capture 99.7% of the distribution)
- Build the kernel: compute for
- Normalize the kernel so it sums to 1
- Convolve the signal with the kernel (using zero-padding at boundaries)
Return a list of lists, where each inner list is the smoothed signal at that scale. Round each value to 4 decimal places.
Example
signal = [0, 0, 1, 0, 0] sigmas = [0.5]
[[0.0003, 0.1065, 0.7866, 0.1065, 0.0003]]
- Determine the kernel radius:
- Build and normalize the kernel: compute for and normalize so it sums to 1
- Convolve the signal
[0, 0, 1, 0, 0]with the normalized kernel, using zero-padding at boundaries, resulting in the smoothed signal - Round each value in the smoothed signal to 4 decimal places, yielding the output:
[[0.0003, 0.1065, 0.7866, 0.1065, 0.0003]]
Constraints
- signal: List of floats (1D signal)
- sigmas: List of floats (sigma values for each scale)
- Return: List of lists (one smoothed signal per sigma)
- Kernel radius = ceil(3 * sigma)
- Use zero-padding for boundary handling
- Round to 4 decimal places
- Use math module for exp and sqrt