imaqConvolve2

NI Vision for LabWindows/CVI Function

imaqConvolve2

Usage

int imaqConvolve2(Image* dest, Image* source, float* kernel, int matrixRows, int matrixCols, float normalize, Image* mask, RoundingMode roundingMode);

Purpose

Applies a linear filter to an image by convolving the image with a filtering kernel. The convolution kernel must have an odd width and height.

Image Types Supported

IMAQ_IMAGE_U8, IMAQ_IMAGE_I16, IMAQ_IMAGE_SGL

Parameters

Name

Type

Description

dest Image* The destination image.
source Image* The image to filter. This function modifies the border of the source image. The border must be at least half as large as the larger dimension of the kernel.
kernel float* The matrix representing the linear filter. This parameter is required and cannot be NULL.
matrixRows int The number of rows in the kernel matrix. This number must be odd.
matrixCols int The number of columns in the kernel matrix. This number must be odd.
normalize float The normalization factor. After performing the convolution, the function divides each pixel value by this value. Set this parameter to 0 to divide by the sum of the elements of the kernel.
mask Image* An optional mask image. This image must be an IMAQ_IMAGE_U8 image. The function filters only those pixels in the source image whose corresponding pixels in the mask are non-zero. Set this parameter to NULL to filter the entire image.
roundingMode RoundingMode Specifies the type of rounding to use when dividing image pixels.

Return Value

Type

Description

int On success, this function returns a non-zero value. On failure, this function returns 0. To get extended error information, call imaqGetLastError().

Parameter Discussion

source—This function modifies the source image. If you need the original image, create a copy of the image using imaqDuplicate() before using this function.