Skip to content

measure_posMeasurePosMeasurePosmeasure_posT_measure_posπŸ”—

Short descriptionπŸ”—

measure_posMeasurePosMeasurePosmeasure_posT_measure_pos β€” Extract straight edges perpendicular to a rectangle or annular arc.

SignatureπŸ”—

measure_pos( image Image, measure MeasureHandle, number Sigma, number Threshold, string Transition, string Select, out point.y RowEdge, out point.x ColumnEdge, out real Amplitude, out real Distance )void MeasurePos( 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 )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 )def measure_pos( image: HObject, measure_handle: HHandle, sigma: float, threshold: float, transition: str, select: str ) -> Tuple[Sequence[float], Sequence[float], Sequence[float], Sequence[float]]

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 )

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

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

void HMeasure::MeasurePos( const HImage& Image, double Sigma, double Threshold, const wchar_t* Transition, const wchar_t* Select, HTuple* RowEdge, HTuple* ColumnEdge, HTuple* Amplitude, HTuple* Distance ) const (Windows only)

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

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

void HImage::MeasurePos( const HMeasure& MeasureHandle, double Sigma, double Threshold, const wchar_t* Transition, const wchar_t* Select, HTuple* RowEdge, HTuple* ColumnEdge, HTuple* Amplitude, HTuple* Distance ) const (Windows only)

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_posMeasurePos extracts straight edges which lie perpendicular to the major axis of a rectangle or annular arc.

For an explanation of the concept of 1D measuring see the introduction of chapter 1D Measuring.

The algorithm of measure_posMeasurePos 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 Imageimageimage 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_rectangle2GenMeasureRectangle2 or gen_measure_arcGenMeasureArc is used to perform these calculations only once, thus increasing the speed of measure_posMeasurePos 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_rectangle2GenMeasureRectangle2. (The interpolation only influences rectangles not aligned with the image axes.) The measure object generated with gen_measure_rectangle2GenMeasureRectangle2 is passed in MeasureHandlemeasureHandlemeasure_handle.

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 Sigmasigmasigma. Salient edges can be selected with the parameter Thresholdthresholdthreshold, which constitutes a threshold on the amplitude values (Amplitudeamplitudeamplitude), i.e., the absolute value of the first derivative of the edge. Note that the amplitude values are scaled by the factor \(\textrm{Sigma} \cdot \sqrt{2\pi}\). 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 (Transitiontransitiontransition = 'positive'"positive"), only negative edges, i.e., light-to-dark transitions (Transitiontransitiontransition = 'negative'"negative"), or both types of edges (Transitiontransitiontransition = 'all'"all"). Finally, it is possible to select which edge points are returned. If Selectselectselect is set to 'all'"all", all edge points are returned. If it is set to 'first'"first", only the first of the extracted edge points is returned, while it is set to '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 (RowEdgerowEdgerow_edge, ColumnEdgecolumnEdgecolumn_edge). The corresponding edge amplitudes are returned in Amplitudeamplitudeamplitude. In addition, the distance between consecutive edge points is returned in Distancedistancedistance. Here, Distance[i] corresponds to the distance between Edge[i] and Edge[i+1], i.e., the tuple Distancedistancedistance contains one element less than the tuples RowEdgerowEdgerow_edge and ColumnEdgecolumnEdgecolumn_edge.

AttentionπŸ”—

measure_posMeasurePos 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, Sigmasigmasigma must not become larger than approx. 0.5 * Length1length1length_1 (for Length1length1length_1 see gen_measure_rectangle2GenMeasureRectangle2).

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

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

ParametersπŸ”—

Imageimageimage (input_object) singlechannelimage β†’ object (byte / uint2 / real)HObject (byte / uint2 / real)HImage (byte / uint2 / real)HObject (byte / uint2 / real)Hobject (byte / uint2 / real)

Input image.

MeasureHandlemeasureHandlemeasure_handle (input_control) measure β†’ (handle)HTuple (HHandle)HMeasure, HTuple (IntPtr)HHandleHtuple (handle)

Measure object handle.

Sigmasigmasigma (input_control) number β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Sigma of gaussian smoothing.

Default: 1.01.0
Suggested values: 0.4, 0.6, 0.8, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 7.0, 10.00.4, 0.6, 0.8, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 7.0, 10.0
Value range: 0.4 ≀ Sigma ≀ 100 (lin)
Minimum increment: 0.01
Recommended increment: 0.1

Thresholdthresholdthreshold (input_control) number β†’ (real)HTuple (double)HTuple (double)floatHtuple (double)

Minimum edge amplitude.

Default: 30.030.0
Suggested values: 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 90.0, 110.05.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 90.0, 110.0
Value range: 1 ≀ Threshold ≀ 255 (lin)
Minimum increment: 0.5
Recommended increment: 2

Transitiontransitiontransition (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Light/dark or dark/light edge.

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

Selectselectselect (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Selection of end points.

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

RowEdgerowEdgerow_edge (output_control) point.y-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Row coordinate of the center of the edge.

ColumnEdgecolumnEdgecolumn_edge (output_control) point.x-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Column coordinate of the center of the edge.

Amplitudeamplitudeamplitude (output_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Edge amplitude of the edge (with sign).

Distancedistancedistance (output_control) real-array β†’ (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Distance between consecutive edges.

ResultπŸ”—

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

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

gen_measure_rectangle2GenMeasureRectangle2

Possible successors

close_measureCloseMeasure

Alternatives

edges_sub_pixEdgesSubPix, fuzzy_measure_posFuzzyMeasurePos

See also

measure_pairsMeasurePairs, fuzzy_measure_pairsFuzzyMeasurePairs, fuzzy_measure_pairingFuzzyMeasurePairing

ModuleπŸ”—

1D Metrology