dcv.imgproc.convolution

Module introduces $(LINK3 https://en.wikipedia.org/wiki/Kernel_(image_processing)#Convolution, image convolution) function.

Following example loads famous image of Lena Söderberg and performs gaussian blurring by convolving the image with gaussian kernel.

import dcv.io.image : imread, ReadParams;
import dcv.core.image : Image, asType;
import dcv.imgproc.convolution : conv;

Image lenaImage = imread("../data/lena.png", ReadParams(ImageFormat.IF_MONO, BitDepth.BD_8));
auto slice = lenaImage.sliced!ubyte;

... this loads the following image:<br> $(IMAGE https://github.com/libmir/dcv/blob/master/examples/data/lena.png?raw=true)

blurred = slice
             .asType!float // convert ubyte data to float.
             .conv(gaussian!float(0.84f, 5, 5)); // convolve image with gaussian kernel

... which give the resulting image:<br> $(IMAGE https://github.com/libmir/dcv/blob/master/examples/filter/result/outblur.png?raw=true)

Members

Functions

conv
InputTensor conv(InputTensor input, KernelTensor kernel, InputTensor prealloc, MaskTensor mask, TaskPool pool)

Perform convolution to given tensor, using given kernel. Convolution is supported for 1, 2, and 3 dimensional tensors.

kapply
auto kapply(T r, T i, T k)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta

Authors

Relja Ljubobratovic

License

$(LINK3 http://www.boost.org/LICENSE_1_0.txt, Boost Software License - Version 1.0).