separableConvolution function
- Image src,
- SeparableKernel kernel
Apply a generic separable convolution filter the src
image, using the
given kernel
.
gaussianBlur is an example of such a filter.
Implementation
Image separableConvolution(Image src, SeparableKernel kernel) {
// Apply the filter horizontally
var tmp = Image.from(src);
kernel.apply(src, tmp, horizontal: true);
// Apply the filter vertically, applying back to the original image.
kernel.apply(tmp, src, horizontal: false);
return src;
}