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

fuzzy_measure_pairsT_fuzzy_measure_pairsfuzzy_measure_pairsFuzzyMeasurePairsFuzzyMeasurePairs (Operator)

Name

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

Signature

fuzzy_measure_pairs(Image : : MeasureHandle, Sigma, AmpThresh, FuzzyThresh, Transition : RowEdgeFirst, ColumnEdgeFirst, AmplitudeFirst, RowEdgeSecond, ColumnEdgeSecond, AmplitudeSecond, RowEdgeCenter, ColumnEdgeCenter, FuzzyScore, IntraDistance, InterDistance)

Herror T_fuzzy_measure_pairs(const Hobject Image, const Htuple MeasureHandle, const Htuple Sigma, const Htuple AmpThresh, const Htuple FuzzyThresh, const Htuple Transition, Htuple* RowEdgeFirst, Htuple* ColumnEdgeFirst, Htuple* AmplitudeFirst, Htuple* RowEdgeSecond, Htuple* ColumnEdgeSecond, Htuple* AmplitudeSecond, Htuple* RowEdgeCenter, Htuple* ColumnEdgeCenter, Htuple* FuzzyScore, Htuple* IntraDistance, Htuple* InterDistance)

Herror fuzzy_measure_pairs(Hobject Image, const HTuple& MeasureHandle, const HTuple& Sigma, const HTuple& AmpThresh, const HTuple& FuzzyThresh, const HTuple& Transition, HTuple* RowEdgeFirst, HTuple* ColumnEdgeFirst, HTuple* AmplitudeFirst, HTuple* RowEdgeSecond, HTuple* ColumnEdgeSecond, HTuple* AmplitudeSecond, HTuple* RowEdgeCenter, HTuple* ColumnEdgeCenter, HTuple* FuzzyScore, HTuple* IntraDistance, HTuple* InterDistance)

HTuple HImage::FuzzyMeasurePairs(const HMeasure& MeasureHandle, const HTuple& Sigma, const HTuple& AmpThresh, const HTuple& FuzzyThresh, const HTuple& Transition, HTuple* ColumnEdgeFirst, HTuple* AmplitudeFirst, HTuple* RowEdgeSecond, HTuple* ColumnEdgeSecond, HTuple* AmplitudeSecond, HTuple* RowEdgeCenter, HTuple* ColumnEdgeCenter, HTuple* FuzzyScore, HTuple* IntraDistance, HTuple* InterDistance) const

HTuple HMeasure::FuzzyMeasurePairs(const HImage& Image, const HTuple& Sigma, const HTuple& AmpThresh, const HTuple& FuzzyThresh, const HTuple& Transition, HTuple* ColumnEdgeFirst, HTuple* AmplitudeFirst, HTuple* RowEdgeSecond, HTuple* ColumnEdgeSecond, HTuple* AmplitudeSecond, HTuple* RowEdgeCenter, HTuple* ColumnEdgeCenter, HTuple* FuzzyScore, HTuple* IntraDistance, HTuple* InterDistance) const

void HOperatorSetX.FuzzyMeasurePairs(
[in] IHUntypedObjectX* Image, [in] VARIANT MeasureHandle, [in] VARIANT Sigma, [in] VARIANT AmpThresh, [in] VARIANT FuzzyThresh, [in] VARIANT Transition, [out] VARIANT* RowEdgeFirst, [out] VARIANT* ColumnEdgeFirst, [out] VARIANT* AmplitudeFirst, [out] VARIANT* RowEdgeSecond, [out] VARIANT* ColumnEdgeSecond, [out] VARIANT* AmplitudeSecond, [out] VARIANT* RowEdgeCenter, [out] VARIANT* ColumnEdgeCenter, [out] VARIANT* FuzzyScore, [out] VARIANT* IntraDistance, [out] VARIANT* InterDistance)

VARIANT HMeasureX.FuzzyMeasurePairs(
[in] IHImageX* Image, [in] double Sigma, [in] double AmpThresh, [in] double FuzzyThresh, [in] BSTR Transition, [out] VARIANT* ColumnEdgeFirst, [out] VARIANT* AmplitudeFirst, [out] VARIANT* RowEdgeSecond, [out] VARIANT* ColumnEdgeSecond, [out] VARIANT* AmplitudeSecond, [out] VARIANT* RowEdgeCenter, [out] VARIANT* ColumnEdgeCenter, [out] VARIANT* FuzzyScore, [out] VARIANT* IntraDistance, [out] VARIANT* InterDistance)

VARIANT HImageX.FuzzyMeasurePairs(
[in] IHMeasureX* MeasureHandle, [in] double Sigma, [in] double AmpThresh, [in] double FuzzyThresh, [in] BSTR Transition, [out] VARIANT* ColumnEdgeFirst, [out] VARIANT* AmplitudeFirst, [out] VARIANT* RowEdgeSecond, [out] VARIANT* ColumnEdgeSecond, [out] VARIANT* AmplitudeSecond, [out] VARIANT* RowEdgeCenter, [out] VARIANT* ColumnEdgeCenter, [out] VARIANT* FuzzyScore, [out] VARIANT* IntraDistance, [out] VARIANT* InterDistance)

static void HOperatorSet.FuzzyMeasurePairs(HObject image, HTuple measureHandle, HTuple sigma, HTuple ampThresh, HTuple fuzzyThresh, HTuple transition, out HTuple rowEdgeFirst, out HTuple columnEdgeFirst, out HTuple amplitudeFirst, out HTuple rowEdgeSecond, out HTuple columnEdgeSecond, out HTuple amplitudeSecond, out HTuple rowEdgeCenter, out HTuple columnEdgeCenter, out HTuple fuzzyScore, out HTuple intraDistance, out HTuple interDistance)

void HMeasure.FuzzyMeasurePairs(HImage image, double sigma, double ampThresh, double fuzzyThresh, string transition, out HTuple rowEdgeFirst, out HTuple columnEdgeFirst, out HTuple amplitudeFirst, out HTuple rowEdgeSecond, out HTuple columnEdgeSecond, out HTuple amplitudeSecond, out HTuple rowEdgeCenter, out HTuple columnEdgeCenter, out HTuple fuzzyScore, out HTuple intraDistance, out HTuple interDistance)

void HImage.FuzzyMeasurePairs(HMeasure measureHandle, double sigma, double ampThresh, double fuzzyThresh, string transition, out HTuple rowEdgeFirst, out HTuple columnEdgeFirst, out HTuple amplitudeFirst, out HTuple rowEdgeSecond, out HTuple columnEdgeSecond, out HTuple amplitudeSecond, out HTuple rowEdgeCenter, out HTuple columnEdgeCenter, out HTuple fuzzyScore, out HTuple intraDistance, out HTuple interDistance)

Description

fuzzy_measure_pairsfuzzy_measure_pairsfuzzy_measure_pairsFuzzyMeasurePairsFuzzyMeasurePairs serves to extract straight edge pairs which lie perpendicular to the major axis of a rectangle or an annular arc. In addition to measure_pairsmeasure_pairsmeasure_pairsMeasurePairsMeasurePairs it uses fuzzy member functions to evaluate and select the edge pairs.

The extraction algorithm is identical to fuzzy_measure_posfuzzy_measure_posfuzzy_measure_posFuzzyMeasurePosFuzzyMeasurePos. In addition, the edges are grouped to pairs: If TransitionTransitionTransitionTransitiontransition = 'positive'"positive""positive""positive""positive", the edge points with a dark-to-light transition in the direction of the major axis of the rectangle or annular arc are returned in RowEdgeFirstRowEdgeFirstRowEdgeFirstRowEdgeFirstrowEdgeFirst and ColumnEdgeFirstColumnEdgeFirstColumnEdgeFirstColumnEdgeFirstcolumnEdgeFirst. In this case, the corresponding edges with a light-to-dark transition are returned in RowEdgeSecondRowEdgeSecondRowEdgeSecondRowEdgeSecondrowEdgeSecond and ColumnEdgeSecondColumnEdgeSecondColumnEdgeSecondColumnEdgeSecondcolumnEdgeSecond. If TransitionTransitionTransitionTransitiontransition = 'negative'"negative""negative""negative""negative", the behavior is exactly opposite. If TransitionTransitionTransitionTransitiontransition = 'all'"all""all""all""all", the first detected edge defines the transition for RowEdgeFirstRowEdgeFirstRowEdgeFirstRowEdgeFirstrowEdgeFirst and ColumnEdgeFirstColumnEdgeFirstColumnEdgeFirstColumnEdgeFirstcolumnEdgeFirst. I.e., dependent on the positioning of the measure object, edge pairs with a light-dark-light transition or edge pairs with a dark-light-dark transition are returned. This is suited, e.g., to measure objects with different brightness relative to the background.

Having extracted subpixel edge locations, the edges are paired. The pairing algorithm groups the edges such that interleavings and inclusions of pairs are prohibited. The features of an edge pair are evaluated by a fuzzy function, which can be set by set_fuzzy_measureset_fuzzy_measureset_fuzzy_measureSetFuzzyMeasureSetFuzzyMeasure or set_fuzzy_measure_norm_pairset_fuzzy_measure_norm_pairset_fuzzy_measure_norm_pairSetFuzzyMeasureNormPairSetFuzzyMeasureNormPair. Which edge pairs are selected can be determined with the parameter FuzzyThreshFuzzyThreshFuzzyThreshFuzzyThreshfuzzyThresh, which constitutes a threshold on the weight over all fuzzy sets, i.e., the geometric mean of the weights of the defined fuzzy member functions.

The selected edges are returned as single points, which lie on the major axis of the rectangle or annular arc. The corresponding edge amplitudes are returned in AmplitudeFirstAmplitudeFirstAmplitudeFirstAmplitudeFirstamplitudeFirst and AmplitudeSecondAmplitudeSecondAmplitudeSecondAmplitudeSecondamplitudeSecond, the fuzzy scores in FuzzyScoreFuzzyScoreFuzzyScoreFuzzyScorefuzzyScore. In addition, the distance between each edge pair is returned in IntraDistanceIntraDistanceIntraDistanceIntraDistanceintraDistance and the distance between consecutive edge pairs is returned in InterDistanceInterDistanceInterDistanceInterDistanceinterDistance. 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 InterDistanceInterDistanceInterDistanceInterDistanceinterDistance contains one element less than the tuples of the edge pairs.

Attention

fuzzy_measure_pairsfuzzy_measure_pairsfuzzy_measure_pairsFuzzyMeasurePairsFuzzyMeasurePairs only returns meaningful results if the assumptions that the edges are straight and perpendicular to the major axis of the rectangle or annular 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 a annular 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 fuzzy_measure_pairsfuzzy_measure_pairsfuzzy_measure_pairsFuzzyMeasurePairsFuzzyMeasurePairs 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

AmpThreshAmpThreshAmpThreshAmpThreshampThresh (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 ≤ AmpThresh AmpThresh AmpThresh AmpThresh ampThresh ≤ 255 (lin)

Minimum increment: 0.5

Recommended increment: 2

FuzzyThreshFuzzyThreshFuzzyThreshFuzzyThreshfuzzyThresh (input_control)  number HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Minimum fuzzy value.

Default value: 0.5

Suggested values: 0.1, 0.3, 0.5, 0.7, 0.9

Typical range of values: 0.0 ≤ FuzzyThresh FuzzyThresh FuzzyThresh FuzzyThresh fuzzyThresh ≤ 1.0 (lin)

Recommended increment: 0.1

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

Select the first gray value transition of the edge pairs.

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"

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

Row coordinate of the first edge point.

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

Column coordinate of the first edge point.

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

Edge amplitude of the first edge (with sign).

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

Row coordinate of the second edge point.

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

Column coordinate of the second edge point.

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

Edge amplitude of the second edge (with sign).

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

Row coordinate of the center of the edge pair.

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

Column coordinate of the center of the edge pair.

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

Fuzzy evaluation of the edge pair.

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

Distance between edges of an edge pair.

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

Distance between consecutive edge pairs.

Result

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

Possible Predecessors

gen_measure_rectangle2gen_measure_rectangle2gen_measure_rectangle2GenMeasureRectangle2GenMeasureRectangle2, gen_measure_arcgen_measure_arcgen_measure_arcGenMeasureArcGenMeasureArc, set_fuzzy_measureset_fuzzy_measureset_fuzzy_measureSetFuzzyMeasureSetFuzzyMeasure

Possible Successors

close_measureclose_measureclose_measureCloseMeasureCloseMeasure

Alternatives

edges_sub_pixedges_sub_pixedges_sub_pixEdgesSubPixEdgesSubPix, fuzzy_measure_pairingfuzzy_measure_pairingfuzzy_measure_pairingFuzzyMeasurePairingFuzzyMeasurePairing, measure_pairsmeasure_pairsmeasure_pairsMeasurePairsMeasurePairs

See also

fuzzy_measure_posfuzzy_measure_posfuzzy_measure_posFuzzyMeasurePosFuzzyMeasurePos, measure_posmeasure_posmeasure_posMeasurePosMeasurePos

Module

1D Metrology


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