首页 > 其他 > 详细

滤出轮廓中较大或者较小的

时间:2018-01-24 20:28:21      阅读:206      评论:0      收藏:0      [点我收藏+]
 //查找轮廓    
    int cmin = 10;     // 轮廓最短值
    int cmax = 1000;    // 轮廓最长值
    findContours( canny_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );     
    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;
    }

 

滤出轮廓中较大或者较小的

原文:https://www.cnblogs.com/Peit/p/8343183.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!