@@ -109,7 +109,8 @@ class EdgeDrawingImpl : public EdgeDrawing
109109 void getGradientImage (OutputArray dst) CV_OVERRIDE;
110110
111111 vector<vector<Point> > getSegments () CV_OVERRIDE;
112- void detectLines (OutputArray lines, OutputArray segments = cv::noArray()) CV_OVERRIDE;
112+ vector<int > getSegmentIndicesOfLines () const CV_OVERRIDE;
113+ void detectLines (OutputArray lines) CV_OVERRIDE;
113114 void detectEllipses (OutputArray ellipses) CV_OVERRIDE;
114115
115116 virtual void read (const FileNode& fn) CV_OVERRIDE;
@@ -120,6 +121,7 @@ class EdgeDrawingImpl : public EdgeDrawing
120121 int height; // height of source image
121122 uchar *srcImg;
122123 vector<vector<Point> > segmentPoints;
124+ vector<int > segmentIndicesOfLines;
123125 Mat smoothImage;
124126 uchar *edgeImg; // pointer to edge image data
125127 uchar *smoothImg; // pointer to smoothed image data
@@ -440,6 +442,11 @@ std::vector<std::vector<Point> > EdgeDrawingImpl::getSegments()
440442 return segmentPoints;
441443}
442444
445+ std::vector<int > EdgeDrawingImpl::getSegmentIndicesOfLines () const
446+ {
447+ return segmentIndicesOfLines;
448+ }
449+
443450void EdgeDrawingImpl::ComputeGradient ()
444451{
445452 for (int j = 0 ; j < width; j++)
@@ -1263,7 +1270,7 @@ int EdgeDrawingImpl::RetrieveChainNos(Chain* chains, int root, int chainNos[])
12631270 return count;
12641271}
12651272
1266- void EdgeDrawingImpl::detectLines (OutputArray _lines, OutputArray _lineSegments )
1273+ void EdgeDrawingImpl::detectLines (OutputArray _lines)
12671274{
12681275 std::vector<Vec4f> linePoints;
12691276 if (segmentPoints.size () < 1 )
@@ -1312,18 +1319,14 @@ void EdgeDrawingImpl::detectLines(OutputArray _lines, OutputArray _lineSegments)
13121319 for (int i = 1 ; i <= size - linesNo; i++)
13131320 lines.pop_back ();
13141321
1315- std::vector< int > lineSegmentIndices ;
1322+ segmentIndicesOfLines. clear () ;
13161323 for (int i = 0 ; i < linesNo; i++)
13171324 {
13181325 Vec4f line ((float )lines[i].sx , (float )lines[i].sy , (float )lines[i].ex , (float )lines[i].ey );
13191326 linePoints.push_back (line);
1320- lineSegmentIndices .push_back (lines[i].segmentNo );
1327+ segmentIndicesOfLines .push_back (lines[i].segmentNo );
13211328 }
13221329 Mat (linePoints).copyTo (_lines);
1323- if (_lineSegments.needed ())
1324- {
1325- Mat (lineSegmentIndices).copyTo (_lineSegments);
1326- }
13271330
13281331 delete[] x;
13291332 delete[] y;
0 commit comments