如何找到opencv c ++中最大的轮廓

编程入门 行业动态 更新时间:2024-10-26 22:26:13
本文介绍了如何找到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 ++中最大的轮廓

本文发布于:2023-05-26 20:20:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/265214.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:轮廓   opencv

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!