measure_pairs ( Image : : MeasureHandle, Sigma, Threshold, Transition, Select : RowEdgeFirst, ColumnEdgeFirst, AmplitudeFirst, RowEdgeSecond, ColumnEdgeSecond, AmplitudeSecond, IntraDistance, InterDistance )

Extract straight edge pairs perpendicular to a rectangle or annular arc.

measure_pairs serves to extract straight edge pairs which lie perpendicular to the major axis of a rectangle or annular arc.

The extraction algorithm is identical to measure_pos. In addition the edges are grouped to pairs: If Transition = 'positive', the edge points with a dark-to-light transition in the direction of the major axis of the rectangle are returned in RowEdgeFirst and ColumnEdgeFirst. In this case, the corresponding edges with a light-to-dark transition are returned in RowEdgeSecond and ColumnEdgeSecond. If Transition = 'negative', the behavior is exactly opposite. If Transition = 'all', the first detected edge defines the transition for RowEdgeFirst and ColumnEdgeFirst. If more than one consecutive edge with the same transition is found, the first one is used as a pair element. This behavior may cause problems in applications in which the threshold Threshold cannot be selected high enough to suppress consecutive edges of the same transition. For these applications, a second pairing mode exists that only selects the respective strongest edges of a sequence of consecutive rising and falling edges. This mode is selected by appending '_strongest' to any of the above modes for Transition, e.g., 'negative_strongest'. Finally, it is possible to select which edge pairs are returned. If Select is set to 'all', all edge pairs are returned. If it is set to 'first', only the first of the extracted edge pairs is returned, while it is set to 'last', only the last one is returned.

The extracted edges are returned as single points which lie on the major axis of the rectangle. The corresponding edge amplitudes are returned in AmplitudeFirst and AmplitudeSecond. In addition, the distance between each edge pair is returned in IntraDistance and the distance between consecutive edge pairs is returned in InterDistance. Here, IntraDistance[i] corresponds to the distance between EdgeFirst[i] and EdgeSecond[i], while InterDistance[i] corresponds to the distance between EdgeSecond[i] and EdgeFirst[i+1], i.e., the tuple InterDistance contains one element less than the tuples of the edge pairs.


Attention

measure_pairs only returns meaningful results if the assumptions that the edges are straight and perpendicular to the major axis of the rectangle are fulfilled. Thus, it should not be used to extract edges from curved objects, for example. Furthermore, the user should ensure that the rectangle is as close to perpendicular as possible to the edges in the image.

It should be kept in mind that measure_pairs ignores the domain of Image for efficiency reasons. If certain regions in the image should be excluded from the measurement a new measure object with appropriately modified parameters should be generated.


Parameters

Image (input_object)
singlechannelimage -> object : byte / uint2
Input image.

MeasureHandle (input_control)
measure_id -> integer
Measure object handle.

Sigma (input_control)
number -> real
Sigma of gaussian smoothing.
Default value: 1.0
Suggested values: 0.4, 0.6, 0.8, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 7.0, 10.0
Typical range of values: 0.4 <= Sigma <= 100 (lin)
Minimum increment: 0.01
Recommended increment: 0.1
Restriction: Sigma >= 0.4

Threshold (input_control)
number -> real
Minimum edge amplitude.
Default value: 30.0
Suggested values: 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 90.0, 110.0
Typical range of values: 1 <= Threshold <= 255 (lin)
Minimum increment: 0.5
Recommended increment: 2

Transition (input_control)
string -> string
Type of gray value transition that determines how edges are grouped to edge pairs.
Default value: 'all'
List of values: 'all', 'positive', 'negative', 'all_strongest', 'positive_strongest', 'negative_strongest'

Select (input_control)
string -> string
Selection of edge pairs.
Default value: 'all'
List of values: 'all', 'first', 'last'

RowEdgeFirst (output_control)
point.y-array -> real
Row coordinate of the center of the first edge.

ColumnEdgeFirst (output_control)
point.x-array -> real
Column coordinate of the center of the first edge.

AmplitudeFirst (output_control)
real-array -> real
Edge amplitude of the first edge (with sign).

RowEdgeSecond (output_control)
point.y-array -> real
Row coordinate of the center of the second edge.

ColumnEdgeSecond (output_control)
point.x-array -> real
Column coordinate of the center of the second edge.

AmplitudeSecond (output_control)
real-array -> real
Edge amplitude of the second edge (with sign).

IntraDistance (output_control)
real-array -> real
Distance between edges of an edge pair.

InterDistance (output_control)
real-array -> real
Distance between consecutive edge pairs.


Result

If the parameter values are correct the operator measure_pairs returns the value 2 (H_MSG_TRUE). Otherwise an exception handling is raised.


Parallelization Information

measure_pairs is reentrant and processed without parallelization.


Possible Predecessors

gen_measure_rectangle2


Possible Successors

close_measure


Alternatives

edges_sub_pix, fuzzy_measure_pairs, fuzzy_measure_pairing


See also

measure_pos, fuzzy_measure_pos


Module

Sub-pixel operators



Copyright © 1996-2005 MVTec Software GmbH