Filters
Filter values by
First source
  • Context
  • Image
| Customize Help
| Save Settings

MimDifferential



Function Map
Synopsis
Perform a differential operation.
Syntax
void MimDifferential(
MIL_ID Drv1ImageBufIdOrFilterContextImId, //in
MIL_ID SrcOrDrv2ImageBufId, //in
MIL_ID SrcOrDrv3ImageBufId, //in
MIL_ID Drv4ImageBufId, //in
MIL_ID Drv5ImageBufId, //in
MIL_ID Dst1ImageBufId, //in
MIL_ID Dst2ImageBufId, //in
MIL_DOUBLE Param, //in
MIL_INT64 Operation, //in
MIL_INT64 ControlFlag //in
)
Description

This function performs a differential operation on an image, based on either automatically calculated or specified derivative images. This function can be used, for example, to calculate the gradient magnitude and orientation (angle) of edges in an image, or to sharpen an image.

You can have MimDifferential() automatically calculate the required derivatives (in X and Y) of the source image by passing a linear IIR filter image processing context (previously allocated using MimAlloc() with M_LINEAR_FILTER_IIR_CONTEXT). MimDifferential() calculates the derivatives using IIR filters. You can partially define how the derivatives are calculated by configuring the IIR filter image processing context using MimControl(). MimDifferential() ignores the M_FILTER_OPERATION setting.

You can have MimDifferential() use precalculated derivatives by passing derivative image buffers: most operations require one image buffer with the derivative in X, and another with the derivative in Y (for the first derivatives, this is synonymous with passing the vertical and horizontal edge detection images, respectively). Passing precalculated derivatives is useful if you need to calculate the derivatives using a specific filter operation (for example, using MimConvolve() with a predefined FIR filter or a custom kernel), or use the derivatives with multiple functions (in which case, it is more efficient to calculate the derivatives only once).

Note that some operations require the first derivative images, while others require the second derivative images.

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
Drv1ImageBufIdOrFilterContextImId

Specifies the identifier of an image buffer that stores a derivative, or a linear IIR filter context. The image buffer must not have a region of interest (ROI) associated with it. Specifying an image buffer with an ROI will cause an error.

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

SrcOrDrv2ImageBufId

Specifies the identifier of an image buffer that stores the source image, or a derivative. The image buffer must not have a region of interest (ROI) associated with it. Specifying an image buffer with an ROI will cause an error.

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

SrcOrDrv3ImageBufId

Specifies the identifier an image buffer that stores the source image (for a sharpenig operation), or a derivative. The image buffer must not have a region of interest (ROI) associated with it. Specifying an image buffer with an ROI will cause an error.

Set this parameter to M_NULL if not used.

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

Drv4ImageBufId

Reserved for future expansion and must be set to M_NULL.

Drv5ImageBufId

Reserved for future expansion and must be set to M_NULL.

Dst1ImageBufId

Specifies the identifier of the first destination image buffer. The image buffer must not have a region of interest (ROI) associated with it. Specifying an image buffer with an ROI will cause an error.

Set this parameter to M_NULL if not used. In this case, you cannot set Dst2ImageBufId to M_NULL.

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

Dst2ImageBufId

Specifies the identifier of the second destination image buffer. The image buffer must not have a region of interest (ROI) associated with it. Specifying an image buffer with an ROI will cause an error.

Set this parameter to M_NULL if not used. In this case, you cannot set Dst1ImageBufId to M_NULL.

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

Param

Specifies an attribute of the operation to perform. Set this parameter to M_DEFAULT if not used.

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

Operation

Specifies the differential operation to perform.

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

ControlFlag

Specifies a control setting for the operation to perform. Set this parameter to M_DEFAULT if not used.

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

The table below lists possible values for the Drv1ImageBufIdOrFilterContextImId, SrcOrDrv2ImageBufId, SrcOrDrv3ImageBufId, Dst1ImageBufId, Dst2ImageBufId, Param, Operation, and ControlFlag parameters.

Set unused source and destination parameters to M_NULL. Set other unused parameters to M_DEFAULT.

function map For specifying the differential operation
Click to summarize
Operation
Description
Drv1ImageBufIdOrFilterContextImId
SrcOrDrv2ImageBufId
SrcOrDrv3ImageBufId
Dst1ImageBufId
Dst2ImageBufId
Param
ControlFlag
Click to summarize M_GRADIENT

Performs a gradient operation.

(summarize)
Click to summarize Image buffer ID

Specifies the identifier of a float or signed image buffer, indicating the first derivative in X.

(summarize)
Click to summarize SrcOrDrv2ImageBufId

Specifies the identifier of a float or signed image buffer, indicating the first derivative in Y.

(summarize)
Click to summarize Dst1ImageBufId

Specifies the identifier of a float or unsigned image buffer in which to write the results of the gradient magnitude; that is: sqrt(Ix*Ix+Iy*Iy).

To not return this information, set this parameter to M_NULL. In this case, you cannot set Dst2ImageBufId to M_NULL.

(summarize)
Click to summarize Dst2ImageBufId

Specifies the identifier of a float or unsigned image buffer in which to write the results of the gradient orientation.

For an unsigned destination buffer, the angle is returned from 0° to 360° (counter-clockwise) and mapped to the entire range of the destination buffer. For example, for an 8-bit unsigned buffer, the angles of 0°, 90°, 180°, and 270° map to 0, 64, 128, and 192, respectively. For a signed destination buffer, mapping is done in both the positive and negative range of the buffer and represents angle values from -180° to 180°. For example, for an 8-bit signed buffer, the angles of -180°, -90°, 0°, and 90° map to -128, -64, 0 and 64, respectively.

For a floating-point buffer, the results are not mapped and are returned in the range of 0° to 360°.

To not return this information, set this parameter to M_NULL. In this case, you cannot set Dst1ImageBufId to M_NULL.

(summarize)
Click to summarize Linear IIR filter context ID

Specifies the identifier of a linear IIR filter context (M_LINEAR_FILTER_IIR_CONTEXT).

(summarize)
Click to summarize SrcOrDrv2ImageBufId

Specifies the identifier of the source image buffer (of any type) from which to extract the derivatives and compute the gradient.

(summarize)
Click to summarize Dst1ImageBufId

Specifies the identifier of a float or unsigned image buffer in which to write the results of the gradient magnitude; that is: sqrt(Ix*Ix+Iy*Iy).

To not return this information, set this parameter to M_NULL. In this case, you cannot set Dst2ImageBufId to M_NULL.

(summarize)
Click to summarize Dst2ImageBufId

Specifies the identifier of a float or unsigned image buffer in which to write the results of the gradient orientation.

For an unsigned destination buffer, the angle is returned from 0° to 360° (counter-clockwise) and mapped to the entire range of the destination buffer. For example, for an 8-bit unsigned buffer, the angles of 0°, 90°, 180°, and 270° map to 0, 64, 128, and 192, respectively. For a signed destination buffer, mapping is done in both the positive and negative range of the buffer and represents angle values from -180° to 180°. For example, for an 8-bit signed buffer, the angles of -180°, -90°, 0°, and 90° map to -128, -64, 0 and 64, respectively.

For a floating-point buffer, the results are not mapped and are returned in the range of 0° to 360°.

To not return this information, set this parameter to M_NULL. In this case, you cannot set Dst1ImageBufId to M_NULL.

(summarize)
Click to summarize M_GRADIENT_SQR

Performs a square gradient operation.

(summarize)
Click to summarize Image buffer ID

Specifies the identifier of a float or signed image buffer, indicating the first derivative in X.

(summarize)
Click to summarize SrcOrDrv2ImageBufId

Specifies the identifier of a float or signed image buffer, indicating the first derivative in Y.

(summarize)
Click to summarize Dst1ImageBufId

Specifies the identifier of a float or unsigned image buffer in which to write the results of the square gradient magnitude; that is: Ix*Ix+Iy*Iy .

To not return this information, set this parameter to M_NULL. In this case, you cannot set Dst2ImageBufId to M_NULL.

(summarize)
Click to summarize Dst2ImageBufId

Specifies the identifier of a float or unsigned image buffer in which to write the results of the square gradient orientation.

For an unsigned destination buffer, the angle is returned from 0° to 360° (counter-clockwise) and mapped to the entire range of the destination buffer. For example, for an 8-bit unsigned buffer, the angles of 0°, 90°, 180°, and 270° map to 0, 64, 128, and 192, respectively. For a signed destination buffer, mapping is done in both the positive and negative range of the buffer and represents angle values from -180° to 180°. For example, for an 8-bit signed buffer, the angles of -180°, -90°, 0°, and 90° map to -128, -64, 0 and 64, respectively.

For a floating-point buffer, the results are not mapped and are returned in the range of 0° to 360°.

To not return this information, set this parameter to M_NULL. In this case, you cannot set Dst1ImageBufId to M_NULL.

(summarize)
Click to summarize Linear IIR filter context ID

Specifies the identifier of a linear IIR filter context (M_LINEAR_FILTER_IIR_CONTEXT).

(summarize)
Click to summarize SrcOrDrv2ImageBufId

Specifies the identifier of an image buffer (of any type) from which to extract the derivatives.

(summarize)
Click to summarize Dst1ImageBufId

Specifies the identifier of a float or unsigned image buffer in which to write the results of the square gradient magnitude; that is: Ix*Ix+Iy*Iy .

To not return this information, set this parameter to M_NULL. In this case, you cannot set Dst2ImageBufId to M_NULL.

(summarize)
Click to summarize Dst2ImageBufId

Specifies the identifier of a float or unsigned image buffer in which to write the results of the square gradient orientation.

For an unsigned destination buffer, the angle is returned from 0° to 360° (counter-clockwise) and mapped to the entire range of the destination buffer. For example, for an 8-bit unsigned buffer, the angles of 0°, 90°, 180°, and 270° map to 0, 64, 128, and 192, respectively. For a signed destination buffer, mapping is done in both the positive and negative range of the buffer and represents angle values from -180° to 180°. For example, for an 8-bit signed buffer, the angles of -180°, -90°, 0°, and 90° map to -128, -64, 0 and 64, respectively.

For a floating-point buffer, the results are not mapped and are returned in the range of 0° to 360°.

To not return this information, set this parameter to M_NULL. In this case, you cannot set Dst1ImageBufId to M_NULL.

(summarize)
Click to summarize M_LAPLACIAN

Performs a Laplacian operation.

(summarize)
Click to summarize Image buffer ID

Specifies the identifier of a float or signed image buffer, indicating the second derivative in X.

(summarize)
Click to summarize SrcOrDrv2ImageBufId

Specifies the identifier of a float or signed image buffer, indicating the second derivative in Y.

(summarize)
Click to summarize Dst1ImageBufId

Specifies the identifier of a float or signed image buffer in which to write the results of the Laplacian operation; that is: Ixx+Iyy .

(summarize)
Click to summarize Linear IIR filter context ID

Specifies the identifier of a linear IIR filter context (M_LINEAR_FILTER_IIR_CONTEXT).

(summarize)
Click to summarize SrcOrDrv2ImageBufId

Specifies the identifier of an image buffer (of any type) from which to extract the derivatives.

(summarize)
Click to summarize Dst1ImageBufId

Specifies the identifier of a float or signed image buffer in which to write the results of the Laplacian operation; that is: Ixx+Iyy .

(summarize)
Click to summarize M_SHARPEN

Performs a sharpening operation.

(summarize)
Click to summarize Image buffer ID

Specifies the identifier of a float or signed image buffer, indicating the second derivative in X.

(summarize)
Click to summarize SrcOrDrv2ImageBufId

Specifies the identifier of a float or signed image buffer, indicating the second derivative in Y.

(summarize)
Click to summarize SrcOrDrv3ImageBufId

Specifies the identifier of an image buffer (of any type) that stores the image to sharpen.

(summarize)
Click to summarize Dst1ImageBufId

Specifies the identifier of an image buffer (of any type) in which to write the results of the sharpening operation; that is: Is- alpha*(Ixx*Iyy).

If you use an unsigned image buffer, the sharpening operation performs a saturation.

(summarize)
Click to summarize Param

Specifies the amount of sharpening.

(summarize)
Click to summarize Value > 0.0

Specifies the sharpening value.

Click to summarize Linear IIR filter context ID

Specifies the identifier of a linear IIR filter context (M_LINEAR_FILTER_IIR_CONTEXT).

(summarize)
Click to summarize SrcOrDrv2ImageBufId

Specifies the identifier of an image buffer (of any type) from which to extract the derivatives.

(summarize)
Click to summarize Dst1ImageBufId

Specifies the identifier of an image buffer (of any type) in which to write the results of the sharpening operation; that is: Is-alpha*(Ixx*Iyy).

If you use an unsigned image buffer, the sharpening operation performs a saturation.

(summarize)
Click to summarize Param

Specifies the amount of sharpening.

(summarize)
Click to summarize M_DEFAULT

Specifies that MIL will establish an appropriate sharpening value.

Click to summarize Value > 0.0

Specifies the sharpening value.

Click to summarize ControlFlag

Specifies whether to perform the sharpening operation, or to explicitly preprocess the linear IIR filter context.

(summarize)
Click to summarize M_DEFAULT

Specifies to perform the sharpening operation.

Click to summarize M_PREPROCESS

Specifies to preprocesses the linear IIR filter context explicitly. Note, if not called explicitly, MIL performs this operation automatically upon the first call to MimDifferential().

(summarize)
Compilation information
Header Include mil.h.
Library Use mil.lib; milim.lib.
DLL Requires mil.dll; milim.dll.
GRADIENT NONE PROC FLOAT SIGNED NONE PROC FLOAT SIGNED NULL NONE PROC FLOAT UNSIGNED NULL NONE PROC FLOAT UNSIGNED NONE PROC NULL NONE PROC FLOAT UNSIGNED NULL NONE PROC FLOAT UNSIGNED GRADIENT SQR NONE PROC FLOAT SIGNED NONE PROC FLOAT SIGNED NULL NONE PROC FLOAT UNSIGNED NULL NONE PROC FLOAT UNSIGNED NONE PROC NULL NONE PROC FLOAT UNSIGNED NULL NONE PROC FLOAT UNSIGNED LAPLACIAN NONE PROC FLOAT SIGNED NONE PROC FLOAT SIGNED NONE PROC FLOAT SIGNED NONE PROC NONE PROC FLOAT SIGNED SHARPEN NONE PROC FLOAT SIGNED NONE PROC FLOAT SIGNED NONE PROC NONE PROC NONE PROC NONE PROC DEFAULT DEFAULT PREPROCESS