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.

1 import dcv.io.image : imread, ReadParams;
2 import dcv.core.image : Image, asType;
3 import dcv.imgproc.convolution : conv;
4 
5 Image lenaImage = imread("../data/lena.png", ReadParams(ImageFormat.IF_MONO, BitDepth.BD_8));
6 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 = InputTensor.init, MaskTensor mask = MaskTensor.init, TaskPool pool = taskPool)

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

Meta

Authors

Relja Ljubobratovic

License

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