Skip to content

measure_threshMeasureThreshMeasureThreshmeasure_threshT_measure_threshπŸ”—

Short descriptionπŸ”—

measure_threshMeasureThreshMeasureThreshmeasure_threshT_measure_thresh β€” Extracting points with a particular gray value along a rectangle or an annular arc.

SignatureπŸ”—

measure_thresh( image Image, measure MeasureHandle, number Sigma, number Threshold, string Select, out point.y RowThresh, out point.x ColumnThresh, out real Distance )void MeasureThresh( const HObject& Image, const HTuple& MeasureHandle, const HTuple& Sigma, const HTuple& Threshold, const HTuple& Select, HTuple* RowThresh, HTuple* ColumnThresh, HTuple* Distance )static void HOperatorSet.MeasureThresh( HObject image, HTuple measureHandle, HTuple sigma, HTuple threshold, HTuple select, out HTuple rowThresh, out HTuple columnThresh, out HTuple distance )def measure_thresh( image: HObject, measure_handle: HHandle, sigma: float, threshold: float, select: str ) -> Tuple[Sequence[float], Sequence[float], Sequence[float]]

Herror T_measure_thresh( const Hobject Image, const Htuple MeasureHandle, const Htuple Sigma, const Htuple Threshold, const Htuple Select, Htuple* RowThresh, Htuple* ColumnThresh, Htuple* Distance )

void HMeasure::MeasureThresh( const HImage& Image, double Sigma, double Threshold, const HString& Select, HTuple* RowThresh, HTuple* ColumnThresh, HTuple* Distance ) const

void HMeasure::MeasureThresh( const HImage& Image, double Sigma, double Threshold, const char* Select, HTuple* RowThresh, HTuple* ColumnThresh, HTuple* Distance ) const

void HMeasure::MeasureThresh( const HImage& Image, double Sigma, double Threshold, const wchar_t* Select, HTuple* RowThresh, HTuple* ColumnThresh, HTuple* Distance ) const (Windows only)

void HImage::MeasureThresh( const HMeasure& MeasureHandle, double Sigma, double Threshold, const HString& Select, HTuple* RowThresh, HTuple* ColumnThresh, HTuple* Distance ) const

void HImage::MeasureThresh( const HMeasure& MeasureHandle, double Sigma, double Threshold, const char* Select, HTuple* RowThresh, HTuple* ColumnThresh, HTuple* Distance ) const

void HImage::MeasureThresh( const HMeasure& MeasureHandle, double Sigma, double Threshold, const wchar_t* Select, HTuple* RowThresh, HTuple* ColumnThresh, HTuple* Distance ) const (Windows only)

void HMeasure.MeasureThresh( HImage image, double sigma, double threshold, string select, out HTuple rowThresh, out HTuple columnThresh, out HTuple distance )

void HImage.MeasureThresh( HMeasure measureHandle, double sigma, double threshold, string select, out HTuple rowThresh, out HTuple columnThresh, out HTuple distance )

DescriptionπŸ”—

measure_threshMeasureThresh extracts points for which the gray value within an one-dimensional gray value profile is equal to the specified threshold Thresholdthresholdthreshold. The gray value profile is projected onto the major axis of the measure rectangle which is passed with the parameter MeasureHandlemeasureHandlemeasure_handle, so the threshold points calculated within the gray value profile correspond to certain image coordinates on the rectangle’s major axis. These coordinates are returned as the operator results in RowThreshrowThreshrow_thresh and ColumnThreshcolumnThreshcolumn_thresh.

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

If the gray value profile intersects the threshold line for several times, the parameter Selectselectselect determines which values to return. Possible settings are 'first'"first", 'last'"last", 'first_last'"first_last" (first and last) or 'all'"all". For the last two cases Distancedistancedistance returns the distances between the calculated points.

The gray value profile is created by averaging the gray values along all line segments, which are defined by the measure rectangle as follows:

  1. The segments are perpendicular to the major axis of the rectangle,

  2. they have an integer distance to the center of the rectangle,

  3. the rectangle bounds the segments.

For every line segment, the average of the gray values of all points with an integer distance to the major axis is calculated. Due to translation and rotation of the measure rectangle with respect to the image coordinates the input image Imageimageimage is in general sampled at subpixel positions.

Since this involves some calculations which can be used repeatedly in several projections, the operator gen_measure_rectangle2GenMeasureRectangle2 is used to perform these calculations only once in advance. Here, the measure object MeasureHandlemeasureHandlemeasure_handle is generated and different interpolation schemes can be selected.

AttentionπŸ”—

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

It should be kept in mind that measure_threshMeasureThresh 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.0, 0.4, 0.6, 0.8, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 7.0, 10.00.0, 0.4, 0.6, 0.8, 1.0, 1.5, 2.0, 3.0, 4.0, 5.0, 7.0, 10.0
Value range: 0.0 ≀ Sigma ≀ 100 (lin)
Minimum increment: 0.01
Recommended increment: 0.1

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

Threshold.

Default: 128.0128.0
Value range: 0 ≀ Threshold ≀ 255 (lin)
Minimum increment: 0.5
Recommended increment: 1

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

Selection of points.

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

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

Row coordinates of points with threshold value.

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

Column coordinates of points with threshold value.

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

Distance between consecutive points.

ResultπŸ”—

If the parameter values are correct the operator measure_threshMeasureThresh 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

measure_posMeasurePos, edges_sub_pixEdgesSubPix, measure_pairsMeasurePairs

ModuleπŸ”—

1D Metrology