Back to Aurora Vision Library website

You are here: Start » Function Reference » All Functions » Image Analysis » AvsFilter_MeasureObjectWidth

AvsFilter_MeasureObjectWidth


This is Filter Equivalent. This function may be present in generated code, but should not be used in hand-written code. CreateMeasurementMap and MeasureObjectWidth should be used instead.

Header: AVL.h
Namespace: avs
Module: FoundationPro

Measures the width of an object using stripe detection.

Syntax

void avs::AvsFilter_MeasureObjectWidth
(
	MeasureObjectWidthState& ioState,
	const avl::Image& inImage,
	const avl::SegmentScanField& inScanField,
	atl::Optional<const avl::CoordinateSystem2D&> inScanFieldAlignment,
	int inScanCount,
	int inScanWidth,
	avl::InterpolationMethod::Type inImageInterpolation,
	const avl::StripeScanParams& inStripeScanParams,
	avl::MeasureObjectMethod::Type inMeasureMethod,
	avl::Selection::Type inStripeSelection,
	atl::Optional<const avl::LocalBlindness&> inLocalBlindness,
	atl::Optional<avl::MEstimator::Type> inOutlierSuppression,
	int inOutlierCount,
	atl::Conditional<float>& outObjectWidth,
	atl::Conditional<avl::Segment2D>& outSegment1,
	atl::Conditional<avl::Segment2D>& outSegment2,
	atl::Optional<avl::SegmentScanField&> outAlignedScanField = atl::NIL,
	atl::Optional<atl::Array<atl::Conditional<avl::Stripe1D>>&> outStripes = atl::NIL,
	atl::Optional<atl::Array<avl::Profile>&> outBrightnessProfiles = atl::NIL,
	atl::Optional<atl::Array<avl::Profile>&> outResponseProfiles = atl::NIL,
	atl::Array<avl::Segment2D>& diagScanSegments
)

Parameters

Name Type Range Default Description
Input will be modified ioState MeasureObjectWidthState& Object used to maintain state of the function.
Input value inImage const Image& Input image
Input value inScanField const SegmentScanField& Field in which measurement scans are performed
Input value inScanFieldAlignment Optional<const CoordinateSystem2D&> NIL Adjusts the scan field to the position of the inspected object
Input value inScanCount int 2 - 5 Number of scans to be performed
Input value inScanWidth int 1 - 5 Width of each single scan
Input value inImageInterpolation InterpolationMethod::Type Bilinear Interpolation method used in extraction of image pixel values
Input value inStripeScanParams const StripeScanParams& StripeScanParams ( ProfileInterpolation: Quadratic4 SmoothingStdDev: 0.6f MinMagnitude: 5.0f MaxInnerEdgeMagnitude: Nil StripePolarity: Dark MinStripeWidth: 0.0f MaxStripeWidth: Nil ) Parameters controlling the object stripe extraction process
Input value inMeasureMethod MeasureObjectMethod::Type Method used to measure the object
Input value inStripeSelection Selection::Type Selection mode of edges of the object
Input value inLocalBlindness Optional<const LocalBlindness&> NIL Defines conditions in which weaker edges can be detected in the vicinity of stronger edges
Input value inOutlierSuppression Optional<MEstimator::Type> NIL Selects a method for ignoring incorrectly detected points
Input value inOutlierCount int 0 - Determines how many points are not count when object width is measured
Output value outObjectWidth Conditional<float>& Width of the object
Output value outSegment1 Conditional<Segment2D>& First edge of the object
Output value outSegment2 Conditional<Segment2D>& Second edge of the object
Output value outAlignedScanField Optional<SegmentScanField&> NIL Field in which the scans are performed
Output value outStripes Optional<Array<Conditional<Stripe1D>>&> NIL Detected stripes
Output value outBrightnessProfiles Optional<Array<Profile>&> NIL Extracted image profiles
Output value outResponseProfiles Optional<Array<Profile>&> NIL Profiles of the edge (derivative) operator
Diagnostic input diagScanSegments Array<Segment2D>& Segments along which the scans are performed

Optional Outputs

The computation of following outputs can be switched off by passing value atl::NIL to these parameters: outAlignedScanField, outStripes, outBrightnessProfiles, outResponseProfiles.

Read more about Optional Outputs.

Description

The filter measures the width of an object present in an image. Internally, it performs a series of scans with ScanSingleStripe filter along inScanCount parallel scan segments constructed from inScanField. The so obtained points are then used for computing two parallel segments by means of a slightly modified segment fitting routine. The process is supported by inOutlierSuppression parameter. Finally, having the aforementioned stripe widths and fitted segments' direction, the object width can be computed using a selected inMeasureMethod method. The inOutlierCount stripe widths most differing from the median width are not used in this step. For the filter to work properly, the scan segments do not have to be necessarily perpendicular to the object edges.

Hints

  • Connect the inImage input with an appropriate image source. Make sure that this image is available (the program was previously run).
  • If the object location is variable, connect an appropriate local coordinate system to inScanFieldAlignment.
  • Define inScanField by marking a directed rectangle within which the measurement will be done.
  • Define inStripeScanParams.StripePolarity to detect a particular edge type, and only that type.
  • If the noise level is high, try increasing inScanWidth and/or inStripeScanParams.SmoothingStdDev.
  • If some points are not found, try decreasing inStripeScanParams.MinMagnitude.
  • If the object is more narrow than 6 pixels, change inStripeScanParams.ProfileInterpolation to Quadratic3.
  • Experiment with inOutlierSuppression and inOutlierCount to deal with some amount of incorrectly detected points.
  • Increase inScanCount to improve accuracy.
  • Experiment with various values for inMeasureMethod to obtain best possible precision.

Examples

MeasureObjectWidth performed on the sample image. Green segments are diagScanSegments, the other two are found object edges.

See Also

  • FitSegmentToEdges – Performs a series of 1D edge detections and finds a segment that best matches the detected points.