gaussian method

List<Float32List> gaussian(
  1. List<Float32List> src, [
  2. double s = 1,
  3. int kernelSize = 7
])

Perform Gaussian smoothing.

List<Float32List> src The source array to convolve. A nonzero-sized rectangular array of numbers. double s = 1 The standard deviation of the Gaussian kernel to use. Higher values result in smoothing across more cells of the src matrix. int kernelSize = 7 The size of the Gaussian kernel to use. Larger kernels result in slower but more accurate smoothing.

return List<Float32List> An array containing the result of smoothing the src.

Implementation

List<Float32List> gaussian(List<Float32List> src, [double s= 1, int kernelSize = 7]) {
  final kernel = gaussianKernel1D(s, kernelSize);
  int l = kernelSize;
  List<Float32List> kernelH = [kernel];
  List<Float32List> kernelV = [];
  for (int i = 0; i < l; i++) {
    kernelV.add(Float32List.fromList([kernel[i]]));
  }
  return convolve(convolve(src, kernelH), kernelV);
}