| MIL 10 Reference
| Customize Help
| Save Settings

MedgeSelect



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

Available on Windows
Available on Linux

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
Select edges for calculations and result retrieval.
Syntax
void MedgeSelect(
MIL_ID EdgeResultId, //in
MIL_INT64 Operation, //in
MIL_INT64 SelectionCriterion, //in
MIL_INT64 Condition, //in
MIL_DOUBLE Param1, //in
MIL_DOUBLE Param2 //in
)
Description

This function selects edges that meet a specified criterion. These edges will be included in or excluded from future operations (calculations and result retrieval), or deleted entirely from the Edge Finder result buffer. To call this function, MedgeCalculate() must have been called at least once.

If this function is not called at least once, all edges are included by default. If there is more than one call to this function, the effect of the calls is cumulative, unless M_INCLUDE_ONLY or M_EXCLUDE_ONLY is specified as the operation to perform.

Once an edge has been excluded, it can typically be re-included by specifying M_INCLUDE or M_INCLUDE_ONLY in a future call to this function (with the correct criterion). However, if you use the result buffer with different images (in a call to MedgeCalculate()), all results in the result buffer are discarded and all new edges are re-included.

Unlike most other MIL functions, if the edges were extracted from a calibrated source image, you must specify relevant values in world units, although you will have control over the units when retrieving results using MedgeGetResult().

You can use this function to select edges based on one of the following:

  • A calculated edge feature (see MedgeControl()), where the edge selection depends on whether the specified edge feature meets the specified condition.

  • The inter-relationship of edges, where the edge selection depends on whether edges meet the specified box or chain condition of the specified edge or group of edges.

  • The current status of edges, where the edge selection depends on a specific edge, all edges, all included edges, or all excluded edges. These will be included, included only, excluded, excluded only, or deleted. For example, you can include only (M_INCLUDE_ONLY) the excluded edges (M_EXCLUDED_EDGES), which will essentially swap the previously included and excluded edges.

  • The proximity of an edge or edges to a specified point, where the edge selection depends on the specified radius, and the nearest neighbor condition.

You can also use this function to crop and select a portion of a specified edge.

For more information on the different uses of this function, see the Calculating and retrieving results section of Chapter 8: Edge Finder and the Advanced edge extraction section of Chapter 8: Edge Finder.

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 if there is complementary information.
Parameters
This function is not supported on the selected boards.
Parameters
EdgeResultId

Specifies the identifier of the Edge Finder result buffer to be used in the edge selection process.

Operation

Specifies the operation to perform on the specified edges. Set this parameter to one of the following values.

function map For specifying the operation
CollapseValue Description
Collapse M_DELETE

Deletes edges that meet the specified condition. M_DELETE affects only included edges, unless otherwise stated by the SelectionCriterion parameter.

M_DELETE removes edges permanently from the Edge Finder result buffer and, consequently, prevents these edges from being re-included.

(summarize)
Collapse M_EXCLUDE

Excludes all edges that meet the specified condition.

M_EXCLUDE affects only the status of currently included edges.

(summarize)
Collapse M_EXCLUDE_ONLY

Excludes only those edges that meet the specified condition and includes all others.

The exclusion does not consider the present status of edges (whether they are excluded), except for edges that have been deleted (M_DELETE), unless otherwise stated by the SelectionCriterion parameter.

(summarize)
Collapse M_INCLUDE

Includes all edges that meet the specified condition.

M_INCLUDE affects only the status of currently excluded edges.

(summarize)
Collapse M_INCLUDE_ONLY

Includes only those edges that meet the specified condition and excludes all others.

The inclusion does not consider the present status of edges (whether they are included), except for edges that have been deleted (M_DELETE), unless otherwise stated by the SelectionCriterion parameter.

(summarize)
SelectionCriterion

Specifies on what the selection criterion will be based. Note that for certain selection criteria, this parameter can be set to M_NULL.

To specify an edge selection based on edge features, the SelectionCriterion parameter must be set to one of the values below. The specified feature will be used as part of the selection criterion. Note that the specified Edge Finder result buffer must already contain the results for the specified feature (for more information on each edge feature, see MedgeControl()).

function map For specifying the selection criterion
CollapseValue Description
Collapse M_AVERAGE_STRENGTH

Uses the average strength.

Collapse M_BOX_X_MAX

Uses the extreme right edgel coordinate.

Collapse M_BOX_X_MIN

Uses the extreme left edgel coordinate.

Collapse M_BOX_Y_MAX

Uses the extreme bottom edgel coordinate.

Collapse M_BOX_Y_MIN

Uses the extreme top edgel coordinate.

Collapse M_CENTER_OF_GRAVITY_X

Uses the center of gravity's X-position.

Collapse M_CENTER_OF_GRAVITY_Y

Uses the center of gravity's Y-position.

Collapse M_CIRCLE_FIT_CENTER_X

Uses the X-coordinate of the center of the circle that is the best fit for each edge.

Collapse M_CIRCLE_FIT_CENTER_Y

Uses the Y-coordinate of the center of the circle that is the best fit for each edge.

Collapse M_CIRCLE_FIT_COVERAGE

Uses the coverage of the circle that is the best fit for each edge.

Collapse M_CIRCLE_FIT_ERROR

Uses the fit error of the circle that is the best fit for each edge.

Collapse M_CIRCLE_FIT_RADIUS

Uses the radius of the circle that is the best fit for each edge.

Collapse M_CLOSURE

Uses the closure state.

Collapse M_CONVEX_PERIMETER

Uses the convex elongation.

Collapse M_ELLIPSE_FIT_ANGLE

Uses the angle between the major axis of the ellipse and the X-axis.

Collapse M_ELLIPSE_FIT_CENTER_X

Uses the X-coordinate of the center of the ellipse that is the best fit for each edge.

Collapse M_ELLIPSE_FIT_CENTER_Y

Uses the Y-coordinate of the center of the ellipse that is the best fit for each edge.

Collapse M_ELLIPSE_FIT_COVERAGE

Uses the coverage of the ellipse that is the best fit for each edge.

Collapse M_ELLIPSE_FIT_ERROR

Uses the fit error of the ellipse that is the best fit for each edge.

Collapse M_ELLIPSE_FIT_MAJOR_AXIS

Uses the major axis of the ellipse that is the best fit for each edge.

Collapse M_ELLIPSE_FIT_MINOR_AXIS

Uses the minor axis of the ellipse that is the best fit for each edge.

Collapse M_FAST_LENGTH

Uses the quickly calculated length.

Collapse M_FERET_ELONGATION

Uses the Feret elongation.

Collapse M_FERET_MAX_ANGLE

Uses the maximum Feret angle.

Collapse M_FERET_MAX_DIAMETER

Uses the maximum Feret diameter.

Collapse M_FERET_MEAN_DIAMETER

Uses the average Feret diameter at all the angles checked (see M_NUMBER_OF_FERETS in MedgeControl()).

Collapse M_FERET_MIN_ANGLE

Uses the minimum Feret angle.

Collapse M_FERET_MIN_DIAMETER

Uses the minimum Feret diameter.

Collapse M_FERET_X

Uses the X-Feret value.

Collapse M_FERET_Y

Uses the Y-Feret value.

Collapse M_FIRST_POINT_X

Uses the first point's X-coordinate.

Collapse M_FIRST_POINT_Y

Uses the first point's Y-coordinate.

Collapse M_GENERAL_FERET

Uses the general Feret.

Collapse M_LABEL_VALUE

Uses the label value.

Collapse M_LENGTH

Uses the length.

Collapse M_LINE_FIT_A

Uses the A variable of the line that is the best fit for each edge.

Collapse M_LINE_FIT_B

Uses the B variable of the line that is the best fit for each edge.

Collapse M_LINE_FIT_C

Uses the C variable of the line that is the best fit for each edge.

Collapse M_LINE_FIT_ERROR

Uses the fit error of the line that is the best fit for each edge.

Collapse M_MOMENT_ELONGATION

Uses the moment elongation.

Collapse M_POSITION_X

Uses the X-position.

Collapse M_POSITION_Y

Uses the Y-position.

Collapse M_SIZE

Uses the number of edgels.

Collapse M_STRENGTH

Uses the strength.

Collapse M_TORTUOSITY

Uses the tortuosity measure.

Collapse M_X_MAX_AT_Y_MAX

Uses the maximum X-coordinate at the maximum Y-coordinate.

Collapse M_X_MIN_AT_Y_MIN

Uses the minimum X-coordinate at the minimum Y-coordinate.

Collapse M_Y_MAX_AT_X_MIN

Uses the maximum Y-coordinate at the minimum X-coordinate.

Collapse M_Y_MIN_AT_X_MAX

Uses the minimum Y-coordinate at the maximum X-coordinate.

To specify an edge selection based on the inter-relationship of edges, you must set the SelectionCriterion parameter to either a specific edge, or to a group of edges. In this case, the SelectionCriterion parameter defines the subset of edges to look inside (M_INSIDE_...) or outside (M_OUTSIDE...); that is, the edges to operate on are those relative to the edge(s) specified by the SelectionCriterion parameter. Note that some Operation and SelectionCriterion parameter values, when used together, do not have any effect, such as excluding (M_EXCLUDE) all the excluded edges (M_EXCLUDED_EDGES).

To specify the edge(s), set SelectionCriterion to one of the following values:

function map For specifying the edge(s)
CollapseValue Description
Collapse M_ALL_EDGES

Specifies all edges regardless of their present status, except for edges that have been deleted.

Collapse M_EXCLUDED_EDGES

Specifies all currently excluded edges, except for edges that have been deleted.

Collapse M_INCLUDED_EDGES

Specifies all currently included edges, except for edges that have been deleted.

Collapse M_SPECIFIC_EDGE

Specifies a specific edge. Use Param1 to set the label value of the edge.

(summarize)

To specify an edge selection based on the current status of edges, the SelectionCriterion parameter must specify the edge or the status of the edges on which to operate. Note that in this case, the SelectionCriterion parameter should be set to one of the same values as an edge selection based on the inter-relationship of edges (see above).

To specify an edge selection based on the proximity of the edges to a point, the SelectionCriterion parameter must be set to M_NULL.

To crop and select a portion of a specified edge, the SelectionCriterion parameter must be set to the following value:

function map For cropping and selecting a portion of a specified edge
CollapseValue Description
Collapse M_CROP_CHAIN

Specifies a chain cropping. This is done by specifying the chain to crop (Param1), the side of the chain to crop (Condition), and the edgel index position where you want the chain to be cropped (Param2). The newly created edge receives a new label and can be excluded, included, or deleted from the result buffer. The excluded part of the edge keeps its label value.

(summarize)
Condition

Specifies the condition for the edge selection. Note that for certain selection criteria, this parameter can be set to M_NULL.

To specify an edge selection based on edge features, the Condition parameter must either be set to a condition that uses one limit, or a condition that uses two limits.

To crop and select a portion of a specified edge, the Condition parameter must be set to a condition that uses one limit.

For conditions that use one limit, set the Condition parameter to one of the values below. Note that, unless otherwise specified, these values are valid for both feature-based and crop-based edge selections.

function map For conditions that use one limit
CollapseValue Description
Collapse M_EQUAL

Specifies that edges with values for the specified feature equal to Param1 are included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

This value is not valid for crop-based edge selections.

(summarize)
Collapse M_GREATER

Specifies that edges with values for the specified feature greater than the specified limit value are included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

For feature-based edge selections, the limit value is set with Param1. For crop-based edge selections, the limit value is set with Param2.

(summarize)
Collapse M_GREATER_OR_EQUAL

Specifies that edges with values for the specified feature greater than or equal to the specified limit value are included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

For feature-based edge selections, the limit value is set with Param1. For crop-based edge selections, the limit value is set with Param2.

(summarize)
Collapse M_LESS

Specifies that edges with values for the specified feature less than the specified limit value are included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

For feature-based edge selections, the limit value is set with Param1. For crop-based edge selections, the limit value is set with Param2.

(summarize)
Collapse M_LESS_OR_EQUAL

Specifies that edges with values for the specified feature less than or equal to the specified limit value are included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

For feature-based edge selections, the limit value is set with Param1. For crop-based edge selections, the limit value is set with Param2.

(summarize)
Collapse M_NOT_EQUAL

Specifies that edges with values for the specified feature not equal to Param1 are included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

This value is not valid for crop-based edge selections.

(summarize)

For conditions that use two limits, set the Condition parameter to one of the values below. Note that these values are only valid for feature-based edge selections.

function map For conditions that use two limits
CollapseValue Description
Collapse M_IN_RANGE

Specifies that edges with values for the specified feature in the range Param1 to Param2, inclusive, are included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

Collapse M_OUT_RANGE

Specifies that edges with values for the specified feature less than Param1, or greater than Param2, are included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

To specify an edge selection based on the inter-relationship of edges, set the Condition parameter to one of the following box or chain values:

function map For specifying an edge selection based on the inter-relationship of edges
CollapseValue Description
Collapse M_INSIDE_BOX

Specifies that edges inside the bounding box of the specified edge, or inside the bounding box of the edges of the specified group, are included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

Collapse M_INSIDE_CHAIN

Specifies that edges inside the specified edge, or inside edges of the specified group, are included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

Note that if an edge is not closed, this value has no effect. For more information, see M_CLOSURE in MedgeControl(). Also, if an edge is not completely included by closed edge, it is considered as an outside or equal edge.

(summarize)
Collapse M_INSIDE_OR_EQUAL_BOX

Specifies that edges inside or equal to the bounding box of the specified edge, or inside or equal to the bounding box of the edges of the specified group, are included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

Collapse M_INSIDE_OR_EQUAL_CHAIN

Specifies that edges inside or equal to the specified edge, or inside or equal to the edges of the specified group, are included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

Note that if an edge is not closed, this value has no effect. For more information, see M_CLOSURE in MedgeControl(). Also, if an edge is not completely included by closed edge, it is considered as an outside or equal edge.

(summarize)
Collapse M_OUTSIDE_BOX

Specifies that edges outside the bounding box of the specified edge, or outside the bounding box of the edges of the specified group, are included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

Collapse M_OUTSIDE_CHAIN

Specifies that edges outside the specified edge, or outside edges of the specified group, are included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

Note that if an edge is not closed, this value has no effect. For more information, see M_CLOSURE in MedgeControl(). Also, if an edge is not completely included by closed edge, it is considered as an outside or equal edge.

(summarize)
Collapse M_OUTSIDE_OR_EQUAL_BOX

Specifies that edges outside or equal to the bounding box of the specified edge, or outside or equal to the bounding box of the edges of the specified group, are included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

Collapse M_OUTSIDE_OR_EQUAL_CHAIN

Specifies that edges outside or equal to the specified edge, or outside or equal to edges of the specified group, are included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

To specify an edge selection based on the current status of edges, set Condition to M_NULL.

To specify an edge selection based on the proximity of the edges to a point, set the Condition parameter to one of the following neighbor values:

function map For specifying an edge selection based on the current status of edges
CollapseValue Description
Collapse M_ALL_NEAREST_NEIGHBORS

Specifies that the closest edges within the specified radius and location is included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

Define the radius using MedgeControl() with M_NEAREST_NEIGHBOR_RADIUS.

(summarize)
Collapse M_NEAREST_NEIGHBOR

Specifies that the closest edge within the specified radius and location is included, excluded, or deleted from future operations on the specified Edge Finder result buffer.

Define the radius using MedgeControl() with M_NEAREST_NEIGHBOR_RADIUS.

(summarize)
Param1

Specifies a value that is dependent on the feature and condition chosen. If the edges have been calculated using a calibrated source image, you must specify the relevant values in the real world.

To specify an edge selection based on edge features, where the condition uses one limit, set Param1 to the required condition limit. To specify an edge selection based on edge features, where the condition uses two limits, set Param1 to the low condition limit.

To specify an edge selection based on the inter-relationship of edges, where SelectionCriterion is set to a specific edge (M_SPECIFIC_EDGE), set Param1 to the label value of the edge. To specify an edge selection based on the inter-relationship of edges, where SelectionCriterion is set to a group of edges (M_ALL_EDGES, M_EXCLUDED_EDGES, M_INCLUDED_EDGES), set Param1 to M_NULL.

To specify an edge selection based on the current status of edges, set Param1 to M_NULL.

To specify an edge selection based on the proximity of the edges to a point, set Param1 to the X-coordinate of this point.

To crop and select a portion of a specified edge (M_CROP_CHAIN), set Param1 to the label value of the edge to crop.

Param2

Specifies a value that is dependent on the feature and condition chosen. If the edges have been calculated using a calibrated source image, you must specify the relevant values in the real world.

To specify an edge selection based on edge features, where the condition uses one limit, set Param2 to M_NULL. To specify an edge selection based on edge features, where the condition uses two limits, set Param2 to the high condition limit.

To specify an edge selection based on the inter-relationship of edges, where SelectionCriterion is either set to a specific edge (M_SPECIFIC_EDGE), or to a group of edges (M_ALL_EDGES, M_EXCLUDED_EDGES, M_INCLUDED_EDGES), set Param2 to M_NULL.

To specify an edge selection based on the current status of edges, set Param2 to M_NULL.

To specify an edge selection based on the proximity of the edges to a point, set Param2 to the Y-coordinate of this point.

To crop and select a portion of a specified edge (M_CROP_CHAIN), set Param2 to the edgel index where to split the edge.

Compilation information
Header Include mil.h.
Library Use mil.lib; miledge.lib.
DLL Requires mil.dll; miledge.dll.
DELETE EXCLUDE EXCLUDE ONLY INCLUDE INCLUDE ONLY AVERAGE STRENGTH BOX X MAX BOX X MIN BOX Y MAX BOX Y MIN CENTER OF GRAVITY X CENTER OF GRAVITY Y CIRCLE FIT CENTER X CIRCLE FIT CENTER Y CIRCLE FIT COVERAGE CIRCLE FIT ERROR CIRCLE FIT RADIUS CLOSURE CONVEX PERIMETER ELLIPSE FIT ANGLE ELLIPSE FIT CENTER X ELLIPSE FIT CENTER Y ELLIPSE FIT COVERAGE ELLIPSE FIT ERROR ELLIPSE FIT MAJOR AXIS ELLIPSE FIT MINOR AXIS FAST LENGTH FERET ELONGATION FERET MAX ANGLE FERET MAX DIAMETER FERET MEAN DIAMETER FERET MIN ANGLE FERET MIN DIAMETER FERET X FERET Y FIRST POINT X FIRST POINT Y GENERAL FERET LABEL VALUE LENGTH LINE FIT A LINE FIT B LINE FIT C LINE FIT ERROR MOMENT ELONGATION POSITION X POSITION Y SIZE STRENGTH TORTUOSITY X MAX AT Y MAX X MIN AT Y MIN Y MAX AT X MIN Y MIN AT X MAX ALL EDGES EXCLUDED EDGES INCLUDED EDGES SPECIFIC EDGE CROP CHAIN EQUAL GREATER GREATER OR EQUAL LESS LESS OR EQUAL NOT EQUAL IN RANGE OUT RANGE INSIDE BOX INSIDE CHAIN INSIDE OR EQUAL BOX INSIDE OR EQUAL CHAIN OUTSIDE BOX OUTSIDE CHAIN OUTSIDE OR EQUAL BOX OUTSIDE OR EQUAL CHAIN ALL NEAREST NEIGHBORS NEAREST NEIGHBOR