From 992a81dcaa44797cf977a2e982cb1eb24f1bd208 Mon Sep 17 00:00:00 2001 From: Suleyman TURKMEN Date: Sat, 11 Nov 2017 11:59:55 +0300 Subject: [PATCH] Update lsd.cpp --- modules/imgproc/src/lsd.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/modules/imgproc/src/lsd.cpp b/modules/imgproc/src/lsd.cpp index a8ea384ab8..5727230d9b 100644 --- a/modules/imgproc/src/lsd.cpp +++ b/modules/imgproc/src/lsd.cpp @@ -1146,23 +1146,10 @@ void LineSegmentDetectorImpl::drawSegments(InputOutputArray _image, InputArray l CV_Assert(!_image.empty() && (_image.channels() == 1 || _image.channels() == 3)); - Mat gray; if (_image.channels() == 1) { - gray = _image.getMatRef(); + cvtColor(_image, _image, COLOR_GRAY2BGR); } - else if (_image.channels() == 3) - { - cvtColor(_image, gray, CV_BGR2GRAY); - } - - // Create a 3 channel image in order to draw colored lines - std::vector planes; - planes.push_back(gray); - planes.push_back(gray); - planes.push_back(gray); - - merge(planes, _image); Mat _lines; _lines = lines.getMat(); @@ -1174,7 +1161,7 @@ void LineSegmentDetectorImpl::drawSegments(InputOutputArray _image, InputArray l const Vec4f& v = _lines.at(i); Point2f b(v[0], v[1]); Point2f e(v[2], v[3]); - line(_image.getMatRef(), b, e, Scalar(0, 0, 255), 1); + line(_image, b, e, Scalar(0, 0, 255), 1); } }