#gaussian #filter #kernel #dsp

no-std gaussfilt

Design and apply Gaussian filter for 1D data

4 releases

0.1.3 Apr 4, 2023
0.1.2 Mar 27, 2023
0.1.1 Mar 27, 2023
0.1.0 Mar 27, 2023

#1437 in Math

Download history 79/week @ 2024-07-19 239/week @ 2024-07-26 445/week @ 2024-08-02 868/week @ 2024-08-09 485/week @ 2024-08-16 550/week @ 2024-08-23 886/week @ 2024-08-30 1344/week @ 2024-09-06 846/week @ 2024-09-13 1046/week @ 2024-09-20 567/week @ 2024-09-27 396/week @ 2024-10-04 256/week @ 2024-10-11 271/week @ 2024-10-18 389/week @ 2024-10-25 606/week @ 2024-11-01

1,620 downloads per month
Used in 4 crates (via sci-rs)

MIT/Apache

17KB
301 lines

Gaussian Filtering: gaussfilt

gaussfilt is a no_std library that provides Gaussian filter design and application. Filters may be designed by a known sigma or a known cutoff frequency and sample rate. Orders 0 through 3 are supported.

Allocation is required for kernel design, and interfaces are generic on the num_traits: Float so there are are crate features for choice of "std" or "libm" support.

Here are a couple provided signatures:

  • design_gaussian_filter1d(sigma, order, truncate) -> alloc::Vec<F>
  • design_gaussian_sigma_for_cutoff(cutoff, sample_rate) -> F
  • apply_gaussian_filter(signal: Iterator<F>, kernel: &[F], pad: bool) -> Iterator<F>

Example Usage

Choose a desired cutoff, design a filter, filter some data:

use gaussfilt::*;
let signal = (0..1000).map(|x| x as f32);
let sigma = design_gaussian_sigma_for_cutoff(10., 100.0);
let filter = design_gaussian_filter1d(sigma, 0, 4.0);
let filtered = apply_gaussian_filter1d(signal, &filter, true);
let data = filtered.collect();

Dependencies

~210KB