Skip to content

Instantly share code, notes, and snippets.

@xd009642
Created March 26, 2019 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xd009642/11125e09051799a1b19dac23415f3fdb to your computer and use it in GitHub Desktop.
Save xd009642/11125e09051799a1b19dac23415f3fdb to your computer and use it in GitHub Desktop.
pub struct HoughParameters<T, D, F>
where
D: Dimension,
F: Sized + (Fn(f64) -> Array1<T>),
{
/// Represents the dimensionality of the hough space
pub dim: PhantomData<D>,
/// Parameter bounds
pub bounds: Array2<T>,
/// Search resolution for each parameter. Should be the same size as bounds.
pub resolution: Option<Array1<T>>,
/// Function that taking an angle returns the n-dimensioned point in Hough
/// Space that the entry would belong to. Output should be same dimensions
/// as bounds.
pub get_params: F,
}
/// Trait for a general Hough Transform.
pub trait GeneralisedHoughTransformExt<T, D, F>
where
D: Dimension,
F: Sized + (Fn(f64) -> Array1<T>),
{
/// Given the `HoughParameters` return the accumulated view of the Hough Space
fn hough<S>(&self, d_theta: f64, params: HoughParameters<T, D, F>) -> ArrayBase<S, D>
where
S: Data<Elem = usize>;
}
impl<T, D, F, S> GeneralisedHoughTransformExt<T, D, F> for Array2<S>
where
D: Dimension,
S: Data<Elem = bool>,
F: Sized + (Fn(f64) -> Array1<T>),
{
fn hough<U>(&self, d_theta: f64, params: HoughParameters<T, D, F>) -> ArrayBase<U, D>
where
U: Data<Elem = usize>
{
unimplemented!();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment