| Customize Help
| Save Settings

MimConvolve



Function Map
Synopsis
Perform a general convolution operation.
Syntax
void MimConvolve(
MIL_ID SrcImageBufId, //in
MIL_ID DstImageBufId, //in
MIL_ID FilterContextImOrKernelBufId //in
)
Description

This function performs a general convolution operation on the source buffer using the specified filter, storing results in the specified destination buffer. This function supports two types of filters: Finite Impulse Response (FIR) filters and Infinite Impulse Response (IIR) filters. FIR filters operate on a finite neighborhood, while IIR filters take into account all values in an image. You can specify either a predefined FIR filter or a custom FIR or IIR filter.

Note that predefined FIR filters are the fastest type, and are recommended as the first to try if you are not sure which filter will best suit your needs. When using custom filters, relatively small FIR filters are faster and allow control over the kernel contents. If the FIR kernel that you require becomes too large, try an IIR filter. If speed is not an issue, try the adaptive filters available using MimFilterAdaptive(), which remove noise in an image while preserving edges as much as possible.

This function provides a number of predefined FIR filters. For predefined FIR filters, the overscan is set to transparent overscan pixel values, saturation is enabled for results, and the kernel's default center pixel is set as the top-left pixel of the central elements in a neighborhood. When using predefined FIR filters, you cannot change operation control settings except for the overscan.

This function also accepts a custom FIR or IIR filter with which you can customize operation control settings. To define a custom FIR filter, you must allocate a kernel buffer using MbufAlloc1d() or MbufAlloc2d(). Note that the kernel buffer size can be constrained by the available resources. To define a custom IIR filter, you must allocate a linear IIR filter image processing context, using MimAlloc() with M_LINEAR_FILTER_IIR_CONTEXT.

To define a custom FIR filter, you must load the kernel buffer with values, using MbufPut(). When using a custom FIR filter, you can change operation control settings using MbufControl(). To define a custom IIR filter, use MimControl() with a linear IIR filter image processing context and specify appropriate M_FILTER_TYPE, M_FILTER_OPERATION, M_FILTER_RESPONSE_TYPE, M_FILTER_SMOOTHNESS_TYPE, and M_FILTER_SMOOTHNESS operation control type settings.

For predefined and custom FIR filters, when using 32-bit integer buffers and saturation is disabled, the accumulator buffer is a 32-bit internal buffer (MIL_INT); whereas, when saturation is enabled, the accumulator buffer is a 64-bit floating-point internal buffer (double). For custom IIR filters, operations are always performed using floating-point precision.

For custom FIR filters, this function will internally separate a large kernel into two 1-dimensional kernels, if possible, to increase the speed of the convolution operation. For more information on separating kernels, see the Finite Impulse Response (FIR) filters subsection of the Custom spatial filters section of Chapter 4: Advanced image processing.

Custom FIR filters containing a single kernel value (such as uniform kernels or average kernels) are dealt with by a specifically targeted algorithmic optimization.

If the source and destination are multi-band buffers, the same filter is applied to every band of the source buffer.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see which MIL system’s documentation you should use in its place and any possible differences.
Parameters
This function is not supported on the selected boards.
This function reference has not been updated for the selected MIL system. To show the content of this page, choose a second MIL system; refer to the MIL system's release note to see which MIL system’s documentation to choose and any possible differences.
Parameters
SrcImageBufId

Specifies the identifier of the data source of the operation. This parameter must be given an image buffer identifier.

This image buffer must not have a region of interest (ROI) associated with it. Using an image buffer with an ROI will cause an error.

Note that for an FIR filter, the size of the image buffer must be greater or equal to the size of the kernel.

DstImageBufId

Specifies the identifier of the destination of the results. This parameter must be given an image buffer identifier.

This image buffer must not have a region of interest (ROI) associated with it. Using an image buffer with an ROI will cause an error.

Note that for an FIR filter, the size of the image buffer must be greater or equal to the size of the kernel.

FilterContextImOrKernelBufId

Specifies the filter to use. Set this parameter to a predefined filter, the identifier of the kernel buffer which defines a custom FIR filter, or a linear IIR filter image processing context, which defines a custom IIR filter.

To specify a custom filter, set this parameter to one of the following:

function map For specifying a custom filter
Click to summarizeValue Description
Click to summarize Kernel Buffer ID

Specifies the identifier of the kernel buffer for a custom FIR filter, allocated using MbufAlloc...() with M_KERNEL. For more details, refer to the Custom spatial filters section of Chapter 4: Advanced image processing.

(summarize)
Click to summarize Linear IIR filter image processing context ID

Specifies a linear IIR filter image processing context for a custom IIR filter, allocated using MimAlloc() with M_LINEAR_FILTER_IIR_CONTEXT. Set up the context using MimControl().

(summarize)

To specify a predefined FIR filter, set this parameter to one of the following:

function map For specifying a predefined FIR filter
Click to summarizeValue Description
Click to summarize M_EDGE_DETECT_PREWITT_FAST +

Computes the gradient of the image using the following operation, which is based on a Prewitt filter.

(summarize)
Click to summarize M_EDGE_DETECT_SOBEL_FAST +

Computes the gradient of the image using the following operation, which is based on a Sobel filter.

(summarize)
Click to summarize M_HORIZONTAL_EDGE_PREWITT +

Computes the absolute values of the vertical derivative of the image using a Prewitt filter, to detect the horizontal edges.

(summarize)
Click to summarize M_HORIZONTAL_EDGE_SOBEL +

Computes the absolute values of the vertical derivative of the image using a Sobel filter, to detect the horizontal edges.

(summarize)
Click to summarize M_LAPLACIAN_4 +

Computes the Laplacian values of the image using the following 4-connected Laplacian edge detection filter.

(summarize)
Click to summarize M_LAPLACIAN_8 +

Computes the Laplacian values of the image using the following 8-connected Laplacian edge detection filter.

(summarize)
Click to summarize M_LAPLACIAN_ISO_8 +

Computes the Laplacian values of the image using the following 8-connected isotropic Laplacian edge detection filter.

(summarize)
Click to summarize M_PREWITT_X +

Computes the values of the horizontal derivative of the image using a Prewitt filter.

(summarize)
Click to summarize M_PREWITT_Y +

Computes the values of the vertical derivative of the image using a Prewitt filter.

(summarize)
Click to summarize M_SHARPEN_4 +

Performs a sharpening operation on the image using the following 4-connected Laplacian filter combined with the original image.

Note that this operation results in a sharpening effect that is not as strong as the one achieved with M_SHARPEN_8.

(summarize)
Click to summarize M_SHARPEN_8 +

Performs a sharpening operation on the image using the following 8-connected Laplacian filter combined with the original image.

Note that this operation results in a stronger sharpening effect than M_SHARPEN_4.

(summarize)
Click to summarize M_SMOOTH +

Performs a smoothing operation on the image using the following smoothing filter.

(summarize)
Click to summarize M_SOBEL_X +

Computes the values of the horizontal derivative of the image using a Sobel filter.

(summarize)
Click to summarize M_SOBEL_Y +

Computes the values of the vertical derivative of the image using a Sobel filter.

(summarize)
Click to summarize M_VERTICAL_EDGE_PREWITT +

Computes the absolute values of the horizontal derivative of the image using a Prewitt filter, to detect the vertical edges.

(summarize)
Click to summarize M_VERTICAL_EDGE_SOBEL +

Computes the absolute values of the horizontal derivative of the image using a Sobel filter, to detect the vertical edges.

(summarize)
Combination values for the values listed in For specifying a predefined FIR filter.

You can add one of the following values to the above-mentioned values to specify how to determine the value of a destination pixel when its associated point falls outside the source buffer.

function map For specifying how to determine the value of a destination pixel when its associated point falls outside the source buffer
Click to summarizeCombination value Description
Click to summarize M_OVERSCAN_DISABLE

Specifies to disable overscanning for this operation. You should disable overscanning to accelerate the operation for applications in which the overscan data is not important in the resulting buffer.

(summarize)
Click to summarize M_OVERSCAN_ENABLE

Specifies to enable overscanning for this operation. The overscan uses pixels from the ancestor of the source buffer. If the source buffer is not a child buffer, or if the point falls outside the ancestor buffer, a mirror type overscan is used. A mirror overscan specifies that the overscan pixels will be a mirror copy of the source buffer's border pixels.

This is the default value.

(summarize)
Click to summarize M_OVERSCAN_FAST

Specifies that MIL will automatically select the overscan that optimizes speed, according to the specified operation and the target system. The overscan could be hardware-specific thereby having a different behavior than the other supported overscan modes.

Note that when using M_OVERSCAN_FAST, the destination pixels in the overscan area are undefined. The pixels can therefore contain different values from one function call to the next, even if the function's parameter values are the same.

(summarize)
Compilation information
Header Include mil.h.
Library Use mil.lib; milim.lib.
DLL Requires mil.dll; milim.dll.
PROC NONE PROC NONE LINEAR FILTER IIR CONTEXT EDGE DETECT PREWITT FAST EDGE DETECT SOBEL FAST HORIZONTAL EDGE PREWITT HORIZONTAL EDGE SOBEL LAPLACIAN 4 LAPLACIAN 8 LAPLACIAN ISO 8 PREWITT X PREWITT Y SHARPEN 4 SHARPEN 8 SMOOTH SOBEL X SOBEL Y VERTICAL EDGE PREWITT VERTICAL EDGE SOBEL OVERSCAN DISABLE OVERSCAN ENABLE OVERSCAN FAST