本文介绍了如何找到opencv c ++中最大的轮廓的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想提取图片中的主要物件。所以我应用grabcut算法的图像。
I want to extract the main object in images. So I applied grabcut algorithm for the image. From that I want to take the largest contour in the result image resulted from the grabcut algorithm.
推荐答案只需使用 findContours 函数查找具有 GC_FGD 值的所有轮廓。在这之后使用 contourArea 和通过所有轮廓的简单迭代,找到最大的正方形轮廓。
Just use findContours function to find all contours with GC_FGD value. After this use contourArea and simple iteration through all contours to find contour with the biggest square.
更多推荐
如何找到opencv c ++中最大的轮廓
发布评论