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

FisFilter_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: | FIL.h |
---|---|
Namespace: | fis |
Module: | FoundationPro |
Measures the width of an object using stripe detection.
Syntax
void fis::FisFilter_MeasureObjectWidth ( MeasureObjectWidthState& ioState, const fil::Image& inImage, const fil::SegmentScanField& inScanField, ftl::Optional<const fil::CoordinateSystem2D&> inScanFieldAlignment, int inScanCount, int inScanWidth, fil::InterpolationMethod::Type inImageInterpolation, const fil::StripeScanParams& inStripeScanParams, fil::MeasureObjectMethod::Type inMeasureMethod, fil::Selection::Type inStripeSelection, ftl::Optional<const fil::LocalBlindness&> inLocalBlindness, ftl::Optional<fil::MEstimator::Type> inOutlierSuppression, int inOutlierCount, ftl::Conditional<float>& outObjectWidth, ftl::Conditional<fil::Segment2D>& outSegment1, ftl::Conditional<fil::Segment2D>& outSegment2, ftl::Optional<fil::SegmentScanField&> outAlignedScanField = ftl::NIL, ftl::Optional<ftl::Array<ftl::Conditional<fil::Stripe1D>>&> outStripes = ftl::NIL, ftl::Optional<ftl::Array<fil::Profile>&> outBrightnessProfiles = ftl::NIL, ftl::Optional<ftl::Array<fil::Profile>&> outResponseProfiles = ftl::NIL, ftl::Array<fil::Segment2D>& diagScanSegments )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
![]() |
ioState | MeasureObjectWidthState& | Object used to maintain state of the function. | ||
![]() |
inImage | const Image& | Input image | ||
![]() |
inScanField | const SegmentScanField& | Field in which measurement scans are performed | ||
![]() |
inScanFieldAlignment | Optional<const CoordinateSystem2D&> | NIL | Adjusts the scan field to the position of the inspected object | |
![]() |
inScanCount | int | 2 - ![]() |
5 | Number of scans to be performed |
![]() |
inScanWidth | int | 1 - ![]() |
5 | Width of each single scan |
![]() |
inImageInterpolation | InterpolationMethod::Type | Bilinear | Interpolation method used in extraction of image pixel values | |
![]() |
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 | |
![]() |
inMeasureMethod | MeasureObjectMethod::Type | Method used to measure the object | ||
![]() |
inStripeSelection | Selection::Type | Selection mode of edges of the object | ||
![]() |
inLocalBlindness | Optional<const LocalBlindness&> | NIL | Defines conditions in which weaker edges can be detected in the vicinity of stronger edges | |
![]() |
inOutlierSuppression | Optional<MEstimator::Type> | NIL | Selects a method for ignoring incorrectly detected points | |
![]() |
inOutlierCount | int | 0 - ![]() |
Determines how many points are not count when object width is measured | |
![]() |
outObjectWidth | Conditional<float>& | Width of the object | ||
![]() |
outSegment1 | Conditional<Segment2D>& | First edge of the object | ||
![]() |
outSegment2 | Conditional<Segment2D>& | Second edge of the object | ||
![]() |
outAlignedScanField | Optional<SegmentScanField&> | NIL | Field in which the scans are performed | |
![]() |
outStripes | Optional<Array<Conditional<Stripe1D>>&> | NIL | Detected stripes | |
![]() |
outBrightnessProfiles | Optional<Array<Profile>&> | NIL | Extracted image profiles | |
![]() |
outResponseProfiles | Optional<Array<Profile>&> | NIL | Profiles of the edge (derivative) operator | |
![]() |
diagScanSegments | Array<Segment2D>& | Segments along which the scans are performed |
Optional Outputs
The computation of following outputs can be switched off by passing value ftl::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
- ScanSingleStripe – Locates the strongest pair of edges across a given path.
- FitSegmentToEdges – Performs a series of 1D edge detections and finds a segment that best matches the detected points.