mirror of
https://github.com/opencv/opencv.git
synced 2025-06-29 08:00:57 +08:00
Make LineSegmentDetector deterministic by using stable_sort for ordering keypoints prior to region growing
This makes LineSegmentDetector deterministic by using stable_sort for ordering points by norm. Without this change the region growing in LSD is non-determinstic and thus the returned lines are changing between invocations. This is a replacement for https://github.com/opencv/opencv/pull/23370
This commit is contained in:
parent
a924bbfc30
commit
6033599c88
@ -592,8 +592,8 @@ void LineSegmentDetectorImpl::ll_angle(const double& threshold,
|
||||
}
|
||||
}
|
||||
|
||||
// Sort
|
||||
std::sort(ordered_points.begin(), ordered_points.end(), compare_norm);
|
||||
// Use stable sort to ensure deterministic region growing and thus overall LSD result determinism.
|
||||
std::stable_sort(ordered_points.begin(), ordered_points.end(), compare_norm);
|
||||
}
|
||||
|
||||
void LineSegmentDetectorImpl::region_grow(const Point2i& s, std::vector<RegionPoint>& reg,
|
||||
|
Loading…
Reference in New Issue
Block a user