| MIL 10 Reference
| Customize Help
| Save Settings

MimEdgeDetect



See also
Availability
Not available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Partially supported on:
Partially supported on Matrox GPU processing driver

Fully supported on:
Fully supported on Host system
Fully supported on Matrox CronosPlus
Fully supported on Matrox GigE Vision driver
Fully supported on Matrox IEEE 1394 IIDC driver
Fully supported on Matrox Iris GT
Fully supported on Matrox Morphis
Fully supported on Matrox Morphis QxT
Fully supported on Matrox Orion HD
Fully supported on Matrox Radient eCL
Fully supported on Matrox Radient eV-CXP
Fully supported on Matrox Solios eA/XA
Fully supported on Matrox Solios ecl/xcl/ev-cl
Fully supported on Matrox USB3 Vision driver (requires Update 19)
Fully supported on Matrox Vio

For any information regarding a MIL system added during a MIL Update, see the MIL system’s release note

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
Synopsis
Perform a specific edge detection operation and produce a gradient intensity and/or gradient angle image.
Syntax
void MimEdgeDetect(
MIL_ID SrcImageBufId, //in
MIL_ID DstIntensityImageBufId, //in
MIL_ID DstAngleImageBufId, //in
MIL_ID KernelId, //in
MIL_INT64 ControlFlag, //in
MIL_INT Threshold //in
)
Description

This function performs an edge detection operation on the specified source image, using the specified filter. It produces a gradient intensity image and/or a gradient angle image in the specified image buffer(s). If one of the destination images is not required, specify M_NULL as its image buffer identifier.

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.

This function can also be performed on a floating-point buffer. However, the results are not mapped and are returned in the range of 0° to 360°. The degree of precision is equal to the precision of the floating-point buffer for regular computation or to +/- 0.4° for fast computation. The value for undefined results is the maximum positive value of the floating-point buffer.

For a gradient value lower than the threshold value, the angle is not computed (not considered a significant edge) and the resulting angle pixel is undetermined.

You can perform the operation using a combination of fast and full gradient and angle computations.

Type of computation

Description of computation

Full gradient computation

Gradient = sqrt(GradientX*GradientX + GradientY*GradientY)

Fast gradient computation

Gradient = ( abs(GradientX) + abs(GradientY))/2

Full angle computation

Angle = arctan(GradientY/GradientX)

The fast angle approximation is based on the same equation as the full angle computation, however the value is determined from a LUT mapping. Note that the fast angle approximation introduces a maximum error of +/- 0.4°.

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 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.

[Matrox GPU processing driver]

The source image buffer must be unsigned monochrome 8- or 16-bit.

DstIntensityImageBufId

Specifies the identifier of the destination buffer for the resulting gradient intensity image. This parameter must be given an image buffer identifier or M_NULL. Saturation is performed on this buffer.

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.

[Matrox GPU processing driver]

The destination image buffer must be unsigned monochrome 8- or 16-bit.

DstAngleImageBufId

Specifies the identifier of the destination buffer for the resulting gradient angle image. This parameter must be given an image buffer identifier or M_NULL.

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 this parameter cannot be set to M_NULL if DstIntensityImageBufId is also set to M_NULL, otherwise an error will occur.

KernelId

Specifies the filter to use. This parameter must be set to the value below.

function map For specifying the filter to use
CollapseValue Description
Collapse M_SOBEL +

Sets the parameter to the predefined 3x3 edge detection filter. This filter is as follows:

(summarize)
Combination constant for the values listed in For specifying the filter to use.

You can add the following value to the above-mentioned value to specify that overscan processing is disabled.

function map For M_SOBEL
CollapseCombination value Description
Collapse M_OVERSCAN_DISABLE

Disables overscan processing.

ControlFlag

Specifies how to perform the operations.

This parameter can be set to one of the following:

function map For specifying how to perform the operation
CollapseValue Description
Collapse M_DEFAULT

Same as M_FAST_EDGE_DETECT.

Collapse M_FAST_ANGLE + M_REGULAR_GRADIENT

Specifies a full gradient computation and a fast angle approximation.

Collapse M_FAST_EDGE_DETECT

Specifies a fast gradient computation and a fast angle approximation. The gradient is computed as an approximation, using the average of the absolute value of the two directional components (X and Y).

(summarize)
Collapse M_REGULAR_ANGLE + M_FAST_GRADIENT

Specifies a fast gradient computation and a full angle computation.

Collapse M_REGULAR_EDGE_DETECT

Specifies a full gradient computation and a full angle computation. The gradient is computed as the square root of the sum of the square of each directional component (X and Y). This calculation is slower but more precise.

(summarize)
Threshold

Specifies the threshold value for calculating gradient intensity. To perform the full operation, set this parameter to zero or M_NULL.

Compilation information
Header Include mil.h.
Library Use mil.lib; milim.lib.
DLL Requires mil.dll; milim.dll.
PROC NONE PROC NONE PROC NONE SOBEL OVERSCAN DISABLE DEFAULT FAST ANGLE M REGULAR GRADIENT FAST EDGE DETECT REGULAR ANGLE M FAST GRADIENT REGULAR EDGE DETECT