@@ -121,21 +121,6 @@ static void findSquares( const Mat& image, vector<vector<Point> >& squares )
121
121
}
122
122
}
123
123
124
-
125
- // the function draws all the squares in the image
126
- static void drawSquares ( Mat& image, const vector<vector<Point> >& squares )
127
- {
128
- for ( size_t i = 0 ; i < squares.size (); i++ )
129
- {
130
- const Point* p = &squares[i][0 ];
131
- int n = (int )squares[i].size ();
132
- polylines (image, &p, &n, 1 , true , Scalar (0 ,255 ,0 ), 3 , LINE_AA);
133
- }
134
-
135
- imshow (wndname, image);
136
- }
137
-
138
-
139
124
int main (int argc, char ** argv)
140
125
{
141
126
static const char * names[] = { " pic1.png" , " pic2.png" , " pic3.png" ,
@@ -148,8 +133,6 @@ int main(int argc, char** argv)
148
133
names[1 ] = " 0" ;
149
134
}
150
135
151
- vector<vector<Point> > squares;
152
-
153
136
for ( int i = 0 ; names[i] != 0 ; i++ )
154
137
{
155
138
string filename = samples::findFile (names[i]);
@@ -160,8 +143,11 @@ int main(int argc, char** argv)
160
143
continue ;
161
144
}
162
145
146
+ vector<vector<Point> > squares;
163
147
findSquares (image, squares);
164
- drawSquares (image, squares);
148
+
149
+ polylines (image, squares, true , Scalar (0 , 255 , 0 ), 3 , LINE_AA);
150
+ imshow (wndname, image);
165
151
166
152
int c = waitKey ();
167
153
if ( c == 27 )
0 commit comments