Skip to content

Commit e89501a

Browse files
committed
Merge pull request opencv#10072 from sturkmen72:upd_lsd_cpp
2 parents 2e77251 + 992a81d commit e89501a

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

modules/imgproc/src/lsd.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,23 +1146,10 @@ void LineSegmentDetectorImpl::drawSegments(InputOutputArray _image, InputArray l
11461146

11471147
CV_Assert(!_image.empty() && (_image.channels() == 1 || _image.channels() == 3));
11481148

1149-
Mat gray;
11501149
if (_image.channels() == 1)
11511150
{
1152-
gray = _image.getMatRef();
1151+
cvtColor(_image, _image, COLOR_GRAY2BGR);
11531152
}
1154-
else if (_image.channels() == 3)
1155-
{
1156-
cvtColor(_image, gray, CV_BGR2GRAY);
1157-
}
1158-
1159-
// Create a 3 channel image in order to draw colored lines
1160-
std::vector<Mat> planes;
1161-
planes.push_back(gray);
1162-
planes.push_back(gray);
1163-
planes.push_back(gray);
1164-
1165-
merge(planes, _image);
11661153

11671154
Mat _lines;
11681155
_lines = lines.getMat();
@@ -1174,7 +1161,7 @@ void LineSegmentDetectorImpl::drawSegments(InputOutputArray _image, InputArray l
11741161
const Vec4f& v = _lines.at<Vec4f>(i);
11751162
Point2f b(v[0], v[1]);
11761163
Point2f e(v[2], v[3]);
1177-
line(_image.getMatRef(), b, e, Scalar(0, 0, 255), 1);
1164+
line(_image, b, e, Scalar(0, 0, 255), 1);
11781165
}
11791166
}
11801167

0 commit comments

Comments
 (0)