在opencv3.0 c++中擦除boundRect
Erase a boundRect in opencv 3.0 C++
我在使用contourns图像中找到一个对象。我在boundRects中附上了可能的候选人,以查看最终结果,我想删除高度>宽度的决赛矩形(将其括在黑色圆圈中)。有什么建议吗?谢谢你的帮助和回应。我的代码是:
enter vector<vector<Point> > contours_poly(contours.size());
vector<Rect> boundRect(contours.size());
for (size_t i = 0; i < contours.size(); i++)
{
approxPolyDP(Mat(contours[i]), contours_poly[i], 3, true);
boundRect[i] = boundingRect(Mat(contours_poly[i]));
}
for (int i = 0; i < contours.size(); i++)
{
Scalar color = Scalar(255, 0, 255);
rectangle(result_white, boundRect[i].tl(), boundRect[i].br(), color, 2, 8, 0);
rectangle(imageLoad, boundRect[i].tl(), boundRect[i].br(), color, 2, 8, 0);
}
imshow("white final", imageLoad);
,最终结果为:最终的图像
为什么要删除它们?
如果不符合您的要求,请不要将它们附加到矩形向量(使用push_back for vector)。
相关文章:
- 引用一个已擦除类型(void*)的指针
- 擦除while循环中迭代的元素
- 在运行时处理类型擦除的数据-如何不重新发明轮子
- C++擦除(如果存在)
- 在映射擦除c++期间执行循环的次数
- 为什么擦除方法会影响结束方法
- C++ 字符串类擦除成员函数的时空复杂性
- 类型擦除的std::function与虚拟函数调用的开销
- C++14 中unordered_map矢量和擦除删除成语的奇怪行为
- C++ 擦除函数中需要澄清
- 循环挂起迭代的 std::擦除 on std::list
- 擦除许多矢量元素,同时使用'auto'
- 如何擦除冗余输入?
- C++ STL 设置按值擦除
- 如何在C++中允许成员函数的自定义返回类型进行类型擦除?
- 为什么我的向量::擦除调用会抛出"vector subscript out of range"?
- 如何在写入文件时擦除最后一个逗号
- C++:std::ofstream 方法 open() 在第二次迭代时擦除打开的 ifstream 文件
- 双链表的擦除值函数,未知错误
- 在opencv3.0 c++中擦除boundRect