Skip to content

fast_line_detector do not merge segments oriented in the opposite direction #3956

@Quintulius

Description

@Quintulius

The function bool FastLineDetectorImpl::mergeSegments allows to merge small segments into a longer one based on the distance between these segments and their orientation.

Currently, two segments on the same line with two different directions (angle of 180° and -180° for example) are not merge as the difference between their two angles is computed as:

float angdiff = fabs(seg1.angle - seg2.angle);

See https://github.com/opencv/opencv_contrib/blob/1e4d4e0f3e4c7d6d7ab9d738026fe13d3cd85cf4/modules/ximgproc/src/fast_line_detector.cpp#L268C5-L268C51

The difference should be computed as:

float angdiff = fabs(seg1.angle - seg2.angle) % 180.0f ;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions