Horus Doc || Global Function Guide || General documentation   | Function documentation  

HxConvolution1d

Synopsis

HxImageRep HxConvolution1d (HxImageRep img, HxImageRep kernel, int dimension, HxImageRep::ResultPrecision resPrec)

Input

HxImageRep img
The image you want to convolve with the kernel described by the kernelX and kernelY images.

HxImageRep kernel
The kernel for the convolution. The dimensions of this image should be 1xn, where n is an arbitrary positive integer.

int dimension
The dimension of the image that should be covolved with the given kernel.

ResultPrecision resPrec
This parameter determines the precision of the resulting image. The available precision values are DEFAULT_PREC, SOURCE_PREC, ARITH_PREC, SMALL_PREC . See the section on Precision for a more detailed description about precision.

Return value

HxImageRep
The result of convolving the input image with the kernel in the given dimension.

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

Valid input image types
All images are allowed for this function.

Valid kernel image types
The kernel image should be an image of size 1 by x, where x should be smaller or equal to the size of the input image in direction as given by the integer `dimension'. The pixel dimensionality of the kernel should either be 1 or equal to the pixel dimensionality of the input image.

Valid dimension values
The dimension should be at least one and at most equal to the dimensionality of the input image.

Valid precision values
The available precision values are DEFAULT_PREC, SOURCE_PREC, ARITH_PREC, SMALL_PREC . See the section on Precision for a more detailed description about precision.

Border handling
This function uses MIRRORED border handling, see the section on Border handling.

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;
}

exampleImage1.gif

Input image for the HxConvolution1d example.

HxConvolution1dResult1.gif

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,


Generated on Mon Jan 27 15:44:59 2003 for GlobalFunctionGuide by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001