I tried the example code in this book to draw the contours in the original picture. However, the following code won't compile successfully under Qt with Mingw 4.4.
// Eliminate too short or too long contours
int cmin= 100; // minimum contour length
int cmax= 1000; // maximum contour length
std::vector<std::vector<cv::Point> >::
const_iterator itc= contours.begin();
while (itc!=contours.end()) {
if (itc->size() < cmin || itc->size() > cmax)
itc= contours.erase(itc);
else
++itc;
}
Warning:comparison between signed and unsigned integer expressions Warning:comparison between signed and unsigned integer expressions Error:no matching function for call to 'std::vector, std::allocator > >, std::allocator, std::allocator > > > >::erase(__gnu_cxx::__normal_iterator, std::allocator > >*, std::vector, std::allocator > >, std::allocator, std::allocator > > > > >&)'
It says that the itc doesn't have the method size(). However, the book really writes like that. Did I miss something?