Skip to content

ximgproc: move LineSegmentDetector (LSD) from imgproc - #4158

Open
JArmandoAnaya wants to merge 1 commit into
opencv:5.xfrom
JArmandoAnaya:move-lsd-to-ximgproc
Open

ximgproc: move LineSegmentDetector (LSD) from imgproc#4158
JArmandoAnaya wants to merge 1 commit into
opencv:5.xfrom
JArmandoAnaya:move-lsd-to-ximgproc

Conversation

@JArmandoAnaya

@JArmandoAnaya JArmandoAnaya commented Jun 20, 2026

Copy link
Copy Markdown

As part of the imgproc cleanup in opencv/opencv #25001, this moves the Line
Segment Detector (LineSegmentDetector) from imgproc into ximgproc. LSD is a
self-contained, rarely used detector with no callers elsewhere in the library,
and ximgproc already provides a sibling FastLineDetector, so the extended module
is a more natural home for it.

This is the opencv_contrib side of the change. A companion pull request on the
main repository removes LSD from imgproc, and the two are meant to be merged
together so the detector is never defined in both modules at once. The public
interface is unchanged apart from the namespace, so callers reach the detector
through cv::ximgproc now.

The implementation, the public header (the LineSegmentDetector class, the
createLineSegmentDetector factory and the LineSegmentDetectorModes enum) and
the accuracy test move across unchanged apart from the cv::ximgproc namespace,
so it reads as a straight move. The lsd_lines sample is included as well.

The accuracy test moved with the function and still passes (18 cases across the
NONE / STD / ADV refinement modes and the common draw/compare paths).

Pull Request Readiness Checklist

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

As part of the imgproc cleanup in opencv/opencv#25001, this adds the Line
Segment Detector moved out of opencv core's imgproc: the LineSegmentDetector
class, the createLineSegmentDetector factory and the LineSegmentDetectorModes
enum, alongside the existing FastLineDetector.

This is the opencv_contrib side of the change. A companion pull request on the
main repository removes LSD from imgproc, and the two are meant to be merged
together so the functions are never defined in both modules at once. The public
interface is unchanged apart from the namespace, so callers reach the detector
through cv::ximgproc now.

The implementation, the public header and the accuracy test move across
unchanged apart from the cv::ximgproc namespace, so it reads as a straight move.
The lsd_lines sample is included as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant