Crate efd

source · []
Expand description

This crate implements Elliptical Fourier Descriptor (EFD) and its related functions.

Simple usage of resampling circle:

use efd::Efd;
use ndarray::{stack, Array1, Axis};
use std::f64::consts::TAU;

const N: usize = 10;
let circle = stack![
    Axis(1),
    Array1::linspace(0., TAU, N).mapv(f64::cos),
    Array1::linspace(0., TAU, N).mapv(f64::sin)
];
let curve = circle
    .axis_iter(Axis(0))
    .map(|c| [c[0], c[1]])
    .collect::<Vec<_>>();
let new_curve = Efd::from_curve(&curve, None).generate(20);

Features

This crate support no-std solution via using “libm”, a crate provide pure-rust math functions, please enable it if disabled the “std” feature.

Structs

Elliptical Fourier Descriptor coefficients. Provide transformation between discrete points and coefficients.

Geometric information.

Functions

Check the difference between two curves.

Compute the total Fourier power and find the minimum number of harmonics required to exceed the threshold fraction of the total power.

A convenient function to apply Nyquist Frequency on fourier_power function.