MmeasFindMarker()函数

Synopsis

Find a marker in an image and take its measurements.

Format

void MmeasFindMarker(ContextId, ImageBufId, MarkerId, MeasurementList)

MIL_ID ContextId; Measurement context identifier
MIL_ID ImageBufId; Image buffer identifier
MIL_ID MarkerId; Marker identifier
long MeasurementList; List of measurements to take

Description

This function finds an edge or a stripe marker in the image and takes the measurements specified in the measurement list. The marker’s parameter settings are used to help locate the marker and can be set, using MmeasSetMarker.

The parameter settings of the specified measurement context control the behavior of this function and can be set, using MmeasControl.

Results are stored with the marker and can be obtained, using MmeasGetResult.

The ContextId parameter specifies the identifier of the measurement context. This parameter must be given a valid measurement context identifier or can be set to M_DEFAULT, in which case, the default measurement context of the current MIL application will be used.

The ImageBufId parameter specifies the identifier of the image buffer in which the marker is located.

The MarkerId parameter specifies the identifier of the marker to be located in the image.

The MeasurementList parameter specifies which measurement(s) to perform. To take more than one measurement, add the predefined values together (for example, M_POSITION+M_ANGLE). Use M_DEFAULT to select all of the measurements.

The measurement list can contain the following values:

Value Description
M_DEFAULT Take all of the measurements below.
For edge and stripe markers:
M_POSITION Determine the X and Y coordinates of the center of the marker within the target image, relative to the top-left pixel in the image.
M_POSITION_VARIATION Determine the position variation (or uncertainty) of the marker, in pixels. If the marker is an edge, the position variation is equal to half of its width. If the marker is a stripe, the position variation is the sum of the position variations of both of its edges.
M_ANGLE Determine the angle of the marker in relation to the positive X-axis of the target image. The value can be any between 0° and 360°.
M_WIDTH Determine the width of a marker in pixels. The width of an edge marker is a measure (in pixels) of the transition in grayscale values. The width of a stripe marker is the average distance between its edges and is calculated at the angle of the marker measurement box.
M_WIDTH_VARIATION Determine the width variation (or uncertainty) of a stripe marker, in pixels. It is the sum of the position variations of both of its edges.
M_POLARITY Determine whether the edge (or edges of a stripe marker) are rising (positive polarity) or falling (negative polarity).
M_CONTRAST Determine the average grayscale difference between an edge and its background. For a stripe marker, this produces two values, one for each of the stripe marker’s edges.
M_LENGTH Determine the length of the marker in pixels. The length is limited to the dimensions of the marker measurement box.
M_LINE_EQUATION Determine the equation of the mean line following an edge. When performing this calculation for a stripe marker, three line equations are calculated: the line equation of the stripe’s first edge, the line equation of the stripe’s second edge, and the mean of the line equations of both its edges.
M_EDGE_INSIDE Determine the number of edges located between the two exterior edges of a stripe marker.

Note: The following values cannot be requested specifically. However, by specifying M_POSITION in the measurement list, all of the following will be also be accessible through MmeasGetResult.

M_ORIENTATION Determine the orientation of the marker.
M_POSITION_MIN Determine the X and Y coordinates of the minimum position of an edge or stripe marker within the target image, relative to the top-left pixel in the image. For example, this would be the start of the edge variation of an edge marker relative to the direction of the region of interest.
M_POSITION_MAX Determine the X and Y coordinates of the maximum position of an edge or stripe marker within the target image, relative to the top-left pixel in the image. For example, this would be the end of the edge variation of an edge marker relative to the direction of the region of interest.
M_EDGE_STRENGTH Determine the maximum pixel value variation of the edge marker. The value is represented as a percentage of the image buffer’s maximum possible value.
M_BOX_EDGES_STRENGTH Determine the maximum pixel value variation of each possible or actual edge marker found across the location box. Therefore, for a vertical marker, the number of returned values is equal to the width of the location box; for a horizontal marker, the number is equal to the height. The value is represented as a percentage of the image buffer’s maximum possible value.

See also

MmeasGetResult, MmeasSetMarker