diff --git a/modules/imgproc/src/lsd.cpp b/modules/imgproc/src/lsd.cpp index a8ea384ab8..1e738ac4e0 100644 --- a/modules/imgproc/src/lsd.cpp +++ b/modules/imgproc/src/lsd.cpp @@ -430,6 +430,9 @@ void LineSegmentDetectorImpl::detect(InputArray _image, OutputArray _lines, if(w_needed) Mat(w).copyTo(_width); if(p_needed) Mat(p).copyTo(_prec); if(n_needed) Mat(n).copyTo(_nfa); + + // Clear used structures + list.clear(); } void LineSegmentDetectorImpl::flsd(std::vector& lines,