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

HxConvKernelSeparated

Synopsis

HxImageRep HxConvKernelSeparated (HxImageRep img, HxImageRep kernel, HxImageRep::ResultPrecision resPrec)

Input

HxImageRep img
The image you want to convolve with the kernel defined by the 1d kernel image.

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

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 one dimensional kernel `kernel' for every dimension.

Description

The function HxConvKernelSeparated convolves the input image with a 1xn filter in every direction (dimension) of the image. The convolution kernel can be either a scalar or vector image. If the kernel is a scalar image, the input image may be a scalar or a vector image. In case of a scalar kernel and an vector input image, the convolution (in every direction) 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.

Remarks

Valid input image types
All types of 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 any direction. When the kernel is a vector image, the pixel dimension of the kernel should be equal to the pixel dimension 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 one 1d kernel in all directions.

#include "HxImageRepGlobalFuncs.h"
#include "HxImageRep.h"

HxImageRep HxConvKernelSeparatedExample1(HxImageRep img) {
   img = HxImageAsDouble(img);
   HxImageRep kernel = HxMakeGaussian1d(3.0, 0, 5.0, 10, -1);
   img = HxConvKernelSeparated(img, kernel, HxImageRep::DEFAULT_PREC);
   img = HxContrastStretch(img, 255.0);
   img = HxImageAsByte(img);

   return img;
}

int main(int argc, char* argv[])
{
    HxImageRep im1 = HxMakeFromFile(argv[1]);
    im1 = HxConvKernelSeparatedExample1(im1);
    HxWriteFile(im1, argv[2]);

    return 0;
}

exampleImage1.gif

Input image for the HxConvKernelSeparated example.

HxConvKernelSeparatedResult1.gif

Output image of the HxConvKernelSeparated example.

In this example we generate a 1d Gaussian kernel, after which the input image in this example code is convolved with the kernel in all directions.

See also

HxConvolution, HxConvGauss2d, 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