You are here: Start » Function Reference » Computer Vision » Hough Transform » DetectSegments

DetectSegments
Header: | FIL.h |
---|---|
Namespace: | fil |
Module: | FoundationBasic |
Finds segments in an image using Hough Transform.
Syntax
void fil::DetectSegments ( const fil::Image& inImage, ftl::Optional<const fil::Region&> inRoi, float inAngleResolution, float inMinAngleDelta, float inMinDistance, float inMinLength, float inMinScore, float inEdgeThreshold, ftl::Array<fil::Segment2D>& outSegments, fil::Image& diagGradientMagnitudeImage, fil::Image& diagScoreImage )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
![]() |
inImage | const Image& | Input image | ||
![]() |
inRoi | Optional<const Region&> | NIL | Input region of interest | |
![]() |
inAngleResolution | float | 0.1 - 180.0 | 1.0f | Resolution of segments' orientation |
![]() |
inMinAngleDelta | float | 0.0 - ![]() |
20.0f | Minimum angle between two segments |
![]() |
inMinDistance | float | 0.0 - ![]() |
20.0f | Minimum distance between two segments |
![]() |
inMinLength | float | 0.0 - ![]() |
20.0f | Minimum segment length |
![]() |
inMinScore | float | 0.0 - ![]() |
20.0f | Minimum matching score |
![]() |
inEdgeThreshold | float | 10.0f | Minimum accepted edge magnitude | |
![]() |
outSegments | Array<Segment2D>& | Output segments | ||
![]() |
diagGradientMagnitudeImage | Image& | Visualized gradients magnitude of an input image | ||
![]() |
diagScoreImage | Image& | Calculated score for each pixel of an input image |
Description
The operation detects straight edges in the inImage using the Hough Transform approach and treats them as segments by tracing gradients along lines. The output array is ordered from best matching to worst matching results.
The parameter inAngleResolution specifies the precision of detected lines' orientations. Value of n means the filter will be able to reliably distinguish lines in n-degree increments.
Parameters inMinAngleDelta and inMinDistance are used for neighbouring results suppression. inMinAngleDelta specifies the minimum angle between two lines while inMinDistance specifies the minimum distance between two parallel lines. Parameter inMinLength limits the length of segments (in pixels), suppressing too short segments.
The orientations of the resulting segments are always between 0 and 180 degrees.
Examples
![]() |
![]() |
DetectSegments performed on the sample image with inMinScore = 0.5, inMinLength = 25.
Remarks
Low values of inAngleResolution (under 0.5) may cause high memory consumption and decrease in performance.
See Also
- DetectLines – Finds lines in an image using Hough Transform.
- DetectMultipleCircles – Finds circles of a given radius in the input image using Hough Transform.
- DetectPaths – Finds a specified shape in an image using Hough Transform.