@@ -109,6 +109,7 @@ class EdgeDrawingImpl : public EdgeDrawing
109109 void getGradientImage (OutputArray dst) CV_OVERRIDE;
110110
111111 vector<vector<Point> > getSegments () CV_OVERRIDE;
112+ vector<int > getSegmentIndicesOfLines () const CV_OVERRIDE;
112113 void detectLines (OutputArray lines) CV_OVERRIDE;
113114 void detectEllipses (OutputArray ellipses) CV_OVERRIDE;
114115
@@ -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++)
@@ -1312,12 +1319,15 @@ void EdgeDrawingImpl::detectLines(OutputArray _lines)
13121319 for (int i = 1 ; i <= size - linesNo; i++)
13131320 lines.pop_back ();
13141321
1322+ segmentIndicesOfLines.clear ();
13151323 for (int i = 0 ; i < linesNo; i++)
13161324 {
13171325 Vec4f line ((float )lines[i].sx , (float )lines[i].sy , (float )lines[i].ex , (float )lines[i].ey );
13181326 linePoints.push_back (line);
1327+ segmentIndicesOfLines.push_back (lines[i].segmentNo );
13191328 }
13201329 Mat (linePoints).copyTo (_lines);
1330+
13211331 delete[] x;
13221332 delete[] y;
13231333}
0 commit comments