【发布时间】:2012-07-03 13:08:25
【问题描述】:
我尝试了本书中的示例代码来绘制原始图片中的轮廓。但是,以下代码在带有 Mingw 4.4 的 Qt 下无法成功编译。
// 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;
}
警告:有符号和无符号整数表达式之间的比较 警告:有符号和无符号整数表达式之间的比较 错误:没有匹配函数调用 'std::vector, std::allocator > >, std::allocator, std::allocator > > >::erase(__gnu_cxx::__normal_iterator, std::allocator > >* , std::vector, std::allocator > >, std::allocator, std::allocator > > > > >&)'
它说itc 没有方法size()。然而,这本书真的是这样写的。我错过了什么吗?
【问题讨论】: