Open
@Quintulius

Description

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://.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 ;