Expand description
2D convolution and correlation with border handling, the shared basis of the image filters.
Images are Array2<f64> indexed (row, column). Kernels have odd dimensions and are centred
on the output pixel. Pixels outside the image are supplied according to a Border mode.
Direct (spatial) evaluation is used; for large kernels see
fft_convolve_2d.
See the book entry Image filtering.
Enums§
- Border
- How to supply pixels beyond the image edge.
Functions§
- border_
index - Maps a possibly out-of-range index into
0..nfor a border mode (Nonemeans “zero”). - convolve2d
- 2D convolution (the kernel is flipped in both axes), output the same size as the input.
- correlate2d
- 2D cross-correlation (the kernel is not flipped):
out[r, c] = Σ image[r+i, c+j] · kernel[i+hr, j+hc]. - gaussian_
kernel_ 1d - A normalised 1D Gaussian kernel with standard deviation
sigma(in pixels), truncated attruncatestandard deviations (4 is conventional) and always of odd length. - separable_
convolve - Separable filtering: convolves every row with
row_kerneland then every column withcol_kernel(both odd length, symmetric or not; true convolution).