Synopsis
HxImageRep HxConvolution1d (HxImageRep img, HxImageRep kernel, int dimension, HxImageRep::ResultPrecision resPrec)
Input
HxImageRep img
HxImageRep kernel
int dimension
ResultPrecision resPrec
Return value
HxImageRep
Description
The function HxConvolution1d convolves the input image with a 1xn filter in the dimension as given by the integer `dimension'. The convolution kernel can be either a scalar or vector image. If the kernel is scalar, the input image may be a scalar or a vector image. In case of scalar kernels and a vector input image, the convolution is taken separately for each channel. If both kernel and image are vector images, the pixel dimension should be the same. In the latter case, each channel of the input image is convolved with the corresponding channel of the kernel. The kernel should have the same pixel dimensionality.
Remarks
Examples
Convolving an image with 1d kernels in one dimension.
#include "HxImageRepGlobalFuncs.h" #include "HxImageRep.h" HxImageRep HxConvolution1dExample1(HxImageRep img) { img = HxImageAsDouble(img); HxImageRep kernel = HxMakeGaussian1d(3.0, 0, 5.0, 10, -1); img = HxConvolution1d(img, kernel, 2, HxImageRep::DEFAULT_PREC); img = HxImageAsByte(img); return img; } int main(int argc, char* argv[]) { HxImageRep img = HxMakeFromFile(argv[1]); img = HxConvolution1dExample1(img); HxWriteFile(img, argv[2]); return 0; }
Input image for the HxConvolution1d example.
Output image of the HxConvolution1d example.
In this example we generate a 1d Gaussian kernel and covolve the input image with this kernel in the second dimension of this input image.
See also
HxConvolution, HxConvGauss2d, HxConvKernelSeparated, HxConvKernelSeparated2d,
Keywords
Filter, Convolution,