| Customize Help
| Save Settings

MimFilterAdaptive



Function Map
Synopsis
Perform adaptive filtering.
Syntax
void MimFilterAdaptive(
MIL_ID AdaptiveFilterContextImId, //in
MIL_ID SrcImageBufId, //in
MIL_ID DstImageBufId, //in
MIL_DOUBLE Param1, //in
MIL_DOUBLE Param2, //in
MIL_DOUBLE Param3, //in
MIL_INT64 ControlFlag //in
)
Description

This function performs adaptive filtering to remove noise in an image, while preserving edges as much as possible.

Depending on the application, MimFilterAdaptive() will require different value settings for the Param1, Param2, Param3 and ControlFlag parameters. It is recommended that you experiment with different settings to achieve the best level of noise reduction and edge preservation for your application.

Note that adaptive filters are slower than other similar operations, such as rank filters (MimRank()) and most of the filters available using MimConvolve(). If edge preservation is less important than speed for your application, try the predefined or custom filters available in MimConvolve().

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
AdaptiveFilterContextImId

Specifies the predefined adaptive filter context to use.

See the Parameter associations section for possible values that can be specified.

SrcImageBufId

Specifies the identifier of the source image buffer.

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

DstImageBufId

Specifies the identifier of the destination image buffer.

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

Param1

Specifies an attribute of the operation to perform.

See the Parameter associations section for possible values that can be specified.

Param2

Specifies an attribute of the operation to perform.

If not used, set this parameter to M_NULL.

See the Parameter associations section for possible values that can be specified.

Param3

Specifies an attribute of the operation to perform.

If not used, set this parameter to M_NULL.

See the Parameter associations section for possible values that can be specified.

ControlFlag

Specifies how to determine the new value for a pixel determined to be noise.

If not used, set this parameter to M_DEFAULT.

See the Parameter associations section for possible values that can be specified.

The table below lists possible values for the AdaptiveFilterContextImId, Param1, Param2, Param3, and ControlFlag parameters.

The following AdaptiveFilterContextImId and associated Param1, Param2, and Param3 settings are used to determine the type of adaptive filtering to perform.

Set unused parameters to M_NULL (except the ControlFlag parameter, which must be set to M_DEFAULT if not used).

function map For specifying parameters of a bilateral or noise peak elimination adaptive filter operation
Click to summarizeAdaptiveFilterContextImId Description
Param1
Param2
Param3
ControlFlag
Click to summarize M_BILATERAL

Specifies a bilateral adaptive filter operation. A bilateral filter smooths an image while preserving its features. It is effectively an edge-preserving filter.

Bilateral adaptive filtering is based on spatial and intensity weights given to each pixel in a neighborhood, and results in greater or lesser degrees of smoothing and edge preservation, depending on the values set with Param1, Param2, and Param3. This function performs an operation similar to MimConvolve(), except the kernel used in calculations is variable and adapts to the content of the source image.

(summarize)
Click to summarize Param1

Sets the amount of spatial smoothing to perform.

(summarize)
Click to summarize Value > 0.0

Specifies the amount of smoothing. A larger value applies more smoothing than a smaller value.

Note that, beyond a certain value, all the spatial weights in the neighborhood become equal; further increasing Param1 would be useless, but not detrimental.

(summarize)
Click to summarize Param2

Sets how well pixel differences (edges) will be preserved by the smoothing operation.

(summarize)
Click to summarize 0.0 < Value <= 1.0

Specifies the amount of acceptable edge loss. To preserve edges, set Param2 to a low value.

Typically, this parameter is set to a decimal value much less than one.

(summarize)
Click to summarize Param3

Sets the spatial window (neighborhood size) for the operation.

(summarize)
Click to summarize Value > 0

Specifies the spatial window (neighborhood size), in pixels. This parameter should typically be set to an odd value so the kernel is centered on a whole pixel. Even values are supported but not advised.

(summarize)
Click to summarize M_NOISE_PEAK_REMOVAL

Specifies a noise peak elimination adaptive filter operation. A noise peak elimination filter iteratively replaces the central pixel in a 3x3 neighborhood, if the pixel is a minimum or maximum within that neighborhood, and differs from the replacement value by more than a specified threshold. The replacement value is based on the neighboring pixels; how the replacement value is calculated can be set using the ControlFlag parameter.

Optionally, you can specify a gap value. A pixel must be smaller/greater than the minimum/maximum of its neighbors by at least this amount to be considered the minimum/maximum of its neighborhood.

The operation performed is similar to using MimRank() with M_3X3_RECT, except that the rank value is variable and adapts to the content of the source image.

(summarize)
Click to summarize Param1

Sets the number of iterations to perform.

(summarize)
Click to summarize M_DEFAULT
Click to summarize Value >= 1

Specifies the number of iterations.

Click to summarize Param2

Sets the gap value. A pixel must be smaller/greater than the minimum/maximum of its neighbors by at least this amount to be considered the minimum/maximum of its neighborhood.

(summarize)
Click to summarize M_DEFAULT

Specifies the default value; the default value is 1.

Click to summarize Value >= 0

Specifies the gap value.

Click to summarize Param3

Sets the replacement threshold. A pixel is only determined to be noise if its value differs from the replacement value by more than this threshold. The ControlFlag parameter determines how the replacement value is calculated.

(summarize)
Click to summarize M_DEFAULT

Specifies the default value; the default value is 0.

Click to summarize Value >= 0

Specifies the replacement threshold.

Click to summarize ControlFlag

Sets how to calculate the replacement value for each pixel. The replacement value is used to determine whether the pixel is noise. If the pixel is determined to be noise, it is replaced with this value.

(summarize)
Click to summarize M_DEFAULT

Same as M_MEDIAN.

Click to summarize M_EXTREME

Specifies that the replacement value for each pixel is the minimum or maximum value of the neighboring pixels. The extreme closest to the pixel's current value is used.

(summarize)
Click to summarize M_MEAN

Specifies that the replacement value for each pixel is the average value of the neighboring pixels.

Click to summarize M_MEDIAN

Specifies that the replacement value for each pixel is the median value of the neighboring pixels.

Compilation information
Header Include mil.h.
Library Use mil.lib; milim.lib.
DLL Requires mil.dll; milim.dll.
PROC NONE PROC NONE BILATERAL NOISE PEAK REMOVAL DEFAULT DEFAULT DEFAULT DEFAULT EXTREME MEAN MEDIAN