convolve_image/
kernel.rs

1#[derive(Copy, Clone)]
2pub struct SeparableKernel<const SIZE: usize> {
3    values: [f32; SIZE]
4}
5
6impl<const SIZE: usize> SeparableKernel<SIZE> {
7    pub fn new(values: [f32; SIZE]) -> Self {
8        Self {
9            values
10        }    
11    }
12    
13    pub fn values(&self) -> [f32; SIZE] {
14        self.values
15    }
16}
17
18#[derive(Copy, Clone)]
19pub struct NonSeparableKernel<const SIZE: usize> {
20    values: [[f32; SIZE]; SIZE]
21}
22
23impl<const SIZE: usize> NonSeparableKernel<SIZE> {
24    pub fn new(values:  [[f32; SIZE]; SIZE]) -> Self {
25        Self {
26            values
27        }
28    }
29
30    pub fn values(&self) ->  [[f32; SIZE]; SIZE] {
31        self.values
32    }
33}