HALCON Reference Manual 10.0.2
Table of Contents / 1D Measuring ClassesClassesClasses | | | Operators

measure_posT_measure_posmeasure_posMeasurePosMeasurePos (Operator)

Name

measure_posT_measure_posmeasure_posMeasurePosMeasurePos — Extract straight edges perpendicular to a rectangle or annular arc.

Signature

measure_pos(Image : : MeasureHandle, Sigma, Threshold, Transition, Select : RowEdge, ColumnEdge, Amplitude, Distance)

Herror T_measure_pos(const Hobject Image, const Htuple MeasureHandle, const Htuple Sigma, const Htuple Threshold, const Htuple Transition, const Htuple Select, Htuple* RowEdge, Htuple* ColumnEdge, Htuple* Amplitude, Htuple* Distance)

Herror measure_pos(Hobject Image, const HTuple& MeasureHandle, const HTuple& Sigma, const HTuple& Threshold, const HTuple& Transition, const HTuple& Select, HTuple* RowEdge, HTuple* ColumnEdge, HTuple* Amplitude, HTuple* Distance)

HTuple HImage::MeasurePos(const HMeasure& MeasureHandle, const HTuple& Sigma, const HTuple& Threshold, const HTuple& Transition, const HTuple& Select, HTuple* ColumnEdge, HTuple* Amplitude, HTuple* Distance) const

HTuple HMeasure::MeasurePos(const HImage& Image, const HTuple& Sigma, const HTuple& Threshold, const HTuple& Transition, const HTuple& Select, HTuple* ColumnEdge, HTuple* Amplitude, HTuple* Distance) const

void HOperatorSetX.MeasurePos(
[in] IHUntypedObjectX* Image, [in] VARIANT MeasureHandle, [in] VARIANT Sigma, [in] VARIANT Threshold, [in] VARIANT Transition, [in] VARIANT Select, [out] VARIANT* RowEdge, [out] VARIANT* ColumnEdge, [out] VARIANT* Amplitude, [out] VARIANT* Distance)

VARIANT HMeasureX.MeasurePos(
[in] IHImageX* Image, [in] double Sigma, [in] double Threshold, [in] BSTR Transition, [in] BSTR Select, [out] VARIANT* ColumnEdge, [out] VARIANT* Amplitude, [out] VARIANT* Distance)

VARIANT HImageX.MeasurePos(
[in] IHMeasureX* MeasureHandle, [in] double Sigma, [in] double Threshold, [in] BSTR Transition, [in] BSTR Select, [out] VARIANT* ColumnEdge, [out] VARIANT* Amplitude, [out] VARIANT* Distance)

static void HOperatorSet.MeasurePos(HObject image, HTuple measureHandle, HTuple sigma, HTuple threshold, HTuple transition, HTuple select, out HTuple rowEdge, out HTuple columnEdge, out HTuple amplitude, out HTuple distance)

void HMeasure.MeasurePos(HImage image, double sigma, double threshold, string transition, string select, out HTuple rowEdge, out HTuple columnEdge, out HTuple amplitude, out HTuple distance)

void HImage.MeasurePos(HMeasure measureHandle, double sigma, double threshold, string transition, string select, out HTuple rowEdge, out HTuple columnEdge, out HTuple amplitude, out HTuple distance)

Description

measure_posmeasure_posmeasure_posMeasurePosMeasurePos extracts straight edges which lie perpendicular to the major axis of a rectangle or annular arc.

The algorithm works by averaging the gray values in “slices” perpendicular to the major axis of the rectangle or annular arc in order to obtain a one-dimensional edge profile. The sampling is done at subpixel positions in the image ImageImageImageImageimage at integer row and column distances (in the coordinate frame of the rectangle) from the center of the rectangle. Since this involves some calculations which can be used repeatedly in several measurements, the operator gen_measure_rectangle2gen_measure_rectangle2gen_measure_rectangle2GenMeasureRectangle2GenMeasureRectangle2 or gen_measure_arcgen_measure_arcgen_measure_arcGenMeasureArcGenMeasureArc is used to perform these calculations only once, thus increasing the speed of measure_posmeasure_posmeasure_posMeasurePosMeasurePos significantly. Since there is a trade-off between accuracy and speed in the subpixel calculations of the gray values, and thus in the accuracy of the extracted edge positions, different interpolation schemes can be selected in gen_measure_rectangle2gen_measure_rectangle2gen_measure_rectangle2GenMeasureRectangle2GenMeasureRectangle2. (The interpolation only influences rectangles not aligned with the image axes.) The measure object generated with gen_measure_rectangle2gen_measure_rectangle2gen_measure_rectangle2GenMeasureRectangle2GenMeasureRectangle2 is passed in MeasureHandleMeasureHandleMeasureHandleMeasureHandlemeasureHandle.

After the one-dimensional edge profile has been calculated, subpixel edge locations are computed by convolving the profile with the derivatives of a Gaussian smoothing kernel of standard deviation SigmaSigmaSigmaSigmasigma. Salient edges can be selected with the parameter ThresholdThresholdThresholdThresholdthreshold, which constitutes a threshold on the amplitude, i.e., the absolute value of the first derivative of the edge. Additionally, it is possible to select only positive edges, i.e., edges which constitute a dark-to-light transition in the direction of the major axis of the rectangle or the arc (TransitionTransitionTransitionTransitiontransition = 'positive'"positive""positive""positive""positive"), only negative edges, i.e., light-to-dark transitions (TransitionTransitionTransitionTransitiontransition = 'negative'"negative""negative""negative""negative"), or both types of edges (TransitionTransitionTransitionTransitiontransition = 'all'"all""all""all""all"). Finally, it is possible to select which edge points are returned. If SelectSelectSelectSelectselect is set to 'all'"all""all""all""all", all edge points are returned. If it is set to 'first'"first""first""first""first", only the first of the extracted edge points is returned, while it is set to 'last'"last""last""last""last", only the last one is returned.

The extracted edges are returned as single points which lie on the major axis of the rectangle or arc in (RowEdgeRowEdgeRowEdgeRowEdgerowEdge,ColumnEdgeColumnEdgeColumnEdgeColumnEdgecolumnEdge). The corresponding edge amplitudes are returned in AmplitudeAmplitudeAmplitudeAmplitudeamplitude. In addition, the distance between consecutive edge points is returned in DistanceDistanceDistanceDistancedistance. Here, Distance[i] corresponds to the distance between Edge[i] and Edge[i+1], i.e., the tuple DistanceDistanceDistanceDistancedistance contains one element less than the tuples RowEdgeRowEdgeRowEdgeRowEdgerowEdge and ColumnEdgeColumnEdgeColumnEdgeColumnEdgecolumnEdge.

Attention

measure_posmeasure_posmeasure_posMeasurePosMeasurePos only returns meaningful results if the assumptions that the edges are straight and perpendicular to the major axis of the rectangle or arc are fulfilled. Thus, it should not be used to extract edges from curved objects, for example. Furthermore, the user should ensure that the rectangle or arc is as close to perpendicular as possible to the edges in the image. Additionally, SigmaSigmaSigmaSigmasigma must not become larger than approx. 0.5 * Length1 (for Length1 see gen_measure_rectangle2gen_measure_rectangle2gen_measure_rectangle2GenMeasureRectangle2GenMeasureRectangle2).

It should be kept in mind that measure_posmeasure_posmeasure_posMeasurePosMeasurePos ignores the domain of ImageImageImageImageimage 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.

Parallelization

Parameters

ImageImageImageImageimage (input_object)  singlechannelimage objectHImageHImageHImageXHobject (byte / uint2 / real)

Input image.

MeasureHandleMeasureHandleMeasureHandleMeasureHandlemeasureHandle (input_control)  measure_id HMeasure, HTupleHMeasure, HTupleHMeasureX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

Measure object handle.

SigmaSigmaSigmaSigmasigma (input_control)  number HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

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 Sigma Sigma Sigma sigma ≤ 100 (lin)

Minimum increment: 0.01

Recommended increment: 0.1

Restriction: Sigma >= 0.4

ThresholdThresholdThresholdThresholdthreshold (input_control)  number HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

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 Threshold Threshold Threshold threshold ≤ 255 (lin)

Minimum increment: 0.5

Recommended increment: 2

TransitionTransitionTransitionTransitiontransition (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Light/dark or dark/light edge.

Default value: 'all' "all" "all" "all" "all"

List of values: 'all'"all""all""all""all", 'positive'"positive""positive""positive""positive", 'negative'"negative""negative""negative""negative"

SelectSelectSelectSelectselect (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Selection of end points.

Default value: 'all' "all" "all" "all" "all"

List of values: 'all'"all""all""all""all", 'first'"first""first""first""first", 'last'"last""last""last""last"

RowEdgeRowEdgeRowEdgeRowEdgerowEdge (output_control)  point.y-array HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Row coordinate of the center of the edge.

ColumnEdgeColumnEdgeColumnEdgeColumnEdgecolumnEdge (output_control)  point.x-array HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Column coordinate of the center of the edge.

AmplitudeAmplitudeAmplitudeAmplitudeamplitude (output_control)  real-array HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Edge amplitude of the edge (with sign).

DistanceDistanceDistanceDistancedistance (output_control)  real-array HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Distance between consecutive edges.

Result

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

Possible Predecessors

gen_measure_rectangle2gen_measure_rectangle2gen_measure_rectangle2GenMeasureRectangle2GenMeasureRectangle2

Possible Successors

close_measureclose_measureclose_measureCloseMeasureCloseMeasure

Alternatives

edges_sub_pixedges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPix, fuzzy_measure_posfuzzy_measure_posfuzzy_measure_posFuzzyMeasurePosFuzzyMeasurePos

See also

measure_pairsmeasure_pairsmeasure_pairsMeasurePairsMeasurePairs, fuzzy_measure_pairsfuzzy_measure_pairsfuzzy_measure_pairsFuzzyMeasurePairsFuzzyMeasurePairs, fuzzy_measure_pairingfuzzy_measure_pairingfuzzy_measure_pairingFuzzyMeasurePairingFuzzyMeasurePairing

Module

1D Metrology


Table of Contents / 1D Measuring ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH